protected void btnRevenueSearch_Click(object sender, EventArgs e) { try { lblErrorOrganization.Visible = false; lblFromDateError.Visible = false; lblToDateError.Visible = false; string fromDate = txtFromDate.Text.ToString(); string toDate = txtToDate.Text.ToString(); //if (ddlOrganization.Enabled && ddlOrganization.SelectedIndex == 0) //{ // lblErrorOrganization.Text = "Please select organization"; // lblErrorOrganization.Visible = true; // return; //} if (string.IsNullOrEmpty(fromDate) && !string.IsNullOrEmpty(toDate)) { lblFromDateError.Text = "Please provide start date"; lblFromDateError.Visible = true; return; } if (!string.IsNullOrEmpty(fromDate) && string.IsNullOrEmpty(toDate)) { lblToDateError.Text = "Please provide end date"; lblToDateError.Visible = true; return; } if (!string.IsNullOrEmpty(fromDate) && !string.IsNullOrEmpty(toDate)) { hdnStartDate.Value = fromDate; hdnEndDate.Value = toDate; if (Convert.ToDateTime(fromDate) > Convert.ToDateTime(toDate)) { lblToDateError.Text = "Start date must be anterior to end date"; lblToDateError.Visible = true; return; } } DataSet ds = null; if (ddlState.SelectedIndex == 0) { ds = RevenuInventory.GetRevenueAdmin(0, 0, txtFromDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(fromDate), txtToDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(toDate), CountryIDByLanguageId); } else if (ddlState.SelectedIndex != 0 && ddlOrganization.SelectedIndex == 0) { ds = RevenuInventory.GetRevenueAdmin(Convert.ToInt32(ddlState.SelectedValue), 0, txtFromDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(fromDate), txtToDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(toDate), CountryIDByLanguageId); } else { ds = RevenuInventory.GetRevenueAdmin(Convert.ToInt32(ddlState.SelectedValue), Convert.ToInt32(ddlOrganization.SelectedValue), txtFromDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(fromDate), txtToDate.Text == string.Empty ? DateTime.MinValue : Convert.ToDateTime(toDate), CountryIDByLanguageId); } gvRevenue.DataSource = ds; gvRevenue.DataBind(); } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "ViewRevenue btnRevenueSearch_Click", ex); } }
private void LoadRevenue() { Utils.GetLookUpData <DropDownList>(ref ddlState, LookUps.GetStates, CountryIDByLanguageId); DataSet ds = RevenuInventory.GetRevenueAdmin(0, 0, DateTime.MinValue, DateTime.MinValue, CountryIDByLanguageId); gvRevenue.DataSource = ds; gvRevenue.DataBind(); }
protected void btnRevenueCancel_Click(object sender, EventArgs e) { //Response.Redirect("Revenue"); try { ddlState.SelectedIndex = 0; if (ddlOrganization.Enabled) { ddlOrganization.SelectedIndex = 0; ddlOrganization.Enabled = false; } lblFromDateError.Visible = false; lblToDateError.Visible = false; txtFromDate.Text = string.Empty; txtToDate.Text = string.Empty; gvRevenue.DataSource = RevenuInventory.GetRevenueAdmin(0, 0, DateTime.MinValue, DateTime.MinValue, CountryIDByLanguageId); gvRevenue.DataBind(); } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "ViewRevenue btnRevenueCancel_Click", ex); } }