public ActionResult Index()
        {
            SetDefaulButton(StandardButtonMode.Index);

            if (TempSearch.IsDefaultSearch && !Request.GetRequest("page").IsNullOrEmpty())
            {
                localModel = TempSearch;
            }
            localModel.USG_STATUS_MODEL = GetUsgStatus();
            return View(StandardActionName.Index, localModel);
        }
 public ActionResult SaveCreate(SEC007P001Model model, string button = "")
 {
     var jsonResult = new JsonResult();
     if (ModelState.IsValid)
     {
         model.COM_CODE = SessionHelper.SYS_COM_CODE;
         var result = SaveData(StandardActionName.SaveCreate, model);
         jsonResult = Success(result, StandardActionName.SaveModify, Url.Action(StandardActionName.Index, new { page = 1 }));
     }
     else
     {
         jsonResult = ValidateError(ModelState, StandardActionName.SaveModify);
     }
     return jsonResult;
 }
 public ActionResult SaveModify(SEC007P001Model model)
 {
     var jsonResult = new JsonResult();
     if (ModelState.IsValid)
     {
         model.COM_CODE = TempModel.COM_CODE;
         model.USG_ID = TempModel.USG_ID;
         var result = SaveData(StandardActionName.SaveModify, model);
         jsonResult = Success(result, StandardActionName.SaveModify, Url.Action(StandardActionName.Index, new { page = 1 }));
     }
     else
     {
         jsonResult = ValidateError(ModelState, StandardActionName.SaveModify);
     }
     return jsonResult;
 }
        public ActionResult Search(SEC007P001Model model)
        {
            var da = new SEC007P001DA();
            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC007P001ExecuteType.GetAll;

            if (Request.GetRequest("page").IsNullOrEmpty())
            {
                model.IsDefaultSearch = true;
                TempSearch = model;
            }

            da.DTO.Model = TempSearch;

            da.Select(da.DTO);
            return JsonAllowGet(da.DTO.Models);
        }
 public ActionResult SaveConfPrgSeq(SEC007P001Model model)
 {
     var jsonResult = new JsonResult();
     if (ModelState.IsValid)
     {
         model.COM_CODE = TempModel.COM_CODE;
         model.USG_ID = TempModel.USG_ID;
         var result = SaveData("SaveConfPrgSeq", model);
         if (result.IsResult && SessionHelper.SYS_USG_ID == TempModel.USG_ID)
         {
             Session[SessionSystemName.SYS_MENU] = null;
             var Menu = SessionHelper.SYS_MenuModel;
         }
         jsonResult = Success(result, StandardActionName.SaveModify, Url.Action("ConfPrgSeq", new { page = 1, TempModel.COM_CODE, TempModel.USG_ID }));
     }
     else
     {
         jsonResult = ValidateError(ModelState, StandardActionName.SaveModify);
     }
     return jsonResult;
 }
        public ActionResult ConfPrg(string COM_CODE, decimal? USG_ID)
        {
            SetDefaulButton(StandardButtonMode.Other);
            AddStandardButton(StandardButtonName.SaveModify, url: Url.Action("SaveConfPrg"));
            var da = new SEC007P001DA();
            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC007P001ExecuteType.GetByID;

            TempModel = null;
            TempModel.COM_CODE = da.DTO.Model.COM_CODE = COM_CODE;
            TempModel.USG_ID = da.DTO.Model.USG_ID = USG_ID;

            da.Select(da.DTO);

            if (da.DTO.Model != null)
            {
                localModel = da.DTO.Model;
            }
            COM_CODE = COM_CODE.Trim();
            localModel.SYS_CODE_MODEL = GetDDLCenter(DDLCenterKey.DD_VSMS_SYSTEM_001, new VSMParameter(COM_CODE));
            return View("ConfPrg", localModel);
        }
        public ActionResult Edit(string COM_CODE, decimal? USG_ID)
        {
            SetDefaulButton(StandardButtonMode.Modify);
            var da = new SEC007P001DA();
            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC007P001ExecuteType.GetByID;

            TempModel = null;
            TempModel.COM_CODE = da.DTO.Model.COM_CODE = COM_CODE;
            TempModel.USG_ID = da.DTO.Model.USG_ID = USG_ID;

            da.Select(da.DTO);

            if (da.DTO.Model != null)
            {
                localModel = da.DTO.Model;
            }

            localModel.USG_STATUS_MODEL = GetUsgStatus();
            localModel.USG_LEVEL_MODEL = GetUsgLevel();
            return View(StandardActionName.Edit, localModel);
        }
示例#8
0
        public ActionResult SignIn(string returnUrl, string Username, string Password)
        {
            ViewBag.message       = string.Empty;
            ViewBag.messageHeader = string.Empty;
            //string cdsid = string.Empty;
            string cdsid = Username;

            //ตรวจสอบการ auth user
            if (!string.IsNullOrEmpty(Request.ServerVariables["AUTH_USER"].ToString().Trim()))
            {
                // cdsid = Request.ServerVariables["AUTH_USER"].ToString().Split('\\')[1];
                cdsid = Request.ServerVariables["AUTH_USER"].ToString().Split('\\')[0];
            }

            //เก็บค่าที่ auth user ไว้ที่ cdsid เพื่อเช็๕ใน VSMS_USER
            SEC006P001Model dsSys = GET_VSMS_USER(cdsid);

            //ถ้าหาเจอ
            if (!dsSys.USER_ID.IsNullOrEmpty())
            {
                //ตรวจสอบค่าจาก dsSys ว่าสถานะเป็น DISABLED หรือไม่
                if (dsSys.IS_DISABLED == "Y")
                {
                    ViewBag.message = string.Concat("-", "Your account is disabled,please contact your system administrator", "<br/>");
                }
                else
                {
                    //ถ้าค่า COM_CODE และ USG_ID ใน dsSys ไม่เท่ากับ Null หรือ Empty
                    if (!dsSys.COM_CODE.IsNullOrEmpty() && !dsSys.USG_ID.IsNullOrEmpty())
                    {
                        //เอาค่า COM_CODE และ USG_ID ไป query ใน vsms_usgroup
                        SEC007P001Model dsUSerGroup = GET_VSMS_USRGROUP(dsSys.COM_CODE, dsSys.USG_ID);
                        if (!dsUSerGroup.COM_CODE.IsNullOrEmpty() &&
                            dsUSerGroup.USG_ID != null &&
                            !dsUSerGroup.USG_CODE.IsNullOrEmpty())
                        {
                            //ถ้า USG_STATUS = D
                            if (!dsUSerGroup.USG_STATUS.IsNullOrEmpty() &&
                                dsUSerGroup.USG_STATUS == "D")
                            {
                                ViewBag.message = string.Concat("-", "Your user group is disable,plase contarct your system administrator", "<br/>");
                            }
                            else
                            {
                                //ไม่รู้
                                FormsAuthentication.SetAuthCookie(cdsid.Trim(), false);

                                //เก็บ secssion
                                LogInResult enmLogInResult = CheckUserLogInForWindowAuthen(cdsid.Trim());
                                if (enmLogInResult == LogInResult.WrongUserNameOrPassword)
                                {
                                    ViewBag.message = string.Concat("-", "Wrong username or password", "<br/>");
                                }
                                else if (enmLogInResult == LogInResult.Success)
                                {
                                    //return RedirectToAction("SelectModule");
                                    return(RedirectToAction("SelectSystem"));
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                //หา user_id ไม่เจอ
                ViewBag.message = string.Concat("User ", cdsid, ": Wrong user name or password");
            }

            return(View("SignIn"));
        }