ASP.NET MVC JS发送JSON格式参数,后台获取
var queryJson = {
keyword: $("#txt_keyword").val(),
starttime: $("#txt_starttime").val(),
endtime: $("#txt_endtime").val()
}
$gridList.jqGrid('setGridParam', {
postData: {
keyword: JSON.stringify(queryJson)
}
}).trigger('reloadGrid');
var expression = ExtLinq.True();
var queryParam = queryJson.ToJObject();
if (!queryParam["keyword"].IsEmpty())
{
string keyword = queryParam["keyword"].ToString();
//keyWord可能为设备型号/设备名称/生产厂商/销售人员名称
string semId = salesEquipmentModelApp.SearchModelIdBySearchkey(keyword);
//设备型号/设备名称/生产厂商为空
List salesRecordList = new List();
if (string.IsNullOrEmpty(semId))
{
salesRecordList = salesRecordApp.SearchSalesRecordBySalesMan(keyword);
}
if (!string.IsNullOrEmpty(keyword))
{
if (!string.IsNullOrEmpty(semId))
{
expression = expression.And(t => t.SEM_ID.ToLower().Contains(semId.ToLower()));
}
if (salesRecordList.Count > 0)
{
foreach (var salesRecord in salesRecordList)
{
expression = expression.And(t => t.SR_ID.ToLower().Contains(salesRecord.SR_ID.ToLower()));
}
}
}
}
if (!queryParam["starttime"].IsEmpty() && !queryParam["endtime"].IsEmpty())
{
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
dtFormat.ShortDatePattern = "yyyy/MM/dd";
DateTime starttime = Convert.ToDateTime(queryParam["starttime"], dtFormat);
DateTime endtime = Convert.ToDateTime(queryParam["endtime"], dtFormat);
expression = expression.And(t => t.SR_SALESDATE >= starttime && t.SR_SALESDATE <= endtime);
}
expression = expression.And(t => t.SRD_STATUS != -1);//已删除的不获取
return service.FindList(expression, pagination);
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~