/// <summary> /// used for IXmlFormCallback /// </summary> /// <param name="field"></param> /// <param name="param"></param> /// <returns></returns> public Hashtable GetFormOptions(XmlNode field, string param) { Hashtable ht = new Hashtable(); switch (param) { case "UNDERWRITER": Underwriters uw; // if ID = 0 this is a new account, so show all underwriters if (this.Id == 0) { uw = new Underwriters(this.phreezer); uw.Query(new UnderwriterCriteria()); } else { uw = this.GetUnderwriters(); } foreach (Underwriter u in uw) { ht.Add(u.Code, u.Description); } break; default: ht.Add("UNKNOWN", "UNKNOWN PARAM: " + param); break; } return(ht); }
/// <summary> /// Return the underwriters that this account has access to use /// TODO: implmenet assignment of accounts to underwriters. currently /// this returns all underwriters for everyone /// </summary> /// <param name="criteria"></param> /// <returns></returns> public Underwriters GetUnderwriters() { Underwriters uw = new Underwriters(this.phreezer); UnderwriterCriteria uwc = new UnderwriterCriteria(); uwc.Codes = this.UnderwriterCodes.Replace(",NLTIC", "").Replace(",DIR-NLTIC", "").Replace(",TICOR", "").Replace(",Dir-TICOR", ""); uwc.AppendToOrderBy("Description", true); uw.Query(uwc); return(uw); }
protected void Page_Load(object sender, EventArgs e) { this.Master.SetLayout("Edit Account", MasterPage.LayoutStyle.ContentOnly); this.RequirePermission(Affinity.RolePermission.AdminSystem); if (!Page.IsPostBack) { // populate the form Affinity.Roles roles = new Affinity.Roles(this.phreezer); Affinity.RoleCriteria rc = new Affinity.RoleCriteria(); rc.AppendToOrderBy("Description"); roles.Query(rc); ddRole.DataSource = roles; ddRole.DataTextField = "Description"; ddRole.DataValueField = "Code"; ddRole.SelectedValue = this.account.RoleCode; ddRole.DataBind(); Affinity.Underwriters uws = new Affinity.Underwriters(this.phreezer); Affinity.UnderwriterCriteria uwc = new Affinity.UnderwriterCriteria(); uwc.AppendToOrderBy("Description"); uws.Query(uwc); cblUnderwriterCodes.DataSource = uws; cblUnderwriterCodes.DataTextField = "Description"; cblUnderwriterCodes.DataValueField = "Code"; cblUnderwriterCodes.DataBind(); // pre-select the checkboxes from the comma-separated user setting string[] codes = this.account.UnderwriterCodes.Split(",".ToCharArray()); foreach (string c in codes) { ListItem cb = cblUnderwriterCodes.Items.FindByValue(c.Trim()); if (cb != null) { cb.Selected = true; } } foreach (ListItem cb in cblUnderwriterCodes.Items) { ListItem i = new ListItem("100%", cb.Value + "100%"); Endorse100.Items.Add(i); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "100%") > -1) { i.Selected = true; } i = new ListItem("70%", cb.Value + "70%"); Endorse70.Items.Add(i); i.Attributes.Add("onclick", "verifyCheckboxes(this);"); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "70%") > -1) { i.Selected = true; } i = new ListItem("75%", cb.Value + "75%"); Endorse75.Items.Add(i); i.Attributes.Add("onclick", "verifyCheckboxes(this);"); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "75%") > -1) { i.Selected = true; } i = new ListItem("80%", cb.Value + "80%"); Endorse80.Items.Add(i); i.Attributes.Add("onclick", "verifyCheckboxes(this);"); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "80%") > -1) { i.Selected = true; } i = new ListItem("85%", cb.Value + "85%"); Endorse85.Items.Add(i); i.Attributes.Add("onclick", "verifyCheckboxes(this);"); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "85%") > -1) { i.Selected = true; } i = new ListItem("88%", cb.Value + "88%"); Endorse88.Items.Add(i); i.Attributes.Add("onclick", "verifyCheckboxes(this);"); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "88%") > -1) { i.Selected = true; } i = new ListItem("90%", cb.Value + "90%"); Endorse90.Items.Add(i); i.Attributes.Add("onclick", "verifyCheckboxes(this);"); if (this.account.UnderwriterEndorsements.IndexOf(cb.Value + "90%") > -1) { i.Selected = true; } if (cb.Text.IndexOf("Direct") > -1) { Endorse100.Items[(Endorse100.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); Endorse70.Items[(Endorse70.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); Endorse75.Items[(Endorse75.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); Endorse80.Items[(Endorse80.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); Endorse85.Items[(Endorse85.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); Endorse88.Items[(Endorse88.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); Endorse90.Items[(Endorse90.Items.Count - 1)].Attributes.Add("style", "visibility:hidden"); } else if (!cb.Selected) { cb.Attributes.Add("onclick", "enableDisableCheckboxes(this);"); Endorse100.Items[(Endorse100.Items.Count - 1)].Enabled = false; Endorse70.Items[(Endorse70.Items.Count - 1)].Enabled = false; Endorse75.Items[(Endorse75.Items.Count - 1)].Enabled = false; Endorse80.Items[(Endorse80.Items.Count - 1)].Enabled = false; Endorse85.Items[(Endorse85.Items.Count - 1)].Enabled = false; Endorse88.Items[(Endorse88.Items.Count - 1)].Enabled = false; Endorse90.Items[(Endorse90.Items.Count - 1)].Enabled = false; } else { cb.Attributes.Add("onclick", "enableDisableCheckboxes(this);"); } } Affinity.Companys companies = new Affinity.Companys(this.phreezer); Affinity.CompanyCriteria cc = new Affinity.CompanyCriteria(); companies.Query(cc); ddCompany.DataSource = companies; ddCompany.DataTextField = "Name"; ddCompany.DataValueField = "Id"; ddCompany.SelectedValue = this.account.CompanyId.ToString(); ddCompany.DataBind(); txtId.Text = this.account.Id.ToString(); txtUsername.Text = this.account.Username.ToString(); txtFirstName.Text = this.account.FirstName.ToString(); txtLastName.Text = this.account.LastName.ToString(); txtCreated.Text = this.account.Created.ToShortDateString(); txtModified.Text = this.account.Modified.ToShortDateString(); txtPasswordHint.Text = this.account.PasswordHint.ToString(); txtInternalId.Text = this.account.InternalId.ToString(); txtEmail.Text = this.account.Email.ToString(); txtBusinessLicenseId.Text = this.account.BusinessLicenseID.ToString(); txtIndividualLicenseId.Text = this.account.IndividualLicenseID.ToString(); } }