예제 #1
0
        public ActionResult Index()
        {
            SetDefaulButton(StandardButtonMode.Index);

            //AddButton(StandButtonType.ButtonAjax, "report", "Report", cssClass: "std-btn-print", iconCssClass: FaIcons.FaPrint, url: Url.Action("ViewReport"));

            if (TempSearch.IsDefaultSearch && !Request.GetRequest("page").IsNullOrEmpty())
            {
                localModel = TempSearch.CloneObject();
            }
            SetDefaultData(StandardActionName.Index);

            return(View(StandardActionName.Index, localModel));
        }
예제 #2
0
        public ActionResult Info(string USER_ID)
        {
            SetDefaulButton(StandardButtonMode.View);
            var da = new SEC006P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = DTOExecuteType.GetByID;
            TempModel.USER_ID          = da.DTO.Model.USER_ID = USER_ID;
            da.Select(da.DTO);
            if (da.DTO.Model != null)
            {
                localModel = da.DTO.Model;
            }
            return(View(StandardActionName.Info, localModel));
        }
예제 #3
0
        public ActionResult CustomsExport(SEC006P001Model model)
        {
            var da = new SEC006P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC006P001ExecuteType.GetQuerySearchAll;

            da.Select(da.DTO);

            if (da.DTO.Models != null)
            {
                ExportHelper.ExportExcel(Response, da.DTO.Models);
            }

            return(Content("ExportExcel clicked"));
        }
예제 #4
0
        public ActionResult SaveModify(SEC006P001Model model)
        {
            var jsonResult = new JsonResult();

            if (ModelState.IsValid)
            {
                model.DEPT_ID = TempModel.DEPT_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);
        }
예제 #5
0
        public ActionResult SaveCreate(SEC006P001Model model)
        {
            var jsonResult = new JsonResult();

            if (ModelState.IsValid)
            {
                model.COM_CODE = SessionHelper.SYS_COM_CODE;

                var result = SaveData(StandardActionName.SaveCreate, model);
                jsonResult = Success(result, StandardActionName.SaveCreate, Url.Action(StandardActionName.Index, new { page = 1 }));
            }
            else
            {
                jsonResult = ValidateError(ModelState, StandardActionName.SaveCreate);
            }
            return(jsonResult);
        }
예제 #6
0
        public ActionResult Search(SEC006P001Model model)
        {
            var da = new SEC006P001DA();

            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC006P001ExecuteType.GetQuerySearchAll;
            if (Request.GetRequest("page").IsNullOrEmpty())
            {
                model.IsDefaultSearch = true;
                TempSearch            = model;
            }
            da.DTO.Model = TempSearch;

            da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE;

            da.Select(da.DTO);
            return(JsonAllowGet(da.DTO.Models, da.DTO.Result));
        }
예제 #7
0
        public ActionResult Edit(string USER_ID)
        {
            SetDefaulButton(StandardButtonMode.Modify);

            var da = new SEC006P001DA();

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

            SetDefaultData(StandardActionName.Edit);

            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"));
        }
예제 #9
0
        public ActionResult ViewReport(SEC006P001Model model)
        {
            string ReportName = "J03FWL007R01";

            return(Content("http://" + AppConfigHelper.ReportServerName + "/ReportServer?/" + AppConfigHelper.ReportFolderName + "/" + ReportName + "&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false" + "&company_name=AutoAlliance%20(Thailand)%20Co.,Ltd.&user_id=vsmadmin&DateFromHead=21+%e0%b8%98%e0%b8%b1%e0%b8%99%e0%b8%a7%e0%b8%b2%e0%b8%84%e0%b8%a1+2558&DateToHead=25+%e0%b8%98%e0%b8%b1%e0%b8%99%e0%b8%a7%e0%b8%b2%e0%b8%84%e0%b8%a1+2558&error_code=0&WARE_HOUSE_FT=AAT&PE_HID=25&PE_NAME=2015-DEC%20PERIOD%204%20TO%20AAT&PE_START_DATE=2015-12-21&PE_END_DATE=2015-12-25"));
        }