Ejemplo n.º 1
0
        public JsonResult ProcessPageList(AppProductionLineProductProcess model, int page = 1, int rows = 10)
        {
            var query = db.AppProductionLineProductProcesses.AsQueryable();

            if (model.CN_GUID_LINE_PRODUCT != Guid.Empty)
            {
                query = query.Where(m => m.CN_GUID_LINE_PRODUCT == model.CN_GUID_LINE_PRODUCT);
            }
            if (!string.IsNullOrWhiteSpace(model.CN_PROCESS_NAME))
            {
                query = query.Where(m => m.CN_PROCESS_INFO.Contains(model.CN_PROCESS_INFO));
            }
            if (!string.IsNullOrWhiteSpace(model.CN_PROCESS_ORDER))
            {
                query = query.Where(m => m.CN_PROCESS_INFO.Contains(model.CN_PROCESS_INFO));
            }
            if (!string.IsNullOrWhiteSpace(model.CN_PROCESS_INFO))
            {
                query = query.Where(m => m.CN_PROCESS_INFO.Contains(model.CN_PROCESS_INFO));
            }
            var list  = query.OrderBy(obj => obj.CN_PROCESS_ORDER).Skip((page - 1) * rows).Take(rows).ToList();
            var count = query.Count();

            return(Json(ResultInfo.Success(new { rows = list, total = count })));
        }
Ejemplo n.º 2
0
 public JsonResult RemoveProcess(AppProductionLineProductProcess process)
 {
     if (process.CN_ID == 0)
     {
         return(Json(ResultInfo.Fail(Lang.ParamIsEmpty)));
     }
     db.AppProductionLineProductProcesses.Attach(process);
     db.AppProductionLineProductProcesses.Remove(process);
     db.SaveChanges();
     return(Json(ResultInfo.Success("删除成功!")));
 }
Ejemplo n.º 3
0
        public JsonResult AddProcess(AppProductionLineProductProcess process)
        {
            if (process.CN_GUID_LINE_PRODUCT == Guid.Empty ||
                string.IsNullOrWhiteSpace(process.CN_PROCESS_NAME) ||
                string.IsNullOrWhiteSpace(process.CN_PROCESS_ORDER)
                )
            {
                return(Json(ResultInfo.Fail(Lang.ParamIsEmpty)));
            }
            var user = LoginUserInfo.GetLoginUser();
            var now  = DateTime.Now;

            process.CN_DT_CREATE    = now;
            process.CN_CREATE_BY    = user.UserId;
            process.CN_CREATE_NAME  = user.Name;
            process.CN_CREATE_LOGIN = user.Login;
            db.AppProductionLineProductProcesses.Add(process);
            db.SaveChanges();
            return(Json(ResultInfo.Success("添加成功!")));
        }