private void performSelfBillSearch() { Facade.IInvoice facInvoice = new Facade.Invoice(); eInvoiceType searchInvoiceType = eInvoiceType.SelfBill; switch ((eInvoiceFilterType)Enum.Parse(typeof(eInvoiceFilterType), rdoFilterOptions.SelectedValue.Replace(" ", ""))) { case eInvoiceFilterType.SelfBillInvoice: searchInvoiceType = eInvoiceType.SelfBill; break; case eInvoiceFilterType.Extra: searchInvoiceType = eInvoiceType.Extra; break; default: searchInvoiceType = eInvoiceType.Normal; break; } int posted = 0; switch ((eWithOrWithout)Enum.Parse(typeof(eWithOrWithout), rdoPosted.SelectedValue)) { case eWithOrWithout.All: posted = 2; break; case eWithOrWithout.With: posted = 1; break; case eWithOrWithout.Without: posted = 0; break; } int clientId = cboClient.SelectedValue == "" ? 0 : Convert.ToInt32(cboClient.SelectedValue); string clientInvoiceNumber = string.Empty; if (txtClientInvoiceNumber.Text != string.Empty) { clientInvoiceNumber = txtClientInvoiceNumber.Text; } DateTime startDate = dteStartDate.SelectedDate.Value; startDate = startDate.Subtract(startDate.TimeOfDay); DateTime endDate = dteEndDate.SelectedDate.Value; endDate = endDate.Subtract(endDate.TimeOfDay); endDate = endDate.Add(new TimeSpan(23, 59, 59)); // Job State eJobState jobState = new eJobState(); if (cboJobState.SelectedValue != string.Empty) { jobState = (eJobState)Enum.Parse(typeof(eJobState), cboJobState.SelectedValue); } if (startDate != DateTime.MinValue && endDate != DateTime.MinValue) { dsInvoice = facInvoice.GetwithParamsAndDate(clientId, clientInvoiceNumber, jobState, posted, startDate, endDate, searchInvoiceType); } else { if (clientId == 0) { dsInvoice = facInvoice.GetAll(posted, searchInvoiceType); } else { dsInvoice = facInvoice.GetwithParams(clientId, clientInvoiceNumber, jobState, posted, searchInvoiceType); } } gvInvoices.Columns[7].Visible = true; gvInvoices.DataSource = dsInvoice; ViewState[C_InvoiceDATA_VS] = dsInvoice; gvInvoices.DataBind(); if (gvInvoices.Rows.Count == 0) { pnlNormalInvoice.Visible = false; lblNote.Text = "There are no invoices for the given criteria."; lblNote.ForeColor = Color.Red; lblNote.Visible = true; } { pnlNormalInvoice.Visible = true; gvInvoices.Visible = true; } }