public ActionResult Search(SEC001P001Model model)
        {
            var da = new SEC001P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC000P001ExecuteType.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));
        }
        public ActionResult Edit(string TBL_NAME)
        {
            SetDefaulButton(StandardButtonMode.Modify);

            var da = new SEC001P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC001P001ExecuteType.GetByID;
            TempModel.TBL_NAME         = da.DTO.Model.TBL_NAME = TBL_NAME.ToString();
            da.Select(da.DTO);
            if (da.DTO.Model != null)
            {
                localModel = da.DTO.Model;
            }

            SetDefaultData();
            return(View(StandardActionName.Edit, localModel));
        }
        private DTOResult SaveData(string mode, object model)
        {
            var da = new SEC001P001DA();

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


            if (mode == StandardActionName.SaveCreate)
            {
                SetStandardField(model);
                da.DTO.Model          = (SEC001P001Model)model;
                da.DTO.Model.TBL_NAME = TempModel.TBL_NAME;

                da.Insert(da.DTO);
            }
            else if (mode == StandardActionName.SaveModify)
            {
                SetStandardField(model);
                da.DTO.Model = (SEC001P001Model)model;

                da.DTO.Model.TBL_NAME = TempModel.TBL_NAME;

                da.Update(da.DTO);
            }
            else if (mode == StandardActionName.Delete)
            {
                //da.DTO.Model = new SEC001P001Model();
                //SetStandardField(da.DTO.Model);
                da.DTO.Models = (List <SEC001P001Model>)model;
                da.Delete(da.DTO);
            }
            return(da.DTO.Result);
        }