public static void SetUserLogIn(UserData data) { System.Web.HttpCookie cookie = new System.Web.HttpCookie("DivisionID"); cookie.Value = data.DivisionID.ToString(); System.Web.HttpContext.Current.Response.Cookies.Add(cookie); cookie = new System.Web.HttpCookie("Name"); cookie.Value = data.Name; System.Web.HttpContext.Current.Response.Cookies.Add(cookie); cookie = new System.Web.HttpCookie("OfficerID"); cookie.Value = data.OfficerID.ToString(); System.Web.HttpContext.Current.Response.Cookies.Add(cookie); cookie = new System.Web.HttpCookie("Warehouse"); cookie.Value = data.Warehouse.ToString(); System.Web.HttpContext.Current.Response.Cookies.Add(cookie); cookie = new System.Web.HttpCookie("UserID"); cookie.Value = data.UserID; System.Web.HttpContext.Current.Response.Cookies.Add(cookie); }
public bool IsPOSAuthenticated(string userID, string password, double warehouse) { bool ret = true; _data = new UserData(); if (!DALObj.GetDataByPOSUserID(userID)) { ret = false; _error = UserNotFound; } else { if (Decrypt(DALObj.PASSWORD) == password) { if (DALObj.POS == "Y") { if (DALObj.EFDATE <= DateTime.Today && (DateTime.Today <= DALObj.EPDATE || DALObj.EPDATE.Year == 1)) { _data.DivisionID = DALObj.DIVISION; _data.Name = DALObj.TNAME + " " + DALObj.LASTNAME; _data.OfficerID = DALObj.LOID; _data.UserID = DALObj.USERID; _data.Warehouse = warehouse; } else { ret = false; _error = NotActivateUser; } } else { ret = false; _error = NotSuthorizedForSystem; } } else { ret = false; _error = InvalidPassword; } } return ret; }
public bool IsValidPassword(string userID, string password) { bool ret = true; _data = new UserData(); if (!DALObj.GetDataByUserID(userID, null)) { ret = false; _error = UserNotFound; } else { if (Decrypt(DALObj.PASSWORD) != password) { ret = false; _error = InvalidCurrentPassword; } } return ret; }