Ejemplo n.º 1
0
    protected void ddlOrderItems_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddlOrderItems = (DropDownList)sender;

        Broker.DataAccess.OrderItem oi = Broker.DataAccess.OrderItem.Get(Convert.ToInt32(ddlOrderItems.SelectedValue));
        if (oi != null)
        {
            ObjectDataSource odsInusranceType = DetailsViewOfferItems.FindControl("odsInsuranceTypes") as ObjectDataSource;
            odsInusranceType.SelectParameters.Clear();
            odsInusranceType.SelectParameters.Add("orderItemID", ddlOrderItems.SelectedValue);

            ObjectDataSource odsInusranceSubType = DetailsViewOfferItems.FindControl("odsInsuranceSubTypes") as ObjectDataSource;
            odsInusranceSubType.SelectParameters.Clear();
            odsInusranceSubType.SelectParameters.Add("orderItemID", oi.ID.ToString());
            odsInusranceSubType.SelectParameters.Add("insuranceTypeID", oi.InsuranceSubType.InsuranceTypeID.ToString());

            //FakeBind(false, false, true, false);
            //ddlInsuranceSubTypes.SelectedValue = oi.InsuranceSubTypeID.ToString();
            //FakeBind(false, true, true, false);
            //DropDownList ddlInsuranceSubTypes = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceSubTypes");
            //FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceSubTypes);
            //ddlInsuranceSubTypes.DataBind();
            FakeBind(true, true, false, false);
            DropDownList ddlInsuranceCompanies = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceCompanies");
            FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceCompanies);
            ddlInsuranceCompanies.DataBind();
        }
    }
Ejemplo n.º 2
0
    protected void btnNewOfferItem_Click(object sender, EventArgs e)
    {
        int offerID = 0;

        if (GXGridView1.SelectedValue != null)
        {
            offerID = Convert.ToInt32(GXGridView1.SelectedDataKey.Value);
        }
        else
        {
            offerID = GXGridView1SelectedValue;
        }
        Offer o = Offer.Get(offerID);

        if (o.OrderID != null)
        {
            TextBox tbOrderNumber = DetailsViewOfferItems.FindControl("tbOrderNumber") as TextBox;
            tbOrderNumber.Text = o.Order.OrderNumber;
            DropDownList ddlOrderItems = DetailsViewOfferItems.FindControl("ddlOrderItems") as DropDownList;


            ddlOrderItems.DataBind();

            Broker.DataAccess.OrderItem orderItem = Broker.DataAccess.OrderItem.Get(int.Parse(ddlOrderItems.SelectedValue));

            List <Broker.DataAccess.OrderItem> oItemList = Broker.DataAccess.OrderItem.GetByOrderID((int)o.OrderID);
            if (oItemList.Count > 0)
            {
                // ControlCollection c = DetailsViewOfferItems.Controls;
                ObjectDataSource odsInusranceType = DetailsViewOfferItems.FindControl("odsInsuranceTypes") as ObjectDataSource;
                odsInusranceType.SelectParameters.Clear();
                odsInusranceType.SelectParameters.Add("orderItemID", orderItem.ID.ToString());

                ObjectDataSource odsInusranceSubType = DetailsViewOfferItems.FindControl("odsInsuranceSubTypes") as ObjectDataSource;
                odsInusranceSubType.SelectParameters.Clear();
                odsInusranceSubType.SelectParameters.Add("orderItemID", orderItem.ID.ToString());
                odsInusranceSubType.SelectParameters.Add("insuranceTypeID", orderItem.InsuranceSubType.InsuranceTypeID.ToString());

                FakeBind(true, false, false, false);
                FakeBind(false, true, false, false);
                DropDownList ddlInsuranceCompanies = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceCompanies");
                FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceCompanies);
                ddlInsuranceCompanies.DataBind();
                mvOfferItems.SetActiveView(viewOfferItemsEdit);
                DetailsViewOfferItems.ChangeMode(DetailsViewMode.Insert);
            }
        }
        else
        {
            mvOfferItems.SetActiveView(viewOfferItemsEdit);
            DetailsViewOfferItems.ChangeMode(DetailsViewMode.Insert);
            //  TextBox tbOfferNumber = (TextBox)DetailsViewOfferItems.FindControl("tbOfferNumber");
            //   tbOfferNumber.Text = Offer.Get(Convert.ToInt32(GXGridView1.SelectedDataKey.Value)).OfferNumber;
        }
    }