Exemplo n.º 1
0
    protected void btnContinue_Click(object sender, EventArgs e)
    {
        int    quoteID      = Convert.ToInt32(Session["QuoteID"]);
        string strQuoteMode = Convert.ToString(Session["QuoteMode"]);
        string strQuoteNo   = Convert.ToString(Session["QuoteNo"]);

        if (strQuoteMode == "EDIT")
        {
            vwPropertyHandler objPropertyhandler = new vwPropertyHandler();

            vwProperty objvwProperty = objPropertyhandler.GetDetailsByQuoteNo(strQuoteNo);

            //int propertyID = Convert.ToInt32(ViewState["PropertyID"]);
            Property objProperty = new Property();
            objProperty.ID       = objvwProperty.ID;
            objProperty.QuoteID  = Convert.ToInt32(Session["QuoteID"]);
            objProperty.Address1 = Convert.ToString(txtAddress1.Text);
            objProperty.Address2 = Convert.ToString(txtAddress2.Text);
            objProperty.Zip      = Convert.ToInt32(txtZip.Text);
            objProperty.City     = Convert.ToString(txtCity.Text);
            objProperty.StateID  = Convert.ToInt32(ddlState.SelectedValue);

            objProperty.ClassID = Convert.ToInt32(ddlSelectClass.SelectedValue);

            objProperty.StructureDescription = objvwProperty.StructureDescription;
            objProperty.ConstructionType     = objvwProperty.ConstructionType;
            objProperty.HigherWindHall       = objvwProperty.HigherWindHall;
            objProperty.ConstType_ApplySpriniderSafeguardP1 = objvwProperty.ConstType_ApplySpriniderSafeguardP1;
            objProperty.ConstType_ExcludeWindHall           = objvwProperty.ConstType_ExcludeWindHall;
            objProperty.YearBuilt = objvwProperty.YearBuilt;
            objProperty.LastCompleteUpdateYear = objvwProperty.LastCompleteUpdateYear;
            objProperty.Plumbing                          = objvwProperty.Plumbing;
            objProperty.Rooting                           = objvwProperty.Rooting;
            objProperty.Wiring                            = objvwProperty.Wiring;
            objProperty.Coverage_Building                 = objvwProperty.Coverage_Building;
            objProperty.Coverage_BusinessIncome           = objvwProperty.Coverage_BusinessIncome;
            objProperty.Coverage_PersonalPropertyofOthers = objvwProperty.Coverage_PersonalPropertyofOthers;
            objProperty.Coverage_PropertyInOpen           = objvwProperty.Coverage_PropertyInOpen;
            objProperty.Coverage_Signs                    = objvwProperty.Coverage_Signs;

            PropertyHandler propertyHandler = new PropertyHandler();
            propertyHandler.Update(objProperty);
        }
        else
        {
            Property objProperty = new Property();


            objProperty.QuoteID  = Convert.ToInt32(Session["QuoteID"]);
            objProperty.Address1 = Convert.ToString(txtAddress1.Text);
            objProperty.Address2 = Convert.ToString(txtAddress2.Text);
            objProperty.Zip      = Convert.ToInt32(txtZip.Text);
            objProperty.City     = Convert.ToString(txtCity.Text);
            objProperty.StateID  = Convert.ToInt32(ddlState.SelectedValue);

            objProperty.ClassID = Convert.ToInt32(ddlSelectClass.SelectedValue);

            PropertyHandler propertyHandler = new PropertyHandler();
            propertyHandler.AddNew(objProperty);
        }
        //string strQuoteNo = Convert.ToString(Session["QuoteNo"]);
        LoadPropertyDetails(strQuoteNo);
        mvProperty.SetActiveView(vwBuilding);
    }