protected void databind(string id)
        {
            Invoice object1 = DB.Invoices.Where(a => a.Invoice_Id.Equals(id)).SingleOrDefault();

            //GridView1.DataSource = DB.Bank_Names.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.BankName_Id, Name = a.Bank_Name1, a.AccountNo, DateOFOpen = a.DateOfOpen, a.Phone, a.Loation, a.PersonInCharge, a.Phone_PersonInCharge, Note = a.Bank_Name_Notes }); ;
            //GridView1.DataBind();


            DropDownListinvoicetype.DataSource = DB.Invoice_Ts.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.Invoice_T_Id, name = a.Invoice_T_Name });
            DropDownListinvoicetype.DataBind();

            DropDownListinvoicetype.SelectedValue = Convert.ToString(object1.Invoice_Type_Id);

            DropDownListcontacttype2.DataSource = DB.Contat_Ts.Where(a => a.IsDisable.Equals(false)).Select(a => new { a.Contat_T_Id, a.Contat_T_Name });
            DropDownListcontacttype2.DataBind();

            if (DropDownListinvoicetype.SelectedValue == "1")
            {
                DropDownListcontac.DataSource = DB.Contact2s.Where(a => a.IsDisable.Equals(false) && a.Client_Type.Equals(3)).Select(a => new { ID = a.Contact_Id, name = a.Contact_Name });
                DropDownListcontac.DataBind();

                DropDownListcontacttype2.SelectedValue = "3";
            }
            else if (DropDownListinvoicetype.SelectedValue == "2")
            {
                DropDownListcontac.DataSource = DB.Contact2s.Where(a => a.IsDisable.Equals(false) && a.Client_Type.Equals(1)).Select(a => new { ID = a.Contact_Id, name = a.Contact_Name });
                DropDownListcontac.DataBind();

                DropDownListcontacttype2.SelectedValue = "1";
            }


            TextBoxInvoiceno.Text = Convert.ToString(Convert.ToInt32(DB.Invoice_Serial_Collects.Where(a => a.Invoice_Serial_Collect_Collecting.Equals(DropDownListinvoicetype.SelectedValue)).SingleOrDefault().Invoice) + 1);

            datepicker.Text = Convert.ToString(DateTime.Now);

            DropDownListItem.DataSource = DB.Items.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.Items_Id, Name = a.Items_Name });
            DropDownListItem.DataBind();

            DropDownListtax.DataSource = DB.Taxes.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.Tax_Id, name = a.Tax_Name });
            DropDownListtax.DataBind();



            Labelid.Text = Convert.ToString(id);

            TextBoxAfterDiscount.Text = Convert.ToString(object1.Invoice_AfterDiscountprice);
            TextBoxTax.Text           = Convert.ToString(object1.Invoice_AfterDiscountprice_ATax);
            datepicker.Text           = Convert.ToString(object1.Invoice_Date);
            //CheckBoxDone.Checked = Convert.ToBoolean(object1.Invoice_IsDone);
            TextBoxInvoiceno.Text  = Convert.ToString(object1.Invoice_No);
            TextBoxNote.Text       = object1.Invoice_Note;
            TextBoxtotalprice.Text = Convert.ToString(object1.Invoice_Price);
            TextBoxcost.Text       = Convert.ToString(object1.Invoice_TotalCost);
            //DropDownListinvoicetype.SelectedValue = Convert.ToString(object1.Invoice_Type_Id);
            DropDownListcontac.SelectedValue = Convert.ToString(object1.Contact_Id);


            Labelstatus.Text = "Invoice No=" + object1.Invoice_No + " -Date of Invoice" + object1.Invoice_Date;

            TextBoxtaxpercentage0.Text = Convert.ToString(DB.Taxes.Where(a => a.Tax_Id.Equals(DropDownListtax.SelectedValue)).SingleOrDefault().Tax_Percentage);


            DropDownListitem0.DataSource = DB.Item_Types.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.Item_Type1, name = a.Item_Type_Name });
            DropDownListitem0.DataBind();
        }
Ejemplo n.º 2
0
 protected void dropdownlist()
 {
     DropDownListtax.DataSource = DB.Taxes.Where(a => a.IsDisable.Equals(false)).Select(a => new { ID = a.Tax_Id, name = a.Tax_Name });
     DropDownListtax.DataBind();
 }