Exemple #1
0
        public ActionResult Search(MSTS02P001Model model)
        {
            var da = new MSTS02P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = MSTS02P001ExecuteType.GetAll;
            if (Request.GetRequest("page").IsNullOrEmpty())
            {
                model.IsDefaultSearch = true;
                TempSearch            = model;
            }
            da.DTO.Model = TempSearch;
            SetStandardField(da.DTO.Model);
            da.SelectNoEF(da.DTO);
            return(JsonAllowGet(da.DTO.Models, da.DTO.Result));
        }
Exemple #2
0
        public ActionResult Edit(MSTS02P001Model model)
        {
            var da = new MSTS02P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = MSTS01P001ExecuteType.GetByID;
            da.DTO.Model.YEAR          = model.YEAR;
            da.DTO.Model.COM_CODE      = model.COM_CODE;

            da.SelectNoEF(da.DTO);
            localModel = da.DTO.Model;

            SetDefaulButton(StandardButtonMode.Modify);
            SetDefaultData();   //set ค่า DDL


            return(View(StandardActionName.Edit, localModel));
        }
Exemple #3
0
        //----------------------------------------------//
        private DTOResult SaveData(string mode, object model)
        {
            var da = new MSTS02P001DA();

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


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

                da.InsertNoEF(da.DTO);
            }
            else if (mode == StandardActionName.SaveModify)
            {
                SetStandardField(model);
                da.DTO.Execute.ExecuteType = MSTS02P001ExecuteType.Update;
                da.DTO.Model = (MSTS02P001Model)model;

                da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE;
                //da.DTO.Model.COM_BRANCH = TempModel.COM_BRANCH.TrimEnd();
                da.UpdateNoEF(da.DTO);
            }
            else if (mode == StandardActionName.Delete)
            {
                da.DTO.Models         = (List <MSTS02P001Model>)model;
                da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE;
                da.DeleteNoEF(da.DTO);
            }

            return(da.DTO.Result);
        }