private DTOResult SaveData(string mode, object model)
        {
            var da = new MISS01P002DA();

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


            if (mode == StandardActionName.SaveCreate)
            {
                SetStandardField(model);
                da.DTO.Model = (MISS01P002Model)model;
                //da.DTO.Execute.ExecuteType = MISS01P002ExecuteType.Insert;
                da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE;

                da.InsertNoEF(da.DTO);
            }
            else if (mode == StandardActionName.Delete)
            {
                da.DTO.Models         = (List <MISS01P002Model>)model;
                da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE;
                da.DeleteNoEF(da.DTO);
            }
            else if (mode == "Assignment")
            {
                SetStandardField(model);
                da.DTO.Execute.ExecuteType = MISS01P002ExecuteType.UpdateAssignment;
                da.DTO.Model = (MISS01P002Model)model;
                da.UpdateNoEF(da.DTO);
            }
            else if (mode == "FilePacket")
            {
                SetStandardFieldWithoutComCode(model);
                da.DTO.Execute.ExecuteType = MISS01P002ExecuteType.UpdateFilePacket;
                da.DTO.Model = (MISS01P002Model)model;
                da.UpdateNoEF(da.DTO);
            }

            return(da.DTO.Result);
        }
        public ActionResult ReDo(MISS01P002Model model)
        {
            var da = new MISS01P002DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = MISS01P002ExecuteType.ReDo;

            da.DTO.Model         = model;
            da.DTO.Model.CRET_BY = SessionHelper.SYS_USER_ID;
            da.UpdateNoEF(da.DTO);


            return(JsonAllowGet(da.DTO.Model));
        }
        public ActionResult Close(MISS01P002Model model)
        {
            var da = new MISS01P002DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = MISS01P002ExecuteType.MoveToClose;

            da.DTO.Model           = model;
            da.DTO.Model.FLAG      = "S";
            da.DTO.Model.CRET_BY   = SessionHelper.SYS_USER_ID;
            da.DTO.Model.CRET_DATE = DateTime.Now;
            da.UpdateNoEF(da.DTO);


            return(JsonAllowGet(da.DTO.Model));
        }
        public ActionResult StempTimePD(List <MISS01P002Model> data)
        {
            var da = new MISS01P002DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = MISS01P002ExecuteType.TimeStemp;

            //da.DTO.Model = model;
            da.DTO.Models        = (List <MISS01P002Model>)data;
            da.DTO.Model.FLAG    = "PD";
            da.DTO.Model.CRET_BY = SessionHelper.SYS_USER_ID;
            da.UpdateNoEF(da.DTO);


            return(JsonAllowGet(da.DTO.Model));
        }