示例#1
0
        /// <summary>
        /// 新增验证
        /// </summary>
        /// <param name="userinfo"></param>
        /// <returns></returns>
        public ActionResult CheckAdd(coal_check model)
        {
            string otype  = model != null && model.ID == 0 ? "add" : "update";
            var    result = 0;
            Expression <Func <sys_userinfo, bool> > wherelambad = u => 1 == 1;//查询条件;

            if (otype == "add")
            {
                model.CreateTime = model.UpdateTime = DateTime.Now;
                model.CreateUser = model.UpdateUser = 1;
                result           = Bll.Add(model);
            }
            else
            {
                model.UpdateTime = DateTime.Now;
                result           = Bll.Update(model);
            }
            if (result != 0)
            {
                string msg = CommonMsg.SuccessAlert(200, "操作成功 ! ", "coal_check", callbackType: "closeCurrent");
                return(Content(msg));
            }
            else
            {
                return(Content(CommonMsg.ErrorAlert(300, "操作失败")));
            }
        }
示例#2
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="pageNum"></param>
        /// <param name="numPerPage"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult Index(int?pageNum, int?numPerPage, coal_check model)
        {
            int pageIndex   = pageNum.HasValue ? pageNum.Value : 1;
            int pageSize    = numPerPage.HasValue && numPerPage.Value > 0 ? numPerPage.Value : 20;
            int recordCount = 0;
            //(q) => q.id,排序的字段
            Expression <Func <coal_check, bool> > wherelambad = u => 1 == 1;//查询条件;

            if (model.CC_CheckTime != null && model.CC_CheckTime.ToString() != "0001-01-01 00:00:00")
            {
                wherelambad = wherelambad = u => u.CC_CheckTime == model.CC_CheckTime;//检测日期
            }
            if (!string.IsNullOrWhiteSpace(model.CC_FName))
            {
                wherelambad = wherelambad.And(u => u.CC_FName == model.CC_FName);//厂家名称
            }
            //true,升序,false降序
            var data = Bll.GetPageEntities <DateTime>(pageIndex, pageSize, out recordCount, wherelambad, (q) => q.CreateTime, false);

            ViewData["pageIndex"]    = pageIndex;
            ViewData["pageSize"]     = pageSize;
            ViewData["recordCount"]  = recordCount;
            ViewData["CC_CheckTime"] = model.CC_CheckTime != null && model.CC_CheckTime.ToString() != "0001-01-01 00:00:00" ? model.CC_CheckTime.ToString() : "";
            ViewData["CC_FName"]     = model.CC_FName;
            var list = data.ToList();

            return(View(list));
        }
 public int Update(coal_check model)
 {
     return(Dal.Update(model));
 }
 public int Add(coal_check model)
 {
     return(Dal.Add(model));
 }