예제 #1
0
    protected void refreshInsuranceRates(string selectedValue)
    {
        Affinity.TitleFees tf = new Affinity.TitleFees(this.phreezer);

        Affinity.TitleFeesCriteria tfc = new Affinity.TitleFeesCriteria();
        tfc.AppendToOrderBy("Id");
        tfc.FeeType = "Insurance Rate";
        tf.Query(tfc);

        IEnumerator i = tf.GetEnumerator();

        InsuranceRate.Items.Clear();
        ListItem l = new ListItem();

        l.Value = "";
        l.Attributes.Add("rate", "");
        l.Text = "Select a rate level";
        InsuranceRate.Items.Add(l);

        // loop through the checkboxes and insert or delete as needed
        while (i.MoveNext())
        {
            Affinity.TitleFee tfitem = (Affinity.TitleFee)i.Current;

            l       = new ListItem();
            l.Value = tfitem.Id;
            l.Attributes.Add("rate", tfitem.Fee.ToString());
            l.Text = tfitem.Name;
            if (tfitem.Id.Equals(selectedValue))
            {
                l.Selected = true;
            }
            InsuranceRate.Items.Add(l);
        }
    }
예제 #2
0
    protected void btnChangeInsuranceRates_Click(object sender, EventArgs e)
    {
        string startingRate  = StartingRate.Text;
        string rateIncrement = RateIncrement.Text;

        Affinity.TitleFees tf = new Affinity.TitleFees(this.phreezer);

        Affinity.TitleFeesCriteria tfc = new Affinity.TitleFeesCriteria();
        tfc.FeeType = "Insurance Rate";
        tfc.AppendToOrderBy("Id");
        tf.Query(tfc);

        decimal startingRateDecimal = 0;

        decimal.TryParse(startingRate, out startingRateDecimal);

        decimal rateIncrementDecimal = 0;

        decimal.TryParse(rateIncrement, out rateIncrementDecimal);

        IEnumerator i = tf.GetEnumerator();

        // loop through the checkboxes and insert or delete as needed
        while (i.MoveNext())
        {
            Affinity.TitleFee tfitem = (Affinity.TitleFee)i.Current;

            tfitem.Fee      = startingRateDecimal;
            tfitem.Modified = DateTime.Now;
            tfitem.Update();
            startingRateDecimal += rateIncrementDecimal;
        }
        refreshInsuranceRates("");

        Message.InnerText = "All Insurance Rates Have Updated Successfully.";
        Message.Visible   = true;

        // we have to re-load the form because the settings have changed and
        // we need to show the new ones
    }