//this is From Date date add
if (txtafrmdate.Value != "" && txtafrmdate.Value != null)
{
//this is dateadd from date , to date and User activation status
////this is date add from date and to date
if (txtatodate.Value != "" && txtatodate.Value != null)
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
else
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "FromDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
int cnt = ObjDataSet.Tables[0].Rows.Count;
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
}
////this is To Date date add
if (txtatodate.Value != "" && txtatodate.Value != null)
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "ToDate");
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is From Date valid date
if (txtvfrmdate.Value != "" && txtvfrmdate.Value != null)
{
if (txtvtodate.Value != "" && txtvtodate.Value != null)
{
//this is valid date from date and to date
if ((txtvfrmdate.Value != "" && txtvtodate.Value != "") || (txtvfrmdate.Value != null && txtvtodate.Value != null)) //this is From Date and todate for valid date
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
}
else
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "FromDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
int cnt = ObjDataSet.Tables[0].Rows.Count;
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
}
////this is date add from date to date user activation status
if ((txtafrmdate.Value != "" && txtatodate.Value != "" && ddluseractivestatus.SelectedValue != "") || (txtafrmdate.Value != null && txtatodate.Value != null && ddluseractivestatus.SelectedValue != null)) //this is From Date and todate for dateadd and dateadd
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDateUserActStu", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlCommand.Parameters.AddWithValue("@UserActivationstatus", ddluseractivestatus.SelectedValue);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is valid date from date to date user activation status
if ((txtvfrmdate.Value != "" && txtvtodate.Value != "" && ddluseractivestatus.SelectedValue != "") || (txtvfrmdate.Value != null && txtvtodate.Value != null && ddluseractivestatus.SelectedValue != null)) //this is From Date and todate for dateadd and dateadd
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDateUserActStu", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlCommand.Parameters.AddWithValue("@UserActivationstatus", ddluseractivestatus.SelectedValue);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
////this is To Date date add
if (txtvtodate.Value != "" && txtvtodate.Value != null)
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "ToDate");
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtvtodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is city
if ((ddlcity.SelectedValue != "0" && ddlcity.SelectedValue != null))
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchCity", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
ObjSqlCommand.Parameters.AddWithValue("@City", ddlcity.SelectedItem.Text); //this is service obtained
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is district
if ((ddldistrict.SelectedValue != "0" && ddldistrict.SelectedValue != null))
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchDistrict", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
ObjSqlCommand.Parameters.AddWithValue("@District", ddldistrict.SelectedItem.Text); //this is service obtained
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is service based
if ((ddluseractivestatus.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (ddluseractivestatus.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null))
{
//this is service obtained
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_ServiceObtained", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@ServiceObtained", ddluserservuceobtained.SelectedValue); //this is service obtained
if (ddluserservuceobtained.SelectedIndex == 1) //tspsc
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddltspsc.SelectedItem.Text);
}
if (ddluserservuceobtained.SelectedIndex == 2) //rrb
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddlrrb.SelectedItem.Text);
}
if (ddluserservuceobtained.SelectedIndex == 3) //eamcet eng
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddltspsc.SelectedItem.Text); //change it for ddl name feature
}
if (ddluserservuceobtained.SelectedIndex == 4) //eamcer med
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddltspsc.SelectedItem.Text); //change it for ddl name feature
}
ObjSqlCommand.Parameters.AddWithValue("@ExamTotalAmount", lblexamcount.Text);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
////this is date add from date and to date
//if ((txtafrmdate.Value != "" && txtatodate.Value != "") || (txtafrmdate.Value != null && txtatodate.Value != null)) //this is From Date and todate for dateadd
//{
//}
//if ((txtafrmdate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate User Activation status
//{
// //this is fromdate and tspsc
// //
//}
//if ((txtafrmdate.Value != "" && txtatodate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate todate User Activation status
//{
// //this is fromdate , todate and tspsc
//}
//if ((txtvfrmdate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate User Activation status
//{
// //this is valid from date and tspsc
//}
//if ((txtvfrmdate.Value != "" && txtvtodate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate User Activation status
//{
// //this is valid from date , todate and tspsc
//}
public object BindGridFunction()
{
string Query = null;
Query = "select Convert(varchar(30),B.RecDateTime,103)RecDate,A.ID,substring(A.Fupdate,0,12)Followup,";
Query += " C.[User_Name]UName, A.User_Lock, A.Number1,A.Contact_Person,B.Status, A.Inst_Name,A.District";
Query += " from TeleCaller_Data as A Inner join";
Query += " UserActivity as B on A.Id = B.Tcd_Id ";
Query += " inner join Users as C on A.User_Lock = C.[User_Id] ";
if (chkLatest.Checked == true) {
Query += " and B.UpdatedDate in (select max(updateddate) over(partition by tcd_id) max_updateddate from useractivity)";
}
Query += " where(A.FupDate Is Not null)";
if (!string.IsNullOrEmpty(txtFromDate.Text) & !string.IsNullOrEmpty(txtToDate.Text)) {
Query += " and B.RecDateTime between Convert(datetime,'" + txtFromDate.Text + "',103) and Convert(datetime,'" + txtToDate.Text + "',103)";
}
if (ddlUser.SelectedIndex != 0) {
Query += " and A.User_Lock = '" + ddlUser.SelectedValue + "'";
}
if (ddlInstType.SelectedIndex != 0) {
Query += "and A.Inst_Type Like '%" + ddlInstType.SelectedItem.Text + "%'";
}
if (!string.IsNullOrEmpty(txtCity.Text)) {
Query += "and A.City Like '%" + txtCity.Text + "%'";
}
if (ddlDistrict.SelectedIndex != 0) {
Query += "and A.District Like '%" + ddlDistrict.SelectedItem.Text + "%'";
}
if (!string.IsNullOrEmpty(txtInstName.Text)) {
Query += "and A.Inst_Name Like '%" + txtInstName.Text + "%'";
}
if (!string.IsNullOrEmpty(txtMobile.Text)) {
Query += "and A.Number1 Like '%" + txtMobile.Text + "%' or A.Number2 Like '%" + txtMobile.Text + "%' or A.Number3 Like '%" + txtMobile.Text + "%' ";
}
if (ddlStatus.SelectedIndex != 0) {
Query += " and [Status] in ('" + ddlStatus.SelectedItem.Text + "') ";
}
Query += " order by B.RecDateTime asc";
gdvParent.DataSource = GetData(Query);
gdvParent.DataBind();
if (GetData(Query).Rows.Count > 0) {
lblCnt.Text = GetData(Query).Rows.Count;
} else if (GetData(Query).Rows.Count <= 0) {
lblCnt.Text = "";
}
return true;
}
if (txtafrmdate.Value != "" && txtafrmdate.Value != null)
{
//this is dateadd from date , to date and User activation status
////this is date add from date and to date
if (txtatodate.Value != "" && txtatodate.Value != null)
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
else
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "FromDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
int cnt = ObjDataSet.Tables[0].Rows.Count;
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
}
////this is To Date date add
if (txtatodate.Value != "" && txtatodate.Value != null)
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "ToDate");
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is From Date valid date
if (txtvfrmdate.Value != "" && txtvfrmdate.Value != null)
{
if (txtvtodate.Value != "" && txtvtodate.Value != null)
{
//this is valid date from date and to date
if ((txtvfrmdate.Value != "" && txtvtodate.Value != "") || (txtvfrmdate.Value != null && txtvtodate.Value != null)) //this is From Date and todate for valid date
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
}
else
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "FromDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
int cnt = ObjDataSet.Tables[0].Rows.Count;
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
}
////this is date add from date to date user activation status
if ((txtafrmdate.Value != "" && txtatodate.Value != "" && ddluseractivestatus.SelectedValue != "") || (txtafrmdate.Value != null && txtatodate.Value != null && ddluseractivestatus.SelectedValue != null)) //this is From Date and todate for dateadd and dateadd
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDateUserActStu", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlCommand.Parameters.AddWithValue("@UserActivationstatus", ddluseractivestatus.SelectedValue);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is valid date from date to date user activation status
if ((txtvfrmdate.Value != "" && txtvtodate.Value != "" && ddluseractivestatus.SelectedValue != "") || (txtvfrmdate.Value != null && txtvtodate.Value != null && ddluseractivestatus.SelectedValue != null)) //this is From Date and todate for dateadd and dateadd
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForFromDateToDateUserActStu", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@FromDate", txtafrmdate.Value);
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtatodate.Value);
ObjSqlCommand.Parameters.AddWithValue("@UserActivationstatus", ddluseractivestatus.SelectedValue);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
////this is To Date date add
if (txtvtodate.Value != "" && txtvtodate.Value != null)
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchForToDate", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "ToDate");
ObjSqlCommand.Parameters.AddWithValue("@Todate", txtvtodate.Value);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is city
if ((ddlcity.SelectedValue != "0" && ddlcity.SelectedValue != null))
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchCity", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
ObjSqlCommand.Parameters.AddWithValue("@City", ddlcity.SelectedItem.Text); //this is service obtained
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is district
if ((ddldistrict.SelectedValue != "0" && ddldistrict.SelectedValue != null))
{
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_SearchDistrict", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
ObjSqlCommand.Parameters.AddWithValue("@District", ddldistrict.SelectedItem.Text); //this is service obtained
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
//this is service based
if ((ddluseractivestatus.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (ddluseractivestatus.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null))
{
//this is service obtained
ObjSqlConnection = new SqlConnection(strcon);
ObjSqlCommand = new SqlCommand("Sp_ServiceObtained", ObjSqlConnection);
ObjSqlCommand.CommandType = CommandType.StoredProcedure;
//System.Threading.Thread.Sleep(3000);
//ObjSqlCommand.Parameters.AddWithValue("@status", "DateAddValidDate");
ObjSqlCommand.Parameters.AddWithValue("@ServiceObtained", ddluserservuceobtained.SelectedValue); //this is service obtained
if (ddluserservuceobtained.SelectedIndex == 1) //tspsc
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddltspsc.SelectedItem.Text);
}
if (ddluserservuceobtained.SelectedIndex == 2) //rrb
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddlrrb.SelectedItem.Text);
}
if (ddluserservuceobtained.SelectedIndex == 3) //eamcet eng
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddltspsc.SelectedItem.Text); //change it for ddl name feature
}
if (ddluserservuceobtained.SelectedIndex == 4) //eamcer med
{
ObjSqlCommand.Parameters.AddWithValue("@ExamCount", ddltspsc.SelectedItem.Text); //change it for ddl name feature
}
ObjSqlCommand.Parameters.AddWithValue("@ExamTotalAmount", lblexamcount.Text);
ObjSqlDataAdapter = new SqlDataAdapter(ObjSqlCommand);
ObjDataSet = new DataSet();
ObjSqlDataAdapter.Fill(ObjDataSet);
if (ObjDataSet.Tables[0].Rows.Count == 0)
{
ObjDataSet.Tables[0].Rows.Add(ObjDataSet.Tables[0].NewRow());
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
int columncount = gvAdvSearch.Rows[0].Cells.Count;
gvAdvSearch.Rows[0].Cells.Clear();
gvAdvSearch.Rows[0].Cells.Add(new TableCell());
gvAdvSearch.Rows[0].Cells[0].ColumnSpan = columncount;
gvAdvSearch.Rows[0].Cells[0].Text = "No Records Found";
//clearcontrol();
return;
}
else
{
//int count = ObjDataSet.Tables.Count;
gvAdvSearch.Visible = true;
gvAdvSearch.DataSource = ObjDataSet;
gvAdvSearch.DataBind();
lblerrormsg.Visible = false;
//clearcontrol();
return;
}
}
////this is date add from date and to date
//if ((txtafrmdate.Value != "" && txtatodate.Value != "") || (txtafrmdate.Value != null && txtatodate.Value != null)) //this is From Date and todate for dateadd
//{
//}
//if ((txtafrmdate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate User Activation status
//{
// //this is fromdate and tspsc
// //
//}
//if ((txtafrmdate.Value != "" && txtatodate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate todate User Activation status
//{
// //this is fromdate , todate and tspsc
//}
//if ((txtvfrmdate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate User Activation status
//{
// //this is valid from date and tspsc
//}
//if ((txtvfrmdate.Value != "" && txtvtodate.Value != "" && ddluseractivestatus.SelectedValue != "" && ddluseradded.SelectedValue != "" && ddluserservuceobtained.SelectedValue != "" && ddlcity.SelectedValue != "" && ddldistrict.SelectedValue != "" && ddltspsc.SelectedValue != "" && lblexamcount.Text != "") || (txtafrmdate.Value != null && ddluseractivestatus.SelectedValue != null && ddluseradded.SelectedValue != null && ddluserservuceobtained.SelectedValue != null && ddlcity.SelectedValue != null && ddldistrict.SelectedValue != null && ddltspsc.SelectedValue != null && lblexamcount.Text != null)) //fromdate User Activation status
//{
// //this is valid from date , todate and tspsc
//}
public object BindGridFunction()
{
string Query = null;
Query = "select Convert(varchar(30),B.RecDateTime,103)RecDate,A.ID,substring(A.Fupdate,0,12)Followup,";
Query += " C.[User_Name]UName, A.User_Lock, A.Number1,A.Contact_Person,B.Status, A.Inst_Name,A.District";
Query += " from TeleCaller_Data as A Inner join";
Query += " UserActivity as B on A.Id = B.Tcd_Id ";
Query += " inner join Users as C on A.User_Lock = C.[User_Id] ";
if (chkLatest.Checked == true) {
Query += " and B.UpdatedDate in (select max(updateddate) over(partition by tcd_id) max_updateddate from useractivity)";
}
Query += " where(A.FupDate Is Not null)";
if (!string.IsNullOrEmpty(txtFromDate.Text) & !string.IsNullOrEmpty(txtToDate.Text)) {
Query += " and B.RecDateTime between Convert(datetime,'" + txtFromDate.Text + "',103) and Convert(datetime,'" + txtToDate.Text + "',103)";
}
if (ddlUser.SelectedIndex != 0) {
Query += " and A.User_Lock = '" + ddlUser.SelectedValue + "'";
}
if (ddlInstType.SelectedIndex != 0) {
Query += "and A.Inst_Type Like '%" + ddlInstType.SelectedItem.Text + "%'";
}
if (!string.IsNullOrEmpty(txtCity.Text)) {
Query += "and A.City Like '%" + txtCity.Text + "%'";
}
if (ddlDistrict.SelectedIndex != 0) {
Query += "and A.District Like '%" + ddlDistrict.SelectedItem.Text + "%'";
}
if (!string.IsNullOrEmpty(txtInstName.Text)) {
Query += "and A.Inst_Name Like '%" + txtInstName.Text + "%'";
}
if (!string.IsNullOrEmpty(txtMobile.Text)) {
Query += "and A.Number1 Like '%" + txtMobile.Text + "%' or A.Number2 Like '%" + txtMobile.Text + "%' or A.Number3 Like '%" + txtMobile.Text + "%' ";
}
if (ddlStatus.SelectedIndex != 0) {
Query += " and [Status] in ('" + ddlStatus.SelectedItem.Text + "') ";
}
Query += " order by B.RecDateTime asc";
gdvParent.DataSource = GetData(Query);
gdvParent.DataBind();
if (GetData(Query).Rows.Count > 0) {
lblCnt.Text = GetData(Query).Rows.Count;
} else if (GetData(Query).Rows.Count <= 0) {
lblCnt.Text = "";
}
return true;
}
No comments:
Post a Comment
Hello all, if you have any doubt feel free comment