public string MasterPacker(string userBarcode) { string isMasterPacker = "F"; string userLogin = ""; // try to find the userlogin for the user barcode DataSet userDetailsDs = _userDAO.GeUserByBarcode(userBarcode); DataTable userDetailsDt = userDetailsDs.Tables[0]; foreach (DataRow row in userDetailsDt.Rows) { userLogin = row["userlogin"].ToString(); } // if the user name is empty do not do any further validation - not a master packer if (userLogin != string.Empty) { // Get the list of user groups which have access to the advanced packing funcionality string[] advancedPackingGroups = ConfigurationManager.AppSettings["AdvancedPackingGroups"].Split(','); IHFRoleProvider roleprovider = new IHFRoleProvider(); // Now determine if one of these groups is foreach (string grp in advancedPackingGroups) { if (roleprovider.IsUserInRole(userLogin, grp)) { isMasterPacker = "T"; } } } return(isMasterPacker); }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Session["OpenOrderVal"] != null) { string val = HttpContext.Current.Session["OpenOrderVal"].ToString(); if (!string.IsNullOrEmpty(val)) { this.hdnOpenOrderValues.Value = val; } HttpContext.Current.Session["OpenOrderVal"] = string.Empty; } if (HttpContext.Current.Session["UserOption"] != null) { string val = HttpContext.Current.Session["UserOption"].ToString(); if (!string.IsNullOrEmpty(val)) { this.hdnUserOption.Value = val; } HttpContext.Current.Session["UserOption"] = string.Empty; } // Assume not master packer this.hdnMasterPacker.Value = "N"; // Get the list of user groups which have access to the advanced packing funcionality string [] advancedPackingGroups = ConfigurationManager.AppSettings["AdvancedPackingGroups"].Split(','); IHFRoleProvider roleprovider = new IHFRoleProvider(); // Now determine if one of these groups is foreach (string grp in advancedPackingGroups) { if (roleprovider.IsUserInRole(User.Identity.Name, grp)) { hdnMasterPacker.Value = "Y"; } } }