public ActionResult C(PrizeResultInfo info) { if (string.IsNullOrEmpty(info.Name)) { return(Json(new APIJson(1, ""))); } if (string.IsNullOrEmpty(info.Name) || info.Name.Length > 50) { return(Json(new APIJson(2, ""))); } if (string.IsNullOrEmpty(info.StoreAdd)) { return(Json(new APIJson(3, ""))); } if (info.StoreAdd.Length > 500) { return(Json(new APIJson(4, ""))); } if (!IsMobilePhone(info.Tel)) { return(Json(new APIJson(5, "手机号输入不正确,请重新输入!"))); } if (info.SnNumber.Length != 15) { return(Json(new APIJson(6, "SN!"))); } if (string.IsNullOrEmpty(info.AreaName)) { return(Json(new APIJson(7, "Area!"))); } var infoExist = PrizeResultBLL.GetList(a => a.SnNumber == info.SnNumber).FirstOrDefault(); if (null == infoExist) { return(Json(new APIJson(8, "SN not exist!"))); } if (!string.IsNullOrEmpty(infoExist.Name)) { var ExistOBJ = new { infoExist.ID, infoExist.Name, infoExist.IP, infoExist.StoreAdd, infoExist.Tel, infoExist.SnNumber, infoExist.CreateDate, infoExist.Result }; return(Json(new APIJson(-1, "Has Taken!", ExistOBJ))); } // infoExist.IP = info.IP; infoExist.Name = info.Name; infoExist.StoreAdd = info.StoreAdd; infoExist.Tel = info.Tel; //infoExist.SnNumber=info infoExist.AreaName = info.AreaName; infoExist.CreateDate = DateTime.Now; //infoExist.Result if (PrizeResultBLL.Edit(infoExist)) { var ExistOBJ = new { infoExist.ID, infoExist.Name, infoExist.IP, infoExist.StoreAdd, infoExist.Tel, infoExist.SnNumber, infoExist.CreateDate, infoExist.Result }; return(Json(new APIJson(0, "OK!", ExistOBJ))); } else { return(Json(new APIJson(9, "NotSavedYet!"))); } }
private IQueryable <PrizeResultInfo> GetListData() { var list = PrizeResultBLL.GetList(p => true); string RS = Function.GetRequestString("RS"); DateTime DateBegin = Function.GetRequestDateTime("DateBegin"); DateTime DateEnd = Function.GetRequestDateTime("DateEnd"); string Name = Function.GetRequestString("Name"); string SN = Function.GetRequestString("SN"); if (DateBegin > DicInfo.DateZone) { list = list.Where(a => DbFunctions.DiffDays(a.CreateDate, DateBegin) <= 0); ViewBag.TxtDateBegin = DateBegin.ToString("yyyy-MM-dd"); } if (DateEnd > DicInfo.DateZone) { list = list.Where(a => DbFunctions.DiffDays(a.CreateDate, DateEnd) >= 0); ViewBag.TxtDateEnd = DateEnd.ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(Name)) { list = list.Where(a => a.Name.Contains(Name) || a.Tel.Contains(Name)); ViewBag.TxtName = Name; } if (!string.IsNullOrEmpty(RS)) { list = list.Where(a => a.IP.Contains(RS)); ViewBag.TxtRS = RS; } if (!string.IsNullOrEmpty(SN)) { list = list.Where(a => a.SnNumber.Contains(SN)); ViewBag.TxtSN = SN; } list = list.OrderBy(p => p.Result); return(list); }