Пример #1
0
    protected void btnDelete_Click1(object sender, EventArgs e)
    {
        if (GXGridView1.SelectedIndex != -1)
        {
            int dealID = 0;
            if (GXGridView1.SelectedDataKey != null)
            {
                int GXgvSelectedValue = Convert.ToInt32(GXGridView1.SelectedValue);
                dealID = GXgvSelectedValue;
                dvDataSource.SelectParameters.Clear();
                dvDataSource.SelectParameters.Add("id", GXgvSelectedValue.ToString());
                DetailsView1.DataBind();
            }
            else
            {
                int GXgvSelectedValue = GXGridView1SelectedValue;
                dealID = GXgvSelectedValue;
                dvDataSource.SelectParameters.Clear();
                dvDataSource.SelectParameters.Add("id", GXgvSelectedValue.ToString());
                DetailsView1.DataBind();
            }
            LifeDeal ld = LifeDeal.Get(dealID);
            ld.IsActive = false;
            LifeDeal.Table.Context.SubmitChanges();

            GXGridView1.TotalRecords = ViewLifeDeal.SelectCountCached();
            GXGridView1.DataBind();
            mvMain.SetActiveView(viewGrid);
        }
    }
Пример #2
0
    protected void dvDataSource_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
    {
        LifePolicy p = (LifePolicy)e.ReturnValue;

        if (p != null)
        {
            LifeDeal lifeDeal                       = LifeDeal.Get(DealID);
            decimal  totalBrokerageValue            = (p.InsuranceCoverageOne * (lifeDeal.PercentageFromSumForRestLiving / 100)) + (p.YearlyPremiumValueForAccident * (lifeDeal.PercentageFromPremiumForAccident / 100));
            List <LifeDealBrokerage> lstLPBrokerage = LifeDealBrokerage.GetByLifeDeal(lifeDeal.ID);
            int counter = 1;
            foreach (LifeDealBrokerage ldb in lstLPBrokerage)
            {
                LifePolicyBrokerage lpb = new LifePolicyBrokerage();
                lpb.FromDate      = p.ApplicationDate.AddYears(counter - 1);
                lpb.IsFactured    = false;
                lpb.LifePolicyID  = p.ID;
                lpb.OrdinalNumber = counter;
                lpb.ToDate        = p.ApplicationDate.AddYears(counter);
                lpb.Value         = (ldb.BrokeragePecentForYear / 100) * totalBrokerageValue;
                lpb.Insert();
                counter++;
            }
            for (int i = 1; i <= PolicyDurationYears; i++)
            {
                LifePolicyPremiumValue lppv = new LifePolicyPremiumValue();
                lppv.FromDate                    = p.StartDate.AddYears(i - 1);
                lppv.LifePolicyID                = p.ID;
                lppv.OrdinalNumberYear           = i;
                lppv.PremiumValueForAccident     = p.YearlyPremiumValueForAccident;
                lppv.PremiumValueForAccidentEuro = p.YearlyPremiumValueForAccidentEuro;
                lppv.PremiumValueForLife         = p.YearlyPremiumValueForLife;
                lppv.PremiumValueForLifeEuro     = p.YearlyPremiumValueForLifeEuro;
                lppv.ToDate = p.StartDate.AddYears(i);
                lppv.Insert();
            }
            Distribution d = Distribution.GetByNumberAndSubTypeAndCompany(p.InsuranceSubTypeID, p.PolicyNumber, p.InsuranceCompanyID);
            if (d != null)
            {
                d.IsUsed = true;
            }
            else
            {
                RightRestrictionDistribution rrd = RightRestrictionDistribution.GetForCompanyAndType(p.InsuranceCompanyID, p.PolicyNumber, DistributionDocumentType.GetByCode(DistributionDocumentType.BLANKO).ID);
                rrd.IsUsed = true;
            }
            Policy.Table.Context.SubmitChanges();
        }
    }
Пример #3
0
    protected void ddlInsuranceSubType_selecteIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddlDeals            = PoliciesDetailsView.FindControl("ddlDeals") as DropDownList;
        DropDownList ddlInsuranceSubType = (DropDownList)sender;
        DropDownList ddlInsuranceCompany = PoliciesDetailsView.FindControl("ddlInsuranceCompany") as DropDownList;

        List <LifeDeal> dealList = LifeDeal.GetActiveDealsForCompanyAndInsuranceSubType(int.Parse(ddlInsuranceCompany.SelectedValue), int.Parse(ddlInsuranceSubType.SelectedValue));

        InsuranceSubtypeID = int.Parse(ddlInsuranceSubType.SelectedValue);

        if (dealList.Count != 0)
        {
            DealID = dealList[0].ID;
        }
        //else {
        //dealList = Deal.GetBySubType(int.Parse(ddlInsuranceSubType.SelectedValue));
        //DealID = dealList[0].ID;
        //}
        //FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceCompany);
        //ddlInsuranceCompany.DataBind();
        ddlDeals.DataBind();
    }
Пример #4
0
 protected void dvDataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     LifeDeal ld = e.InputParameters["entityToInsert"] as LifeDeal;
     //DealController.ValidateInsertCode(d.Code);
 }
Пример #5
0
 protected void dvDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     LifeDeal ld = e.InputParameters["newEntity"] as LifeDeal;
     //DealController.ValidateUpdateCode(d.ID, d.Code);
 }