protected void btnSubmit_Click(object sender, EventArgs e) { try { //LoadData(); if (ddlMonth.SelectedValue == "0") { Response.Write("<script>alert('Please select Month.....!')</script>"); } else if (ddlYear.SelectedValue == "0") { Response.Write("<script>alert('Please select Year.....!')</script>"); } else { string Sql = "SELECT Id ,SendFrom,SendTo,sentMessage,TotalSent,Totallength,TotalSms,balance ,EntryDate " + "FROM PromotionalSendSMSReport where SendFrom='" + Convert.ToString(Session["Mobile"]) + "'"; if (ddlMonth.SelectedValue != "0") { Sql = Sql + " and datePart(month,PromotionalSendSMSReport.EntryDate)=" + ddlMonth.SelectedValue.ToString() + ""; } if (ddlYear.SelectedValue != "0") { Sql = Sql + " and datePart(Year,PromotionalSendSMSReport.EntryDate)=" + ddlYear.SelectedItem.Text.ToString() + ""; } Sql = Sql + " order by id desc"; DataSet ds = cc.ExecuteDataset(Sql); GvBalence.DataSource = ds.Tables[0]; GvBalence.DataBind(); foreach (GridViewRow row in GvBalence.Rows) { string Data = row.Cells[2].Text.ToString(); Data = "Mobile List"; row.Cells[2].Text = Data; } foreach (GridViewRow row in GvBalence.Rows) { string Data = row.Cells[8].Text.ToString(); Data = DateSplit(Data); row.Cells[8].Text = Data; } } } catch (Exception ex) { } }
private void show() { try { string Sql = "select * from SMSBalanceReport where "; if (ddlMonth.SelectedValue != "0") { Sql = Sql + " datePart(month,SMSBalanceReport.SendDate)= '" + ddlMonth.SelectedValue + "' and "; } if (ddlYear.SelectedValue != "0") { Sql = Sql + " datePart(Year,SMSBalanceReport.SendDate)='" + ddlYear.SelectedItem.Text + "' and"; } Sql = Sql + " MobileNo='" + Convert.ToString(Session["Mobile"]) + "' order by Id desc"; DataSet ds = cc.ExecuteDataset(Sql); GvBalence.DataSource = ds.Tables[0]; GvBalence.DataBind(); } catch (Exception ex) { } }
public void LoadData() { try { string Sql = "SELECT Top(100) Id ,SendFrom,SendTo,sentMessage,TotalSent,Totallength,TotalSms,balance ,EntryDate " + "FROM PromotionalSendSMSReport where SendFrom='" + Convert.ToString(Session["Mobile"]) + "'"; if (ddlMonth.SelectedValue != "0") { Sql = Sql + " and datePart(month,PromotionalSendSMSReport.EntryDate)=" + ddlMonth.SelectedValue.ToString() + ""; } if (ddlYear.SelectedValue != "0") { Sql = Sql + " and datePart(Year,PromotionalSendSMSReport.EntryDate)=" + ddlYear.SelectedItem.Text.ToString() + ""; } Sql = Sql + " order by id desc"; DataSet ds = cc.ExecuteDataset(Sql); if (ds.Tables[0].Rows.Count > 0) { GvBalence.DataSource = ds.Tables[0]; GvBalence.DataBind(); } foreach (GridViewRow row in GvBalence.Rows) { string Data = row.Cells[2].Text.ToString(); Data = "Mobile List"; row.Cells[2].Text = Data; } foreach (GridViewRow row in GvBalence.Rows) { string Data = row.Cells[8].Text.ToString(); Data = DateSplit(Data); row.Cells[8].Text = Data; } } catch (Exception ex) { } }