//This method initializes the format of the UltraWebGrid // In this method the multiple headers are drawn and also the header caption and the // appearance of the columns are initialized public void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e) { QMReportsClass objQMReports = new QMReportsClass(); objQMReports.ContainerViewUltraGrid_Initialize(e, this.regionCode); }
protected void OrgName_CheckedChanged(object sender, EventArgs e) { try { if (OrgName.Checked) { this.code = 0; Label1.Text = "Select OrgName:"; populateLstBoxBusinessUnitName(); if (rbtnInputForm.Checked) { pnlInputForm.Visible = true; pnlContainer.Visible = false; QMReportsClass objQMReports = new QMReportsClass(); string BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); btnNext.Enabled = true; populateInputFormLstBox(); } else if (rbtnContainer.Checked) { pnlContainer.Visible = true; } } } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
protected void btnExport_Click(object sender, EventArgs e) { QMReportsClass objQMReports = new QMReportsClass(); string InputFormName = null; QMReportsClass.ExportContainer(objDT, Page, this.regionCode, Label1.Text, InputFormName); }
protected void GBUName_CheckedChanged(object sender, EventArgs e) { try { if (GBUName.Checked) { this.code = 2; Label1.Text = "Select GBUName:"; populateLstBoxBusinessUnitName(); // rbtnCheck_CheckedChanged(object sender, EventArgs e); if (rbtnInputForm.Checked) { pnlInputForm.Visible = true; pnlContainer.Visible = false; QMReportsClass objQMReports = new QMReportsClass(); string BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); //OrgCode = OrgCode.Trim(); btnNext.Enabled = true; populateInputFormLstBox(); //Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('No InputForm is available for. Please select another );", true); } else if (rbtnContainer.Checked) { pnlContainer.Visible = true; } } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void rbtnInputForm_CheckedChanged(object sender, EventArgs e) { try { if (rbtnInputForm.Checked) { pnlInputForm.Visible = true; pnlContainer.Visible = false; QMReportsClass objQMReports = new QMReportsClass(); string BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); populateInputFormLstBox(); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void btnNext_Click(object sender, EventArgs e) { try { QMReportsClass objQMReports = new QMReportsClass(); string InputFormID = getSelectedInputForm(lstboxInputFormName); string BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); string regionCode = objQMReports.getSelectedValues(LstBoxRegionName); if (BizCode == null || regionCode == null || InputFormID == null) { StringBuilder errormsg = new StringBuilder(); errormsg.Append(String.Empty); errormsg.Append("Please Select :"); if (BizCode == null) { errormsg.Append(" " + Label1.Text); } if (regionCode == null) { errormsg.Append(" regionCode"); } if (InputFormID == null) { errormsg.Append(" InputFormName"); } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + errormsg + "');", true); btnNext.Enabled = false; } else { Response.Redirect("QM_InputForms.aspx?InputFormIds=" + InputFormID + "&BizCode=" + BizCode + "&Code=" + code + "®ionCode=" + regionCode); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { InputFormId = Convert.ToString(Request.QueryString["FormId"]); BizCode = Convert.ToString(Request.QueryString["BizCode"]); Code = Convert.ToString(Request.QueryString["Code"]); regionCode = Convert.ToString(Request.QueryString["regionCode"]); Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString); dsContainers = dbObj.RunSPReturnDataSet("_Reports_QM_Compute_InputForms_Containers", new SqlParameter("@_Input_Form_Id", InputFormId), new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", Code), new SqlParameter("@RegionCode", regionCode)); string Biz = ""; if (Code.Equals("0")) { Biz = "Selected OrgName"; } else if (Code.Equals("1")) { Biz = "Selected GroupName"; } else if (Code.Equals("2")) { Biz = "Selected GBUName"; } DataSet dsBizNames = dbObj.RunSPReturnDataSet("_GetSelectedBusinessNames", new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", Code)); string BizList = ""; foreach (DataRow r in dsBizNames.Tables[0].Rows) { BizList += r[0].ToString() + ","; } BizList = BizList.Remove(BizList.Length - 1, 1); //Label2.Text = BizList; Label1.Text = Biz + ": " + BizList; Label1.Font.Size = 8; Label1.ForeColor = System.Drawing.Color.DarkSlateGray; //SqlDataReader IFName = dbObj.RunSQLReturnRS("select Name from InputForms where InputFormId = " + InputFormId); SqlDataReader IFName = dbObj.RunSQLReturnRS("select Name from InputForms where InputFormId =" + @InputFormId, HyperComponents.Data.dbAccess.Database.NewSqlParameter("@InputFormId", System.Data.SqlDbType.Text, InputFormId.Length, InputFormId)); string InputFormName = string.Empty; while (IFName.Read()) { InputFormName = IFName.GetString(0); } Label2.Text = "Selected InputForm: " + InputFormName; Label2.Font.Size = 8; Label2.ForeColor = System.Drawing.Color.DarkSlateGray; if (dsContainers.Tables[0].Rows.Count != 0) { QMReportsClass objQMReports = new QMReportsClass(); this.objDT = objQMReports.GetConsolidatedData(dsContainers, regionCode); UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.Hierarchical; UltraWebGrid1.DataSource = objDT; UltraWebGrid1.DataBind(); this.UltraWebGrid1.Height = Unit.Empty; this.UltraWebGrid1.Width = Unit.Empty; } else { // Response.Write("Records not available for the selected Inputs"); Label1.Text = "Records not available for the selected Inputs"; UltraWebGrid1.Visible = false; btnExport.Visible = false; Label1.Visible = true; } IFName.Close(); } catch (Exception ex) { //Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('Records not available for the selected input');", true); Response.Write(ex.Message.ToString()); } }
protected void btnExport_Click(object sender, EventArgs e) { InputFormId = Convert.ToString(Request.QueryString["FormId"]); regionCode = Convert.ToString(Request.QueryString["regionCode"]); QMReportsClass.ExportContainer(this.objDT, Page, regionCode, Label1.Text, Label2.Text); }
protected void submit2_Click(object sender, EventArgs e) { try { ErrorMsg1.Visible = false; Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString); DataSet ds = new DataSet(); QMReportsClass QS = new QMReportsClass(); String Biz1 = QS.getSelectedValues(BusinessList1); String Cultures1 = QS.getSelectedValues(CulturesList1); if (Biz1.Length == 0 || Cultures1.Length == 0) { ErrorMsg1.Text = "Invalid selection"; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + ErrorMsg1.Text + "');", true); //ErrorMsg.Visible = true; } else { ds = dbObj.RunSPReturnDataSet("Non_Compatibilities_Generate", new SqlParameter("@Business", Biz1), new SqlParameter("@RegionName", Cultures1), new SqlParameter("@Code", this.code1)); // QC777 If the number of rows returned by the dataset is less than 65536, the report will be generated in excel format if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows.Count < 65536) { string BizList1 = ""; string Regions1 = ""; QMReportsClass objQMReports = new QMReportsClass(); BizList1 = objQMReports.GetSelectedBiz_Reg(1, Biz1, this.code1); Regions1 = objQMReports.GetSelectedBiz_Reg(0, Cultures1, 0); System.IO.StringWriter tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); System.Text.StringBuilder sb = new System.Text.StringBuilder(string.Empty); sb.Append("<html><head>"); // sb.Append("<meta http-equiv='Content-Type' content='text/html; charset=" + page.Request.ContentEncoding.WebName+ "'>"); sb.Append("</head><body style='font-size: 14; font-family:Arial Unicode MS'>"); // item name sb.Append("<table style='font-size: 14; font-family:Arial Unicode MS' border = '1'>"); // sb.Append("<tr>"); sb.Append("PRODUCTS WITHOUT COMPATIBILITIES REPORT" + "<br>"); sb.Append("Selected " + BUType1.Text + ": " + BizList1 + "<br>"); sb.Append("Selected " + Label2.Text + ": " + Regions1 + "<br>"); sb.Append("Exported On: " + SessionState.User.FormatUtcDate(DateTime.UtcNow, true, "MM/dd/yyyy") + "<br>"); sb.Append("Generated By:" + SessionState.User.FullName + "<br>"); DataTable dt = ds.Tables[0]; sb.Append("</TR>"); #region "Header" DataColumnCollection tableColumns = ds.Tables[0].Columns; DataRowCollection tableRows = ds.Tables[0].Rows; sb.Append("<tr>"); foreach (DataColumn c in tableColumns) { sb.Append("<th>" + c.ColumnName.ToString() + "</th>"); } #endregion foreach (DataRow dr in dt.Rows) { sb.Append("<tr>"); foreach (DataColumn dc in dt.Columns) { sb.Append("<td>" + dr[dc].ToString() + "</td>"); } sb.Append("</tr>"); } sb.Append("</table>"); sb.Append("</body></html>"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.Charset = string.Empty; Response.AddHeader("content-disposition", "attachment;filename=" + "Products_Without_Compatibilities" + ".xls"); Response.ContentType = "application/vnd.ms-excel;"; //page.Response.ContentType = "application/vnd.ms-excel;charset=UTF-8"; //Fix for CR 5109 - Prabhu R S Response.ContentEncoding = System.Text.Encoding.UTF8; //page.Response.AppendHeader("Content-Length", System.Text.Encoding.UTF8.GetByteCount(exportContent).ToString()); EnableViewState = false; Response.Write(sb.ToString()); } // QC777 If the number of rows returned by the dataset is greater than 65536, the report will be generated in CSV format else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows.Count > 65536) { char csvSeparator = ','; string BizList1 = ""; string Regions1 = ""; QMReportsClass objQMReports = new QMReportsClass(); BizList1 = objQMReports.GetSelectedBiz_Reg(1, Biz1, code1); Regions1 = objQMReports.GetSelectedBiz_Reg(0, Cultures1, 0); ListItemCollection lstItemCol = new ListItemCollection(); lstItemCol.Add(new ListItem("Selected " + BUType1.Text + ": " + BizList1 + "")); lstItemCol.Add(new ListItem("Selected " + Label2.Text + ": " + Regions1 + "")); string s = Utils.ExportDataTableToCSVForSpecificReport(ds.Tables[0], csvSeparator.ToString(), lstItemCol, "PRODUCTS WITHOUT COMPATIBILITIES REPORT").ToString(); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] contentBytes = encoding.GetBytes(s); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Accept-Header", contentBytes.Length.ToString()); Response.ContentType = "application/txt"; //Fix for CR 5109 - Prabhu R S Response.ContentEncoding = System.Text.Encoding.UTF8; Response.AppendHeader("Content-Disposition", "attachment;filename=\"Products_Without_Compatibilities.csv\"; " + "size=" + s.Length.ToString() + "; " + "creation-date=" + DateTime.Now.ToString("R") + "; " + "modification-date=" + DateTime.Now.ToString("R") + "; " + "read-date=" + DateTime.Now.ToString("R")); Response.OutputStream.Write( contentBytes, 0, Convert.ToInt32(contentBytes.Length)); Response.Flush(); try { Response.End(); } catch { } } //QC 777 end else { ErrorMsg1.Text = "No Records to be exported"; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + ErrorMsg1.Text + "');", true); //ErrorMsg1.Visible = true; } } } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
protected void btnSubmit_Click(object sender, EventArgs e) { Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString, 1000); ErrorMsg.Visible = false; try { ErrorMsg.Visible = false; QMReportsClass Obj_QMReportsClass = new QMReportsClass(); String Biz = Obj_QMReportsClass.getSelectedValues(BusinessList); if (Biz == null) { ErrorMsg.Text = "Invalid selection"; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + ErrorMsg.Text + "');", true); } DataSet ds4 = new DataSet(); if (this.code == 3) { ds4 = dbObj.RunSPReturnDataSet("Report_GetAccessAttributePl", new SqlParameter("@PLCode", Biz), new SqlParameter("@ShortCode", ddlGeography.SelectedValue)); } else { ds4 = dbObj.RunSPReturnDataSet("Report_GetAccessAttributeOrg", new SqlParameter("@OrgId", Biz), new SqlParameter("@ShortCode", ddlGeography.SelectedValue), new SqlParameter("@Code", this.code)); } if (ds4.Tables[0].Rows.Count > 0) { DataTable objDt = new DataTable(); objDt.Columns.Add(new DataColumn("ProductNumber")); objDt.Columns.Add(new DataColumn("ProductName")); objDt.Columns.Add(new DataColumn("ProductLineNo")); objDt.Columns.Add(new DataColumn("Status")); objDt.Columns.Add(new DataColumn("LiveDate")); objDt.Columns.Add(new DataColumn("ObsoleteDate")); objDt.Columns.Add(new DataColumn(Convert.ToString(ds4.Tables[0].Rows[0]["ContainerName"]))); for (int rowIndex = 1; rowIndex < ds4.Tables[0].Rows.Count; rowIndex++) { string curColumn = ds4.Tables[0].Rows[rowIndex]["ContainerName"].ToString(); if (!objDt.Columns.Contains(curColumn)) { objDt.Columns.Add(new DataColumn(curColumn)); } } for (int i = 0; i < ds4.Tables[0].Rows.Count; i++) { DataRow[] drCol = objDt.Select("ProductNumber='" + ds4.Tables[0].Rows[i]["ProductNumber"].ToString() + "'"); if (drCol.Length > 0) { drCol[0]["ProductNumber"] = ds4.Tables[0].Rows[i]["ProductNumber"]; drCol[0]["ProductName"] = ds4.Tables[0].Rows[i]["ProductName"]; drCol[0]["ProductLineNo"] = ds4.Tables[0].Rows[i]["ProductLineNo"]; drCol[0]["Status"] = ds4.Tables[0].Rows[i]["Status"]; drCol[0]["LiveDate"] = ds4.Tables[0].Rows[i]["LiveDate"]; drCol[0]["ObsoleteDate"] = ds4.Tables[0].Rows[i]["ObsoleteDate"]; drCol[0][ds4.Tables[0].Rows[i]["ContainerName"].ToString()] = ds4.Tables[0].Rows[i]["ChunkValue"]; } else { DataRow newRow = objDt.NewRow(); newRow[0] = ds4.Tables[0].Rows[i]["ProductNumber"].ToString(); newRow[ds4.Tables[0].Rows[i]["ContainerName"].ToString()] = ds4.Tables[0].Rows[i]["ChunkValue"]; objDt.Rows.Add(newRow); } objDt.AcceptChanges(); } System.Text.StringBuilder sb = new System.Text.StringBuilder(string.Empty); sb.Append("<html><head>"); sb.Append("</head><body style='font-size: 14; font-family:Arial Unicode MS'>"); sb.Append("<table style='font-size: 14; font-family:Arial Unicode MS' border = '1'>"); sb.Append("Accessories with Attributes Report" + "<br>"); string BizList = Obj_QMReportsClass.GetSelectedBiz_Reg(1, Biz, code); sb.Append("Selected " + BUType.Text + ": " + BizList + "<br>"); sb.Append("Selected Region :" + ddlGeography.SelectedItem + "<br>"); sb.Append("Exported On: " + SessionState.User.FormatUtcDate(DateTime.UtcNow, true, "MM/dd/yyyy") + "<br>"); sb.Append("Exported By: " + SessionState.User.FullName + "<br>"); sb.Append("</TR>"); #region "Header" DataColumnCollection tableColumns = objDt.Columns; DataRowCollection tableRows = objDt.Rows; sb.Append("<tr>"); foreach (DataColumn c in tableColumns) { sb.Append("<th style='font-size: 14; font-family:Arial Unicode MS'>" + c.ColumnName.ToString() + "</th>"); } #endregion foreach (DataRow dr in objDt.Rows) { sb.Append("<tr>"); foreach (DataColumn dc in objDt.Columns) { sb.Append("<td>" + dr[dc].ToString() + "</td>"); } sb.Append("</tr>"); } sb.Append("</table>"); sb.Append("</body></html>"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.Charset = string.Empty; Response.AddHeader("content-disposition", "attachment;filename=" + "Accessories With Attributes" + ".xls"); Response.ContentType = "application/vnd.ms-excel;"; //Fix for CR 5109 - Prabhu R S Response.ContentEncoding = System.Text.Encoding.UTF8; EnableViewState = false; Response.Write(sb.ToString()); } else { ErrorMsg.Text = "No Records to be exported"; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + ErrorMsg.Text + "');", true); } } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { string InputFormIds = Convert.ToString(Request.QueryString["InputFormIds"]); string BizCode = Convert.ToString(Request.QueryString["BizCode"]); code = Convert.ToString(Request.QueryString["Code"]); string Biz = ""; if (code.Equals("0")) { Biz = "Selected OrgName"; } else if (code.Equals("1")) { Biz = "Selected GroupName"; } else if (code.Equals("2")) { Biz = "Selected GBUName"; } //Label1.Text = Biz+; regionCode = Convert.ToString(Request.QueryString["regionCode"]); DataView dv = new DataView(); Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString); dsItems = dbObj.RunSPReturnDataSet("_Reports_QM_Compute_InputForms_Statistics", new SqlParameter("@_Input_Form_Ids", InputFormIds), new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", code), new SqlParameter("@RegionCode", regionCode)); DataSet dsBizNames = dbObj.RunSPReturnDataSet("_GetSelectedBusinessNames", new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", code)); string BizList = ""; foreach (DataRow r in dsBizNames.Tables[0].Rows) { BizList += r[0].ToString() + ","; } BizList = BizList.Remove(BizList.Length - 1, 1); //Label2.Text = BizList; Label1.Text = Biz + ": " + BizList; Label1.Font.Size = 8; Label1.ForeColor = System.Drawing.Color.DarkSlateGray; Label3.Visible = false; //foreach(dsBizNames.Tables[0].Rows if (dsItems.Tables[0].Rows.Count != 0) { QMReportsClass objQMReports = new QMReportsClass(); objDT = objQMReports.GetInputFormData(dsItems, BizCode, code, regionCode); UltraWebGrid1.DataSource = objDT; UltraWebGrid1.DataBind(); UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.Hierarchical; this.UltraWebGrid1.Height = Unit.Empty; this.UltraWebGrid1.Width = Unit.Empty; if (objDT.Rows.Count != InputFormIds.Split(',').Length) { // Response.Write("Records for some of the InputForms are not available"); Label3.Visible = true; Label3.Text = "Records for some of the InputForms are not available"; Label3.Font.Size = 8; Label3.ForeColor = System.Drawing.Color.DarkSlateGray; } } else { //Response.Write("Records not available for the selected Inputs"); Label1.Text = "Records not available for the selected Inputs"; UltraWebGrid1.Visible = false; btnExport.Visible = false; Label1.Visible = true; } } catch (Exception ex) { // Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('Records not available for the selected input');", true); Response.Write(ex.Message); } } }
protected void Page_Load(object sender, EventArgs e) { //ContainerId=" + contNameId + "&BizName=" + BizName + "&Code="+code+ "®ionCode=" + regionCode); ContainerId = Convert.ToString(Request.QueryString["ContainerId"]); BizCode = Convert.ToString(Request.QueryString["BizCode"]); string Code = Convert.ToString(Request.QueryString["Code"]); this.regionCode = Convert.ToString(Request.QueryString["regionCode"]); try { Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString, 5000); dsContainer = dbObj.RunSPReturnDataSet("_Reports_QM_Compute_Statistics_Single_Container", new SqlParameter("@ContainerId", ContainerId), new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", Code), new SqlParameter("@RegionCode", this.regionCode)); string Biz = ""; if (Code.Equals("0")) { Biz = "Selected OrgName"; } else if (Code.Equals("1")) { Biz = "Selected GroupName"; } else if (Code.Equals("2")) { Biz = "Selected GBUName"; } DataSet dsBizNames = dbObj.RunSPReturnDataSet("_GetSelectedBusinessNames", new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", Code)); string BizList = ""; foreach (DataRow r in dsBizNames.Tables[0].Rows) { BizList += r[0].ToString() + ","; } BizList = BizList.Remove(BizList.Length - 1, 1); //Label2.Text = BizList; Label1.Text = Biz + ": " + BizList; Label1.Font.Size = 8; Label1.ForeColor = System.Drawing.Color.DarkSlateGray; if (dsContainer.Tables[0].Rows.Count != 0) { QMReportsClass objQMReports = new QMReportsClass(); objDT = objQMReports.GetConsolidatedData(dsContainer, this.regionCode); UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.Hierarchical; UltraWebGrid1.DataSource = objDT; UltraWebGrid1.DataBind(); this.UltraWebGrid1.Height = Unit.Empty; this.UltraWebGrid1.Width = Unit.Empty; } else { //Response.Write("Records not available for the selected Inputs"); Label1.Text = "Records not available for the selected Inputs"; UltraWebGrid1.Visible = false; btnExport.Visible = false; Label1.Visible = true; } } catch (Exception ee) { //Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('Records not available for the selected input. Please select Inputs once again ');", true); Response.Write(ee.Message.ToString()); } }
//This method refreshes the ContainerSerach Results protected void refreshContainerSearch() { uwgSearchRes.Visible = false; Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString); if (txtContainer.Text != null) { txtContainer.Text = txtContainer.Text.Trim(); } if (txtContainer.Text.Length != 0) { DataSet dsSearchResult = dbObj.RunSPReturnDataSet("dbo._Reports_QM_ContainerSearch", new SqlParameter[] { new SqlParameter("@InputText", txtContainer.Text.Trim() + "*") }); string contNameId = ""; QMReportsClass objQMReports = new QMReportsClass(); string regionCode = objQMReports.getSelectedValues(LstBoxRegionName); string BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); //OrgCode = OrgCode.Trim(); string url = ""; DataSet dsContainerResults; if (BizCode != null && regionCode != null) { if (dsSearchResult.Tables[0].Rows.Count != 0) { for (int i = 0; i < dsSearchResult.Tables[0].Rows.Count; i++) { contNameId = Convert.ToString(dsSearchResult.Tables[0].Rows[i]["ContainerId"]).Trim(); dsSearchResult.Tables[0].Rows[i]["ContainerName"] = "<a href='QM_SingleContainerReport.aspx?ContainerId=" + contNameId + "&BizCode=" + BizCode + "&Code=" + code + "®ionCode=" + regionCode + "'>" + Convert.ToString(dsSearchResult.Tables[0].Rows[i]["ContainerName"]) + "</a>"; dsSearchResult.AcceptChanges(); uwgSearchRes.DataSource = dsSearchResult; uwgSearchRes.DataBind(); uwgSearchRes.Visible = true; } } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('No Mandatory Containers are found for the search. Please try once again' );", true); uwgSearchRes.Visible = false; } } else { StringBuilder ErrorMessage = new StringBuilder(); if (BizCode == null) { string BizUnit = ""; if (this.code == 0) { BizUnit = "OrgName"; } else if (this.code == 1) { BizUnit = "GroupName"; } else if (this.code == 2) { BizUnit = "GBUName"; } ErrorMessage.Append("Please Select atleast one " + BizUnit + "\\n"); } if (regionCode == null) { ErrorMessage.Append("Please Select atleast one region"); } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + ErrorMessage.ToString() + "' );", true); uwgSearchRes.Visible = false; } } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('Please enter Container Name' );", true); uwgSearchRes.Visible = false; } }
//This method populates the InputForm ListBox protected void populateInputFormLstBox() { rbtnInputForm.Enabled = true; string Biz = ""; Database dbObj = new Database(HyperCatalog.Business.ApplicationSettings.Components["Datawarehouse_DB"].ConnectionString); QMReportsClass objQMReports = new QMReportsClass(); string BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); if (BizCode != null) { DataSet ds = dbObj.RunSPReturnDataSet("dbo._Reports_QM_GetInputFormsByOrganization", new SqlParameter("@BizCode", BizCode), new SqlParameter("@Code", this.code)); if (ds.Tables[0].Rows.Count != 0) { //******************************************************************************* // code added by kanthi.J to shrink the sizeof of the inputform ListBox so that // the ListBox box doesnot display blank space if the rows returned by the dataset is // less than the 15.(180 px can accomodate 14 rows) //******************************************************************************* if (ds.Tables[0].Rows.Count < 15) { lstboxInputFormName.Height = ds.Tables[0].Rows.Count * 13; } else { lstboxInputFormName.Height = Unit.Pixel(180); } lstboxInputFormName.DataSource = ds; lstboxInputFormName.DataValueField = "InputFormId"; lstboxInputFormName.DataTextField = "Name"; lstboxInputFormName.DataBind(); lstboxInputFormName.SelectedIndex = 0; dbObj.CloseConnection(); dbObj.Dispose(); } else { BizCode = objQMReports.getSelectedValues(LstBoxBusinessUnitName); if (code == 0) { Biz = "OrgName"; } else if (code == 1) { Biz = "GroupName"; } else if (code == 2) { Biz = "GBUName"; } StringBuilder sb = new StringBuilder(); sb.Append("alert('No InputForm is available for the selected Input. Please select another " + Biz + "');"); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", sb.ToString(), true); lstboxInputFormName.Items.Clear(); btnNext.Enabled = false; } } else { string BizUnit = ""; if (this.code == 0) { BizUnit = "OrgName"; } else if (this.code == 1) { BizUnit = "GroupName"; } else if (this.code == 2) { BizUnit = "GBUName"; } string ErrorMessage = "Please Select atleast one " + BizUnit; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ClientScript", "alert('" + ErrorMessage + "' );", true); lstboxInputFormName.Items.Clear(); btnNext.Enabled = false; } }