コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RequirePermission(Affinity.RolePermission.AdminSystem);
        this.RequirePermission(Affinity.RolePermission.AffinityManager);
        this.Master.SetLayout("Manage Companies", MasterPage.LayoutStyle.ContentOnly);

        Affinity.Companys        cps  = new Affinity.Companys(this.phreezer);
        Affinity.CompanyCriteria crit = new Affinity.CompanyCriteria();
        crit.AppendToOrderBy("Name");

        cps.Query(crit);

        cGrid.DataSource = cps;
        cGrid.DataBind();
    }
コード例 #2
0
    public string[] GetCompanies(string prefixText, int count)
    {
        Phreezer phreezer = new Phreezer(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);

        Affinity.Companys        cs = new Affinity.Companys(phreezer);
        Affinity.CompanyCriteria cc = new Affinity.CompanyCriteria();
        cc.NameBeginsWith = prefixText;
        cc.AppendToOrderBy("Name");
        cc.MaxResults = count;

        cs.Query(cc);
        string[] returnval = new string[cs.Count];

        int i = 0;

        foreach (Affinity.Company c in cs)
        {
            returnval[i++] = c.Name;
        }

        phreezer.Close();

        return(returnval);
    }
コード例 #3
0
    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();
        }
    }