예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EditEnabled = CurrentModule.Permissions.Allowed(OperationType.Edit, CurrentUser);

            if (!IsPostBack)
            {
                pnlEdit.Visible = true;
                string ipAddress = IPNetworking.GetIP4Address(HttpContext.Current.Request);
                kiosk = CheckInController.GetCurrentKiosk(ipAddress);

                if (kiosk != null)
                {
                    litLegend.Text = string.Format("Edit '{0}' Kiosk", kiosk.SystemName);
                    btnSave.Text   = "Save";
                    EditKiosk(kiosk, ipAddress);
                }
                else
                {
                    litLegend.Text = "Register New Kiosk";
                    btnSave.Text   = "Add New";
                    EditKiosk(IPNetworking.GetHostName(ipAddress), ipAddress);
                }
            }
            else
            {
                ViewState["returnURL"] = Request.UrlReferrer.ToString();
            }
        }
예제 #2
0
        public JsonResult Login(FormCollection fCollection)
        {
            try
            {
                ArrayList logInMessage = new ArrayList();

                UserInformation userInfo = new UserInformation();
                userInfo = securityDal.ReadUserInformation(fCollection["txtUserName"], fCollection["txtPassword"], Helper.Active);

                if (userInfo != null)
                {
                    objLoginHelper = securityDal.LoginInformation(fCollection, userInfo);

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

                    ipAddress = IPNetworking.GetIP4Address();
                    // ipAddress = System.Web.HttpContext.Current.Request.UserHostAddress; // Use it Or the below one for get Visitors IP address

                    if (String.IsNullOrEmpty(ipAddress))
                    {
                        ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                        if (ipAddress == null)
                        {
                            ipAddress = Request.ServerVariables["REMOTE_ADDR"];
                        }
                    }


                    //sMacAddress = NetworkUtility.GetMacAddress(NetworkUtility.GetMacAddress(ipAddress));

                    erpDal.CreateUserLog(ipAddress, sMacAddress, objLoginHelper.LocationCode, objLoginHelper.LogInID, "Login");

                    Session["LogInInformation"] = objLoginHelper;

                    return(new JsonResult {
                        Data = ExceptionHelper.ExceptionMessage(string.Empty, "Valid", Helper.URL(objLoginHelper))
                    });
                }
                else
                {
                    return(new JsonResult {
                        Data = ExceptionHelper.ExceptionMessage("Sorry, UserId/Password Is Not Valid.", "error", string.Empty)
                    });
                }

                //RASolarERPDAL objModuleDal = new RASolarERPDAL();

                //ViewBag.RSFModule = objModuleDal.RSFERPModuleDataForCombo();
                //ViewBag.UserValidation = false;

                //return View();

                //aa = fCollection["ddlZone"];
                //aa = fCollection["ddlRegion"];
                //aa = fCollection["ddlUnit"];
                //aa = fCollection["txtUserName"];
                //aa = fCollection["txtPassword"];
            }
            catch (Exception ex)
            {
                return(new JsonResult {
                    Data = ExceptionHelper.ExceptionMessage(ex)
                });
            }
        }
예제 #3
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
            });
        }