예제 #1
0
        public ActionResult HomePageSelection()
        {
            LoginHelper objLoginHelper = new LoginHelper();

            string homeURL = string.Empty;

            try
            {
                objLoginHelper = (LoginHelper)Session["LogInInformation"];

                if (objLoginHelper.UerRoleOrGroupID == UserGroup.RegionManager)
                {
                    Common_RegionInfo objRegion = new Common_RegionInfo();
                    objRegion = erpDal.Region(objLoginHelper.HomeLocation);

                    Common_ZoneInfo objZone = erpDal.Zone(objRegion.Zone_Code);

                    objLoginHelper.LogInForRegionCode = objRegion.Reg_Code;
                    objLoginHelper.LogInForRegionName = objRegion.Reg_Name + " [" + objLoginHelper.HomeLocation + "]";

                    objLoginHelper.LogInForZoneCode = objRegion.Zone_Code;
                    objLoginHelper.LogInForZoneName = objZone.Zone_Name;

                    objLoginHelper.LogInForUnitCode = "";
                    objLoginHelper.LogInForUnitName = "";

                    objLoginHelper.Location = Helper.Region;
                    objLoginHelper.TopMenu  = "SiteMenu/RegionManagerMenu";

                    objLoginHelper.URL = "RegionalOffice/RegionManager";
                    objLoginHelper.URLSelectionLocation = "RSFSecurity/LocationSelection";
                }

                Session.Remove("LogInInformation");
                Session["LogInInformation"] = objLoginHelper;

                homeURL = objLoginHelper.HomeURL;
            }
            catch (Exception ex)
            {
                homeURL = "notSucceed";
            }

            string[] controllerAction = homeURL.Split('/');

            return(RedirectToAction(controllerAction[1], controllerAction[0]));
        }
예제 #2
0
        public JsonResult LocationSet(string hoCode, string zoneCode, string regionCode, string unitCode)
        {
            LoginHelper objLoginHelper = new LoginHelper();

            Common_ZoneInfo   objZone   = new Common_ZoneInfo();
            Common_RegionInfo objRegion = new Common_RegionInfo();
            Common_UnitInfo   objUnit   = new Common_UnitInfo();

            string message = string.Empty, auditPrefix = "Audit- ";

            try
            {
                objLoginHelper = (LoginHelper)Session["LogInInformation"];


                if (!string.IsNullOrEmpty(zoneCode))
                {
                    objZone   = erpDal.Zone(zoneCode);
                    objRegion = null;
                    objUnit   = null;
                }

                if (!string.IsNullOrEmpty(regionCode))
                {
                    objRegion = erpDal.Region(regionCode);
                }

                if (!string.IsNullOrEmpty(unitCode))
                {
                    objUnit = erpDal.Unit(unitCode);
                }

                objLoginHelper.LogInForZoneCode   = string.Empty;
                objLoginHelper.LogInForZoneName   = string.Empty;
                objLoginHelper.LogInForRegionCode = string.Empty;
                objLoginHelper.LogInForRegionName = string.Empty;
                objLoginHelper.LogInForUnitCode   = string.Empty;
                objLoginHelper.LogInForUnitName   = string.Empty;

                objLoginHelper.ZoneTitle   = string.Empty;
                objLoginHelper.RegionTitle = string.Empty;
                objLoginHelper.UnitTitle   = string.Empty;


                if (!string.IsNullOrEmpty(hoCode))
                {
                    objLoginHelper.Location     = "HO";
                    objLoginHelper.LocationCode = "9000";

                    objZone   = null;
                    objRegion = null;
                    objUnit   = null;

                    objLoginHelper.ModluleTitle = auditPrefix + "Head Office";
                    objLoginHelper.OfficeModule = Helper.HeadOfficeModule;

                    objLoginHelper.UserOperationalRoleOrGroupID = UserGroup.HeadOfficeAudit;
                }

                if (objZone != null)
                {
                    objLoginHelper.LogInForZoneCode = zoneCode;
                    objLoginHelper.LogInForZoneName = objZone.Zone_Name;
                    objLoginHelper.LocationCode     = zoneCode;
                    objLoginHelper.Location         = "Zone";

                    objLoginHelper.ZoneTitle   = "Zone: ";
                    objLoginHelper.RegionTitle = string.Empty;
                    objLoginHelper.UnitTitle   = string.Empty;

                    objLoginHelper.ModluleTitle = auditPrefix + "Zonal Module";
                    objLoginHelper.OfficeModule = Helper.ZonalOfficeModule;

                    objLoginHelper.UserOperationalRoleOrGroupID = UserGroup.ZonalManager;
                }

                if (objRegion != null)
                {
                    objLoginHelper.LogInForRegionCode = regionCode;
                    objLoginHelper.LogInForRegionName = objRegion.Reg_Name;
                    objLoginHelper.LocationCode       = regionCode;
                    objLoginHelper.Location           = "Region";

                    objLoginHelper.RegionTitle = "Region: ";
                }

                if (objUnit != null)
                {
                    objLoginHelper.LogInForUnitCode = unitCode;
                    objLoginHelper.LogInForUnitName = objUnit.Unit_Name + " [" + unitCode + "]";
                    objLoginHelper.LocationCode     = unitCode;
                    objLoginHelper.Location         = "Unit";

                    objLoginHelper.UnitTitle = "Unit: ";

                    objLoginHelper.CustomerPrefix = objUnit.CUSTCODE_PREFIX + "-";

                    objLoginHelper.ModluleTitle = auditPrefix + "Unit Module";
                    objLoginHelper.OfficeModule = Helper.UnitOfficeModule;

                    objLoginHelper.UserOperationalRoleOrGroupID = UserGroup.UnitOfficeUser;
                }

                objLoginHelper = securityDal.LoginInformation(objLoginHelper);

                String ipAddress = string.Empty, sMacAddress = string.Empty;

                ipAddress = IPNetworking.GetIP4Address();

                if (String.IsNullOrEmpty(ipAddress))
                {
                    ipAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
                }

                erpDal.CreateUserLog(ipAddress, sMacAddress, objLoginHelper.LocationCode, objLoginHelper.LogInID, "Auditor- Visit Location After Login");

                //string auditOpenMonth = objLoginHelper.AuditorYearMonth;
                //objLoginHelper.YearMonthCurrent = auditOpenMonth;
                //objLoginHelper.AuditorYearMonth = Helper.YearMonthPrevious(auditOpenMonth, Helper.OneMonthPrevious);

                if (objLoginHelper.UerRoleOrGroupID == UserGroup.RegionManager)
                {
                    objLoginHelper.URL     = "HeadOffice/Auditor";
                    objLoginHelper.TopMenu = "SiteMenu/UnitAuditorMenu";
                    objLoginHelper.URLSelectionLocation = "RSFSecurity/LocationSelection";
                }

                Session.Remove("LogInInformation");
                Session["LogInInformation"] = objLoginHelper;

                message = "succeed";
            }
            catch (Exception ex)
            {
                message = "notSucceed";
            }

            return(new JsonResult {
                Data = message
            });
        }