예제 #1
0
        private DTOResult SaveData(string mode, object model)
        {
            var da = new SECS01P004DA();

            //ในกรณีที่มีการ SaveLog ให้ Include SetStandardLog ด้วย
            SetStandardLog(
                da.DTO,
                model,
                GetSaveLogConfig("dbo", "VSMS_SYSTEM", "ID"));


            if (mode == StandardActionName.SaveCreate)
            {
                SetStandardField(model);
                da.DTO.Model = (SECS01P004Model)model;
                da.Insert(da.DTO);
            }
            else if (mode == StandardActionName.SaveModify)
            {
                SetStandardField(model);
                da.DTO.Model = (SECS01P004Model)model;
                da.Update(da.DTO);
            }
            else if (mode == StandardActionName.Delete)
            {
                da.DTO.Model = new SECS01P004Model();
                SetStandardField(da.DTO.Model);
                da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE;
                da.DTO.Models         = (List <SECS01P004Model>)model;
                da.Delete(da.DTO);
            }
            return(da.DTO.Result);
        }
예제 #2
0
        public ActionResult Search(SECS01P004Model model)
        {
            var da = new SECS01P004DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SECS01P004ExecuteType.GetAll;
            if (Request.GetRequest("page").IsNullOrEmpty())
            {
                model.IsDefaultSearch = true;
                TempSearch            = model;
            }
            da.DTO.Model = TempSearch;
            da.Select(da.DTO);
            return(JsonAllowGet(da.DTO.Models, da.DTO.Result));
        }
예제 #3
0
        public ActionResult Add()
        {
            SetDefaulButton(StandardButtonMode.Create);

            var da = new SECS01P004DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SECS01P004ExecuteType.GetSeqMax;
            da.DTO.Model.COM_CODE      = SessionHelper.SYS_COM_CODE;
            da.Select(da.DTO);
            if (da.DTO.Model != null)
            {
                localModel = da.DTO.Model;
            }

            SetDefaultData();
            return(View(StandardActionName.Add, localModel));
        }
예제 #4
0
        public ActionResult Edit(string SYS_CODE)
        {
            SetDefaulButton(StandardButtonMode.Modify);

            var da = new SECS01P004DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SECS01P004ExecuteType.GetByID;
            TempModel.SYS_CODE         = da.DTO.Model.SYS_CODE = SYS_CODE;
            da.DTO.Model.COM_CODE      = SessionHelper.SYS_COM_CODE;
            da.Select(da.DTO);
            if (da.DTO.Model != null)
            {
                localModel = da.DTO.Model;
            }

            SetDefaultData();
            return(View(StandardActionName.Edit, localModel));
        }