protected void rptrDownload_ItemCommand(object source, RepeaterCommandEventArgs e) { LeadsDownloadBL objLeadDownload = new LeadsDownloadBL(); HiddenField lblStateID = (HiddenField)e.Item.FindControl("lblStateID"); Label lblStateCode = (Label)e.Item.FindControl("lblStateCode"); DataSet dsLeadsDownload = objLeadDownload.GetAllcotedLeadsDownload(ddlVehicleType.SelectedItem.Value, ddlCenter.SelectedItem.Value, txtStartDate.Text, txtEndDate.Text, lblStateID.Value, Session[Constants.USER_ID].ToString()); //DataSetToExcel.Convert(dsLeadsDownload, Response, ddlVehicleType.SelectedItem.Value + lblStateCode.Text); DataSetToExcel.Convert(dsLeadsDownload, Response, "UCE-CarLeads-" + ddlCenter.SelectedItem.Text + "-" + String.Format("{0:yyyy-MM-dd}", System.DateTime.Now.ToString()) + ".xls"); }
protected void AllDownloaded_Click(object sender, EventArgs e) { LeadsDownloadBL objLeadDownload = new LeadsDownloadBL(); DataSet dsTotal = new DataSet(); string strStateID = string.Empty; int i = 0; for (int index = 0; index < rptrDownload.Items.Count; index++) { HiddenField lblStateID = (HiddenField)rptrDownload.Items[index].FindControl("lblStateID"); Label lblStateCode = (Label)rptrDownload.Items[index].FindControl("lblStateCode"); CheckBox chk = (CheckBox)rptrDownload.Items[index].FindControl("chk"); if (i == 0) { strStateID = lblStateID.Value; i = +1; } else { strStateID = strStateID + "," + lblStateID.Value; } } DataSet dsLeadsDownload = objLeadDownload.GetAllcotedLeadsDownload(ddlVehicleType.SelectedItem.Value, ddlCenter.SelectedItem.Value, txtStartDate.Text, txtEndDate.Text, strStateID, Session[Constants.USER_ID].ToString()); if (dsLeadsDownload != null) { if (dsLeadsDownload.Tables.Count > 0) { if (dsLeadsDownload.Tables[0].Rows.Count > 0) { objLeadDownload.UpdateLeadsAllcotedLeadsStatus(ddlVehicleType.SelectedItem.Value, ddlCenter.SelectedItem.Value, txtStartDate.Text, txtEndDate.Text, strStateID, Session[Constants.USER_ID].ToString(), dsLeadsDownload.Tables[0].Rows.Count.ToString()); //GetResultsData(); //DataSetToExcel.Convert(dsLeadsDownload, "UCE-CarLeads-" + ddlCenter.SelectedItem.Text + "-" + String.Format("{0:yyyy-MM-dd}", System.DateTime.Now.ToString()) + ".xls"); GetResultsData(); Session["PageDown"] = "LeadsDownload"; Session["LeadsDownDataset"] = dsLeadsDownload; Session["LeadsdownloadName"] = "UCE-CarLeads-" + ddlCenter.SelectedItem.Text + "-" + String.Format("{0:yyyy-MM-dd}", System.DateTime.Now.ToString()) + ".xls"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "javascript:poptasticTest('GetExcelDownload.aspx');", true); } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } }
protected void btnView_Click(object sender, EventArgs e) { LeadsDownloadBL objLeadDownload = new LeadsDownloadBL(); DataSet dsTotal = new DataSet(); string strStateID = string.Empty; int i = 0; for (int index = 0; index < rptrDownload.Items.Count; index++) { HiddenField lblStateID = (HiddenField)rptrDownload.Items[index].FindControl("lblStateID"); Label lblStateCode = (Label)rptrDownload.Items[index].FindControl("lblStateCode"); CheckBox chk = (CheckBox)rptrDownload.Items[index].FindControl("chk"); Label lblTobeDownload = (Label)rptrDownload.Items[index].FindControl("lblTobeDownload"); if (chk.Checked == true) { if (lblTobeDownload.Text != "0") { if (i == 0) { strStateID = "'" + lblStateID.Value + "'"; i = +1; } else { strStateID = strStateID + ",'" + lblStateID.Value + "'"; } } } } if (strStateID != "") { DataSet dsLeadsDownload = objLeadDownload.GetAllcotedLeadsDownload(ddlVehicleType.SelectedItem.Value, ddlCenter.SelectedItem.Value, txtStartDate.Text, txtEndDate.Text, strStateID, Session[Constants.USER_ID].ToString()); if (dsLeadsDownload != null) { if (dsLeadsDownload.Tables.Count > 0) { if (dsLeadsDownload.Tables[0].Rows.Count > 0) { lblLeadCnt.Text = dsLeadsDownload.Tables.Count.ToString(); DataView dv = GetTopDataViewRows(dsLeadsDownload.Tables[0].DefaultView, 25); rptrLeads.DataSource = dv.ToTable(); rptrLeads.DataBind(); lblLeadCnt.Text = dv.ToTable().Rows.Count.ToString(); MpeShowLeads.Show(); } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } } else { lblErrorExists.Visible = true; lblErrorExists.Text = "No leads are available for view/download"; mdepAlertExists.Show(); } }