Exemplo n.º 1
0
        private List <BA04AModel> GetList(SearchViewModel search)
        {
            //var sqlCmd = new CommonHelper().GetSqlCmd("BA04A", search);
            var queryData = _Service.GetMany(x => x.BA04A_ID > 0);

            if (!string.IsNullOrWhiteSpace(search.S_SET_NO))
            {
                queryData = queryData.Where(x => x.SET_NO.Contains(search.S_SET_NO));
            }
            if (!string.IsNullOrWhiteSpace(search.S_SET_NM))
            {
                queryData = queryData.Where(x => x.SET_NM.Contains(search.S_SET_NM));
            }
            return(BA04Business.FromEntity(queryData.ToList()));
        }
Exemplo n.º 2
0
        private PartialViewResult ResultHandler(ResultHelper <BA04A> result, SearchViewModel search)
        {
            if (result.Message == "")
            {
                ViewData["Success"] = true;
            }
            else
            {
                ViewData["ErrMsg"] = result.Message;
                var master = BA04Business.FromEntity(result.Data);
                master.ModelState     = ModelState;
                ViewData["ErrorData"] = master;
            }

            return(PartialView("_Grid", GetList(search)));;
        }
Exemplo n.º 3
0
        public ActionResult Update(BA04AModel master)
        {
            //Validation
            List <string> errList = BA04Business.Validation(master, ModelState);

            //BeforeSave + 驗證DDM + Save
            if (errList.Count == 0)
            {
                //BeforeSave
                var BA04A = BA04Business.BeforSave(master);

                //驗證DDM
                errList = BA04Business.Validation(master, ModelState, "BA04A");

                //Save
                if (errList.Count == 0)
                {
                    var result = _Service.Update(BA04A);
                    master = BA04Business.FromEntity(result.Data);

                    if (!string.IsNullOrWhiteSpace(result.Message))
                    {
                        errList.Add(result.Message);
                    }
                }
            }

            if (errList.Count > 0)
            {
                ViewData["ErrMsg"]    = string.Join("<br />", errList);
                master.ModelState     = ModelState;
                ViewData["ErrorData"] = master;
            }
            else
            {
                CacheCommonDataModule.ResetBA04AList();
                ViewData["Success"] = true;
            }

            return(PartialView("_MasterGrid", GetList()));
        }
Exemplo n.º 4
0
 private List <BA04AModel> GetList()
 {
     return(BA04Business.FromEntity(_Service.GetA(x => x.BA04A_ID > 0).ToList()));
 }