protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { User users = new User(); var user = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IUserDb>().RetrieveAll(); DropDownUser.DataSource = user; DropDownUser.DataValueField = "Id"; DropDownUser.DataTextField = "FullName"; DropDownUser.DataBind(); var glAccount = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlAccountDb>().RetrieveCashAssettypes(); DropDownTillAccount.DataSource = glAccount; DropDownTillAccount.DataValueField = "Id"; DropDownTillAccount.DataTextField = "GlAccountName"; DropDownTillAccount.DataBind(); if (!string.IsNullOrWhiteSpace(Request.QueryString["id"])) { int id = Convert.ToInt32(Request.QueryString["id"]); Teller teller = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ITellerDb>() .RetrieveById(id); DropDownTillAccount.SelectedValue = teller.GlAccount.Id.ToString(); DropDownUser.SelectedValue = teller.User.Id.ToString(); TextBoxId.Value = teller.Id.ToString(); } } }
/// <summary> /// Gets the users. /// </summary> /// <remarks> /// Sequence Diagram:<br/> /// <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.JobList.GetUsers.jpg"/> /// </remarks> private void GetUsers() { string selectedvalue = DropDownUser.SelectedValue; DropDownUser.Items.Clear(); if (userRole.Equals("user")) { ListItem liuser = new ListItem(Session["UserID"].ToString(), Session["UserID"].ToString()); DropDownUser.Items.Insert(0, liuser); DropDownUser.DataBind(); } else if (userRole.Equals("admin")) { try { string selectedSource = DropDownListUserSource.SelectedValue; if (selectedSource == Constants.USER_SOURCE_DM) { selectedSource = Constants.USER_SOURCE_AD; } if (DropDownListUserSource.SelectedValue != "DB") { domainName = DropDownListDomainName.SelectedValue; } DataTable dataTablePrintUsers = FileServerPrintJobProvider.ProvidePrintedUsers(selectedSource, domainName); if (dataTablePrintUsers != null && dataTablePrintUsers.Rows.Count > 0) { DropDownUser.DataSource = dataTablePrintUsers; DropDownUser.DataTextField = "USR_ID"; DropDownUser.DataValueField = "USR_ID"; DropDownUser.DataBind(); ListItem liall = new ListItem("All", "-1"); DropDownUser.Items.Insert(0, liall); } else { DropDownUser.Items.Clear(); ListItem liall = new ListItem("Select", "-1"); DropDownUser.Items.Insert(0, liall); } if (!string.IsNullOrEmpty(selectedvalue)) { if (DropDownUser.Items.FindByValue(selectedvalue) != null) { DropDownUser.SelectedValue = selectedvalue; } } } catch (Exception ex) { } } }