public void Cleanup() { shimsContext?.Dispose(); FixTimes?.Dispose(); DropDownListScheduleType?.Dispose(); DropDownListDays?.Dispose(); DropDownListTime?.Dispose(); LblDomain?.Dispose(); LblMessages?.Dispose(); LblLastRun?.Dispose(); LbOptions?.Dispose(); LbSelections?.Dispose(); Selections?.Dispose(); PnlFieldMappings?.Dispose(); TblFieldMappings?.Dispose(); TxtAreaEntityExclusions?.Dispose(); BtnRunManually?.Dispose(); CheckBoxListDays?.Dispose(); CbDelete?.Dispose(); FrequencyOptions?.Dispose(); adsyncadmin?.Dispose(); SizeLimitTextBox?.Dispose(); }
public void Build(IList <ManagementIndicatorsDetail> details, Table tabla, string fullName, string letter) { //cabecera TableRow tblRowEvaluated = new TableRow(); TableCell tblCellEvaluated = new TableCell(); TableRow tblRowHeader = new TableRow(); TableCell tblCell1 = new TableCell(); TableCell tblCell2 = new TableCell(); TableCell tblCell3 = new TableCell(); TableCell tblCell4 = new TableCell(); tblCellEvaluated.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(fullName.Trim().ToLower()); tblCellEvaluated.ColumnSpan = 4; tblCellEvaluated.Attributes.Add("class", "td01"); tblRowEvaluated.Cells.Add(tblCellEvaluated); tabla.Rows.Add(tblRowEvaluated); tblCellEvaluated.Dispose(); tblRowEvaluated.Dispose(); tblRowHeader.Attributes.Add("class", "td03"); tblCell1.Attributes.Add("width", "68%"); tblCell1.Text = "Descripción"; tblCell2.Text = "Ponderación 100%"; tblCell3.Text = "Unidad de Medida"; tblCell4.Text = "Resultado Logrado %"; tblRowHeader.Cells.AddRange(new TableCell[] { tblCell1, tblCell2, tblCell3, tblCell4 }); tabla.Rows.Add(tblRowHeader); tblCell1.Dispose(); tblCell2.Dispose(); tblCell3.Dispose(); tblCell4.Dispose(); tblRowHeader.Dispose(); //fin cabecera //Filas comienzo int rowId = 0; foreach (ManagementIndicatorsDetail d in details) { TableRow tblRow = new TableRow(); for (int i = 1; i < 5; i++) { bool resultOnly = !(d.Code == 0); TableCell tblCell = new TableCell(); switch (i) { case 1: if (d.Status == "true" && d.Code == 0) { TextBox txtDescription = new TextBox(); txtDescription.Text = d.Properties[i].ToString(); txtDescription.Attributes["firstLine"] = (d == details[0]).ToString(); txtDescription.Attributes["class"] = "text1 d"; txtDescription.Attributes["onkeypress"] = "k(event)"; txtDescription.Attributes["onpaste"] = "k(event)"; txtDescription.Attributes["onblur"] = "b(this)"; txtDescription.Attributes["onfocus"] = "f(this)"; HttpResponse myHttpReponse = Response; HtmlTextWriter myHtmlTextWriter = new HtmlTextWriter(myHttpReponse.Output); txtDescription.Attributes.AddAttributes(myHtmlTextWriter); tblCell.Attributes.Add("class", "td02r"); txtDescription.ID = ""; txtDescription.Width = Unit.Percentage(98); txtDescription.Height = 18; txtDescription.SkinID = i.ToString() + "_" + d.NetworkAssessmentId.ToString() + "_" + d.ResultVariableId.ToString(); tblCell.Controls.Add(txtDescription); txtDescription.Dispose(); } else { tblCell.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.Properties[i].ToString().Trim().ToLower()); tblCell.Attributes.Add("class", "td02"); }; break; case 2: if (d.Status == "true" && d.Code == 0) { TextBox txtWeight = new TextBox(); txtWeight.Text = (d.Properties[i].ToString() == "0") ? string.Empty: d.Properties[i].ToString(); txtWeight.Attributes["class"] = "textbox w"; txtWeight.Attributes["firstLine"] = (d == details[0]).ToString(); txtWeight.Attributes["onkeypress"] = "k(event)"; txtWeight.Attributes["onblur"] = "b(this)"; txtWeight.Attributes["onfocus"] = "f(this)"; HttpResponse myHttpReponse = Response; HtmlTextWriter myHtmlTextWriter = new HtmlTextWriter(myHttpReponse.Output); txtWeight.Attributes.AddAttributes(myHtmlTextWriter); tblCell.Attributes.Add("class", "td02r"); txtWeight.ID = ""; txtWeight.Width = Unit.Percentage(95); txtWeight.Height = 18; txtWeight.SkinID = i.ToString() + "_" + d.NetworkAssessmentId.ToString() + "_" + d.ResultVariableId.ToString(); tblCell.Controls.Add(txtWeight); txtWeight.Dispose(); } else { tblCell.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.Properties[i].ToString().Trim().ToLower()); tblCell.Attributes.Add("class", "tdr"); }; break; case 4: if (d.Status == "true") { TextBox txtValue = new TextBox(); txtValue.Text = (d.Properties[i].ToString() == "0") ? string.Empty : d.Properties[i].ToString(); txtValue.Attributes["firstLine"] = (d == details[0]).ToString(); txtValue.Attributes["resultOnly"] = resultOnly.ToString(); txtValue.Attributes["class"] = "textbox v"; txtValue.Attributes["onkeypress"] = "return k(event)"; txtValue.Attributes["onblur"] = "b(this)"; txtValue.Attributes["onfocus"] = "f(this)"; HttpResponse myHttpReponse = Response; HtmlTextWriter myHtmlTextWriter = new HtmlTextWriter(myHttpReponse.Output); txtValue.Attributes.AddAttributes(myHtmlTextWriter); tblCell.Attributes.Add("class", "td02r"); txtValue.ID = ""; txtValue.Width = Unit.Percentage(95); txtValue.Height = 18; txtValue.SkinID = i.ToString() + "_" + d.NetworkAssessmentId.ToString() + "_" + d.ResultVariableId.ToString(); tblCell.Controls.Add(txtValue); txtValue.Dispose(); } else { tblCell.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.Properties[i].ToString().Trim().ToLower()); tblCell.Attributes.Add("class", "tdr"); if (group8) { tblCell.BackColor = System.Drawing.Color.Gray; tblCell.ForeColor = System.Drawing.Color.Gray; } }; break; default: tblCell.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.Properties[i].ToString().Trim().ToLower()); tblCell.Attributes.Add("class", "td02c"); break; } tblRow.Cells.Add(tblCell); tblCell.Dispose(); } tabla.Rows.Add(tblRow); tblRow.Dispose(); rowId++; } //Fin Filas //arma pie y el separador/ TableRow tblRowFoot = new TableRow(); TableCell tblCellFoot1 = new TableCell(); TableCell tblCellFoot2 = new TableCell(); HiddenField txtLetter = new HiddenField(); tblCellFoot1.Text = "Resultado obtenido:"; tblCellFoot1.Attributes.Add("class", "textor"); tblCellFoot1.ColumnSpan = 3; tblCellFoot2.Text = letter.Split('_')[0]; if (group8) { tblCellFoot2.Text = "D"; tblCellFoot2.BackColor = System.Drawing.Color.Gray; tblCellFoot2.ForeColor = System.Drawing.Color.Gray; } txtLetter.Value = letter; txtLetter.ID = tabla.ID + "_l"; this.Controls.Add(txtLetter); tblCellFoot2.Attributes.Add("class", "td03"); tblRowFoot.Cells.AddRange(new TableCell[] { tblCellFoot1, tblCellFoot2 }); tabla.Rows.Add(tblRowFoot); tblCellFoot1.Dispose(); tblCellFoot2.Dispose(); txtLetter.Dispose(); tblRowFoot.Dispose(); TableRow tblRowSeparator = new TableRow(); TableCell tblCellSeparator = new TableCell(); tblCellSeparator.Text = " "; tblRowSeparator.Cells.Add(tblCellSeparator); tabla.Rows.Add(tblRowSeparator); tblCellSeparator.Dispose(); tblRowSeparator.Dispose(); //fin arma pie }
private void SaveMI() { bool exit = false; string description = string.Empty; decimal weight = 0; decimal result = 0; decimal _total = 0; string assessment = string.Empty; bool _delete = false; string _letter = string.Empty; CultureInfo ci = new CultureInfo("es-AR"); string separator = ci.NumberFormat.NumberDecimalSeparator; for (int i = 0; !exit; i++) { Control answer = (Control)this.Master.FindControl("CPH").FindControl("MI").FindControl("ctl" + i.ToString("00")); exit = answer == null; if (!exit) { if (answer.GetType().ToString() == "System.Web.UI.WebControls.TextBox") { TextBox myControl = (TextBox)answer; string[] values = myControl.SkinID.ToUpper().Split('_'); switch (values[0]) { case "1": description = myControl.Text.ToString(); break; case "2": weight = (myControl.Text.ToString() == string.Empty) ? 0 : Convert.ToDecimal(myControl.Text); break; case "4": _delete = (bool)(assessment != values[1]); if (_delete) { HiddenField letter = (HiddenField)this.Master.FindControl("CPH").FindControl("MI").FindControl(myControl.Parent.Parent.Parent.ID + "_l"); string[] _values = letter.Value.Trim().Split('_'); if (_values.Length != 1) { _letter = _values[0]; _total = Convert.ToDecimal(_values[1].Replace('.', Convert.ToChar(separator))); } else { _letter = string.Empty; _total = 0; } letter.Dispose(); } assessment = values[1]; result = (myControl.Text.ToString() == string.Empty) ? 0 : Convert.ToDecimal(myControl.Text); SQLHelper.ExecuteNonQuery(Cache["ApplicationDatabase"].ToString(), "SaveResultVariable", new object[] { values[1], 1, values[2], description, weight, result, _letter, _total, _delete }); description = string.Empty; weight = 0; result = 0; break; } myControl.Dispose(); } answer.Dispose(); } } }