protected void dropdownFYear_SelectedIndexChanged(object sender, EventArgs e) { Session["lastSelectedCountryIndex"] = dropdownFYear.SelectedIndex; string selectedText1 = dropdownFYear.SelectedItem.Text; string a1 = ""; string a2 = ""; string a3 = ""; string a4 = ""; DataTable dt, dt1, dt2 = new DataTable(); dt2 = ddo.TotalDutyAmnt(selectedText1); string l3 = dt2.Rows[0][0].ToString(); if (l3 == "") { Label3.Text = "0"; } else { Label3.Text = Math.Round(Convert.ToDecimal(l3), 2).ToString(); } dt1 = ddo.FilterInvoiceMaster(selectedText1, a1, a2, a3, a4); int b = dt1.Rows.Count; if (b > 0) { Label2.Text = b.ToString(); } else if (b == 0) { Label2.Text = "0"; } dt = ddo.GetFY(selectedText1); int a = dt.Rows.Count; if (a > 0) { Label1.Text = a.ToString(); } else if (a == 0) { Label1.Text = "0"; } }
protected void dropdownFYear1_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = new DataTable(); if (Session["lastSelectedCountryIndex"] != null) { dropdownFYear1.SelectedIndex = Convert.ToInt32((Session["lastSelectedCountryIndex"]).ToString()); if (dropdownFYear1.SelectedIndex != -1) { selectedText1 = dropdownFYear1.SelectedItem.Text; dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); Session["lastSelectedCountryIndex"] = null; } } if (Session["lastSelectedCountryIndex"] == null) { if (dropdownFYear1.SelectedIndex != -1) { if (dropdownWareHouse1.SelectedIndex != 0) { if (DropdownDistrict.SelectedIndex != 0) { if (from1.Text != Convert.ToString(DateTime.Now.ToString("dd / MM / yyyy")) && to1.Text != Convert.ToString(DateTime.Now.ToString("dd/MM/yyyy"))) { DateTime s1 = System.Convert.ToDateTime(from1.Text); DateTime Date = (s1); String frmdt = Date.ToString("yyyy-MM-dd"); DateTime s2 = System.Convert.ToDateTime(to1.Text); DateTime date = (s2); String to1dt = date.ToString("yyyy-MM-dd"); selectedText1 = dropdownFYear1.SelectedItem.Text; selectedText2 = dropdownWareHouse1.SelectedValue.ToString(); selectedText3 = DropdownDistrict.SelectedValue.ToString(); dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } else { selectedText1 = dropdownFYear1.SelectedItem.Text; selectedText2 = dropdownWareHouse1.SelectedValue.ToString(); selectedText3 = DropdownDistrict.SelectedValue.ToString(); dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } } else { if (from1.Text != Convert.ToString(DateTime.Now.ToString("dd / MM / yyyy")) && to1.Text != Convert.ToString(DateTime.Now.ToString("dd/MM/yyyy"))) { DateTime s1 = System.Convert.ToDateTime(from1.Text); DateTime Date = (s1); String frmdt = Date.ToString("yyyy-MM-dd"); DateTime s2 = System.Convert.ToDateTime(to1.Text); DateTime date = (s2); String to1dt = date.ToString("yyyy-MM-dd"); selectedText1 = dropdownFYear1.SelectedItem.Text; selectedText2 = dropdownWareHouse1.SelectedValue.ToString(); dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } else { selectedText1 = dropdownFYear1.SelectedItem.Text; selectedText2 = dropdownWareHouse1.SelectedValue.ToString(); dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } } } else { if (DropdownDistrict.SelectedIndex != 0) { if (from1.Text != Convert.ToString(DateTime.Now.ToString("dd / MM / yyyy")) && to1.Text != Convert.ToString(DateTime.Now.ToString("dd/MM/yyyy"))) { DateTime s1 = System.Convert.ToDateTime(from1.Text); DateTime Date = (s1); String frmdt = Date.ToString("yyyy-MM-dd"); DateTime s2 = System.Convert.ToDateTime(to1.Text); DateTime date = (s2); String to1dt = date.ToString("yyyy-MM-dd"); selectedText1 = dropdownFYear1.SelectedItem.Text; selectedText3 = DropdownDistrict.SelectedValue.ToString(); dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } else { selectedText1 = dropdownFYear1.SelectedItem.Text; selectedText3 = DropdownDistrict.SelectedValue.ToString(); dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } } else { if (from1.Text != Convert.ToString(DateTime.Now.ToString("dd / MM / yyyy")) && to1.Text != Convert.ToString(DateTime.Now.ToString("dd/MM/yyyy"))) { DateTime s1 = System.Convert.ToDateTime(from1.Text); DateTime Date = (s1); String frmdt = Date.ToString("yyyy-MM-dd"); DateTime s2 = System.Convert.ToDateTime(to1.Text); DateTime date = (s2); String to1dt = date.ToString("yyyy-MM-dd"); selectedText1 = dropdownFYear1.SelectedItem.Text; dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } else { selectedText1 = dropdownFYear1.SelectedItem.Text; dt = ddo1.FilterInvoiceMaster(selectedText1, selectedText2, selectedText3, frmdt, to1dt); Label1.Text = dt.Compute("Sum(DutyAmount)", "").ToString(); rptr.DataSource = dt; rptr.DataBind(); } } } } } }