public static void Export(DetailsView dvGetStudent) { int rows = dvGetStudent.Rows.Count; int columns = dvGetStudent.Rows[0].Cells.Count; int pdfTableRows = rows; iTextSharp.text.Table PdfTable = new iTextSharp.text.Table(2, pdfTableRows); PdfTable.BorderWidth = 1; PdfTable.Cellpadding = 0; PdfTable.Cellspacing = 0; for (int rowCounter = 0; rowCounter < rows; rowCounter++) { for (int columnCounter = 0; columnCounter < columns; columnCounter++) { string strValue = dvGetStudent.Rows[rowCounter].Cells[columnCounter].Text; PdfTable.AddCell(strValue); } } Document Doc = new Document(); PdfWriter.GetInstance(Doc, HttpContext.Current.Response.OutputStream); Doc.Open(); Doc.Add(PdfTable); Doc.Close(); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=StudentDetails.pdf"); HttpContext.Current.Response.End(); }
public static void Export(DetailsView dvGetStudent, string imageFilePath, string filename) { int rows = dvGetStudent.Rows.Count; int columns = dvGetStudent.Rows[0].Cells.Count; int pdfTableRows = rows - 1; iTextSharp.text.Table PdfTable = new iTextSharp.text.Table(2, pdfTableRows); //PdfTable.BorderWidth = 1; PdfTable.Cellpadding = 0; PdfTable.Cellspacing = 0; iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath); jpg.Alignment = Element.ALIGN_CENTER; jpg.ScaleToFit(150f, 150f); string fontUrl = System.AppDomain.CurrentDomain.BaseDirectory + "Files\\arial.ttf"; BaseFont STF_Helvetica_Russian = BaseFont.CreateFont(fontUrl, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); Font font = new Font(STF_Helvetica_Russian, Font.DEFAULTSIZE, Font.NORMAL); for (int rowCounter = 1; rowCounter < rows; rowCounter++) { for (int columnCounter = 0; columnCounter < columns; columnCounter++) { string strValue = dvGetStudent.Rows[rowCounter].Cells[columnCounter].Text; PdfTable.AddCell(new Paragraph(strValue, font)); } } Document Doc = new Document(); PdfWriter.GetInstance(Doc, HttpContext.Current.Response.OutputStream); Doc.Open(); Doc.Add(jpg); Doc.Add(PdfTable); Doc.Close(); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + filename + ".pdf"); HttpContext.Current.Response.End(); }
protected void myItemUpdated(object sender, DetailsViewUpdatedEventArgs e) { System.Web.UI.WebControls.DetailsView detailsView = sender as System.Web.UI.WebControls.DetailsView; Obout.Ajax.UI.FileUpload.FileUpload fileUpload = detailsView.FindControl("fileUpload1") as Obout.Ajax.UI.FileUpload.FileUpload; if (fileUpload != null) { if (fileUpload.PostedFiles.Count > 0) { string result = ""; foreach (PostedFileInfo info in fileUpload.PostedFiles) { // Here you can place the code to save uploaded files // if (result.Length == 0) { result = "<b>Uploaded files:</b><br><br>"; result += "<table border='0' cellspacing='2' cellpadding='2'>"; result += "<tr><td style='font-weight: bold; text-align:left;'>File name</td><td style='font-weight: bold; text-align:left;'>Length</td><td style='font-weight: bold; text-align:left;'>Content type</td></tr>"; } result += "<tr><td style='text-align:left;'>" + info.FileName + "</td><td style='text-align:left;'>" + info.ContentLength.ToString() + "</td><td style='text-align:left;'>" + info.ContentType + "</td></tr>"; } if (result.Length == 0) { result = "No files uploaded"; } else { result += "</table>"; } label.Text = result; } } }
protected string CoalesceBadges(DetailsView dv) { var gv = (GridView)dv.FindControl("gvBadgeMembership"); string badgesList= string.Empty; foreach(GridViewRow row in gv.Rows) { if(((CheckBox)row.FindControl("isMember")).Checked) { badgesList = string.Format("{0},{1}", badgesList, ((Label)row.FindControl("BID")).Text); } } if(badgesList.Length > 0) badgesList = badgesList.Substring(1, badgesList.Length - 1); return badgesList; }
public void SetDataObject(object dataObject, DetailsView detailsView) { DataObject = dataObject; TypeDescriptionProvider typeDescriptionProvider; CustomTypeDescriptor = dataObject as ICustomTypeDescriptor; Type dataObjectType; if (CustomTypeDescriptor == null) { dataObjectType = dataObject.GetType(); typeDescriptionProvider = TypeDescriptor.GetProvider(DataObject); CustomTypeDescriptor = typeDescriptionProvider.GetTypeDescriptor(DataObject); } else { dataObjectType = GetEntityType(); typeDescriptionProvider = new TrivialTypeDescriptionProvider(CustomTypeDescriptor); } // Set the context type and entity set name on ourselves. Note that in this scenario those // concepts are somewhat artificial, since we don't have a real context. // Set the ContextType to the dataObjectType, which is a bit strange but harmless Type contextType = dataObjectType; ((IDynamicDataSource)this).ContextType = contextType; // We can set the entity set name to anything, but using the // DataObjectType makes some Dynamic Data error messages clearer. ((IDynamicDataSource)this).EntitySetName = dataObjectType.Name; MetaModel model = null; try { model = MetaModel.GetModel(contextType); } catch { model = new MetaModel(); model.RegisterContext( new SimpleModelProvider(contextType, dataObjectType, dataObject), new ContextConfiguration() { MetadataProviderFactory = (type => typeDescriptionProvider) }); } MetaTable table = model.GetTable(dataObjectType); if (detailsView != null) { detailsView.RowsGenerator = new AdvancedFieldGenerator(table, false); } }
private bool ShouldGenerateField(Type propertyType, DetailsView detailsView) { if (detailsView.RenderingCompatibility < VersionUtil.Framework45 && AutoGenerateEnumFields == null) { //This is for backward compatibility. Before 4.5, auto generating fields used to call into this method //and if someone has overriden this method to force generation of columns, the scenario should still //work. return(detailsView.IsBindableType(propertyType)); } else { //If AutoGenerateEnumFileds is null here, the rendering compatibility must be 4.5 return(DataBoundControlHelper.IsBindableType(propertyType, enableEnums: AutoGenerateEnumFields ?? true)); } }
protected void grid_SelectedIndexChanged(Object sender, EventArgs e) { DetailsView details = new DetailsView(); GridViewRow selectedRow = grid.SelectedRow; String title_id = selectedRow.Cells[1].Text; SqlCommand cmd = new SqlCommand("SELECT * from titles where titles.title_id='"+title_id+"';", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); details.DataSource = ds; details.DataBind(); details.Visible = true; details.CssClass = "table table-striped table-hover"; PlaceHolder3.Controls.Add(details); }
protected override void CreateChildControls() { _detailsView = new DetailsView { ID = string.Format("{0}_detailsView", base.ID), AutoGenerateRows = false, AllowPaging = true }; //Set Paging Events _detailsView.PageIndexChanging += DetailsView_PageIndexChanging; //Create Custom Field var customField = new TemplateField { HeaderTemplate = new SetTemplate(DataControlRowType.Header, "Name"), ItemTemplate = new SetTemplate(DataControlRowType.DataRow) }; //Add custom field to detailsview field _detailsView.Fields.Add(customField); //Create Bound Field var boundField = new BoundField { DataField = "PhoneNumber", HeaderText = "Phone Number", }; //Set header font to bold boundField.HeaderStyle.Font.Bold = true; //Add bound field to detailsview field _detailsView.Fields.Add(boundField); //Bind Details View DetailsView_DataBind(); //Add detaisview to composite control Controls.Add(_detailsView); }
/// <summary> /// Localizes headers and fields on a DetailsView control /// </summary> /// <param name="detailsView"></param> /// <param name="resourceFile">The root name of the resource file where the localized /// texts can be found</param> /// <remarks></remarks> public static void LocalizeDetailsView(ref DetailsView detailsView, string resourceFile) { foreach (DataControlField field in detailsView.Fields) { LocalizeDataControlField(field, resourceFile); } }
public string strCrearDocumentoExcelDetalleGrilla(DetailsView objDetailView, int intIdCodAppR) { string docHtmlExcel = ""; #region Definicion de Tipo y Caracteristicas del Documento const string strDEFDOC = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + "<html xmlns=\"http://www.w3.org/1999/xhtml\">" + "<head>" + "<title> Reporte para Exportar a Excel</title>"; #endregion #region Definir Hoja de Estilos Dinamica const string strSTYLECSS = "<style type=\"text/css\">" + "a " + "{ " + " text-align:left; " + " font-size:11.0pt;" + " font-weight:400; " + " font-style:normal;" + " text-decoration:none; " + " font-family:Calibri, sans-serif; " + " }" + ".style0 " + " {" + " vertical-align:bottom;" + " white-space:nowrap; " + " color:black; " + " font-size:11.0pt;" + " font-weight:400; " + " font-style:normal;" + " text-decoration:none; " + " font-family:Calibri, Tahoma; " + " border:none; " + " }" + ".font12 " + " {color:black;" + " font-size:8.0pt; " + " font-weight:400; " + " font-style:normal;" + " text-decoration:none; " + " font-family:Calibri, Tahoma, Courier New;" + " }" + ".font13 " + " {color:black;" + " font-size:8.0pt; " + " font-weight:700; " + " font-style:normal;" + " text-decoration:none; " + " font-family:Calibri, Tahoma, Courier New;" + " }" + "td" + " {" + " padding:0px; " + " color:black; " + " font-size:11.0pt;" + " font-weight:400; " + " font-style:normal;" + " text-decoration:none; " + " font-family:Calibri, sans-serif; " + " vertical-align:bottom;" + " border:none; " + " white-space:nowrap; " + " }" + ".columna1 " + " {" + " font-size:8.0pt; " + " font-family:Calibri, Arial;" + " }" + ".TituloTabla " + " {" + " font-size:8.0pt; " + " font-weight:700; " + " font-family:Calibri, Arial;" + " text-align:center;" + " border:.5pt solid windowtext;" + " background:#E26B0A; " + " white-space:normal;}" + ".ComentarioTituloTabla " + " {" + " font-size:8.0pt; " + " font-weight:700; " + " font-family:Calibri, Arial;" + " text-align:center;" + " border:.5pt solid windowtext;" + " background:#E26B0A; " + " color:Yellow;}" + ".DatosTablaReq " + " {" + " font-size:8.0pt; " + " font-family:Calibri, Arial;" + " text-align:center;" + " border:.5pt solid windowtext;} " + ".ParrafoEntreTablas " + " {" + " font-size:8.0pt; " + " font-family:Calibri, Arial;" + " text-align:center;} " + ".DatosTablaNotificaciones " + " {" + " font-size:8.0pt; " + " font-family:Calibri, Arial;" + " border:.5pt solid windowtext;" + " text-align:left;" + " } " + ".TituloEjecuciones " + " {" + " color:white; " + " font-size:10.0pt;" + " font-weight:700; " + " font-style:italic;" + " font-family:Calibri, Arial;" + " text-align:center;" + " background:navy; " + " }" + ".DatosMonitoreo " + " {" + " font-size:8.0pt;" + " font-family:Courier New;" + " border:.5pt solid windowtext;" + " background:#EEECE1; " + " }" + ".EjecucionJob " + " {" + " color:windowtext;" + " font-size:8.0pt;" + " font-family:Courier New;" + " border:.5pt solid windowtext;} " + ".ObservacionMonitoreo " + " {" + " color:navy;" + " font-size:10.0pt;" + " font-family:Calibri, Courier New;" + " text-align:left; " + " vertical-align:top; " + " border:.5pt solid windowtext;" + " background:#BFBFBF; " + " }" + "</style>"; #endregion #region Definicion de variables Header const string quote = "\""; const string barraI = "\\"; string nombreDocumento = "CDS - Infraestructura: " + DateTime.Now.ToString(); const string nombreTitulo = "FORMATO PARA EL SEGUIMIENTO DE LAS RUTINAS Y/O SERVICIOS EN CERTIFICACION"; const string comentarioDatoObligatorio = "(*) : Dato obligatorio"; string strNroSN = objDetailView.Rows[5].Cells[1].Text; //strNroSN string strNroST = objDetailView.Rows[6].Cells[1].Text; //strNroST string strCodApp = objDetailView.Rows[2].Cells[1].Text; //strCodAplicativo string strNroTicket = objDetailView.Rows[7].Cells[1].Text; //strNroTicket string strCiclo = "1"; string strFechaInicio = objDetailView.Rows[21].Cells[1].Text; //dateFechaInicio string strFechaFin = objDetailView.Rows[22].Cells[1].Text; //dateFechaFin string strJAC = objDetailView.Rows[10].Cells[1].Text; //strJAC string strSupCSW = objDetailView.Rows[11].Cells[1].Text; //strSupervisorCSW string strCSW = objDetailView.Rows[12].Cells[1].Text; //strCertificador string strNotificacionNro = ""; string strNotificacionNombre = ""; string strNotificacionCorreo = ""; string strObservacionMonitoreo = objDetailView.Rows[4].Cells[1].Text; //strObservacionMonitoreo string strNombreJobTransaccion = ""; string strJDE = ""; string strSoporteAsignado = ""; string strGrupoServiceDesk = ""; string strCertificador = ""; string strMallaServidorBD = ""; string strCodAplicativo = ""; string strJobName = ""; string strCompCode = ""; string strExecQTime = ""; string strFechaEjecucion = ""; #endregion #region Definir Seccion 1 Cabecera SeccionHeadCabecera string SeccionHeadCabecera = "</head>" + "<body link=\"blue\" vlink=\"purple\">" + "<table border=\"0\"\" cellpadding=\"0\" cellspacing=\"0\"> " + "<col width=\"80\" /> " + "<col width=\"150\" />" + "<col width=\"150\" /> " + "<col width=\"300\" />" + "<col width=\"141\" />" + "<col width=\"150\" /> " + "<col width=\"150\" /> " + "<col width=\"150\" /> " + "<col width=\"200\" span=\"3\" />" + "<tr> " + "<td class=\"columna1\" colspan=\"2\"> " + nombreDocumento + " </td>" + "</tr>" + "<tr> " + "<td class=\"xl1565\"colspan=\"7\">" + nombreTitulo + "</td>" + "</tr>" + "<tr> " + "<td class=\"columna1\" colspan=\"2\"> " + comentarioDatoObligatorio + " </td>" + "</tr>"; #endregion #region Seccion 2 Titulos Tabla "Requerimiento" string TitulosTablaReq = "<tr>" + "<td></td>" + "<td class=\"TituloTabla\">N° SN (*) " + "<span class=\"ComentarioTituloTabla\"><a>[1]</a></span>" + "</td>" + "<td class=\"TituloTabla\">N° ST (*) " + "<span class=\"ComentarioTituloTabla\"><a>[2]</a> </span>" + "</td> " + "<td class=\"TituloTabla\"> CODIGO DEL APLICATIVO (*) " + "<span class=\"ComentarioTituloTabla\"> <a>[3]</a> </span> " + "</td>" + "<td class=\"TituloTabla\" >N° TICKET (* ) " + "<span class=\"ComentarioTituloTabla\"> <a>[4]</a> </span> " + "</td>" + "</tr>"; #endregion #region Seccion 2 Datos Tabla "Requerimiento" string DatosTablaReq = "<tr>" + "<td></td>" + "<td class=\"DatosTablaReq\"\">" + strNroSN + "</td>" + "<td class=\"DatosTablaReq\"\">" + strNroST + " </td> " + "<td class=\"DatosTablaReq\"\">" + strCodApp + "</td> " + "<td class=\"DatosTablaReq\">" + strNroTicket + "</td>" + "</tr>"; #endregion #region Definir Espacio Entre Tablas "ParrafoEntreTabla" string ParrafoEntreTabla = "<tr> " + "<td></td>" + "<td></td> " + "<td></td> " + "<td></td> " + "<td></td> " + "</tr>"; #endregion #region Seccion 3 Titulos Tabla "Ciclos" string TitulosTablaCiclos = "<tr> " + "<td></td>" + "<td class=\"TituloTabla\"> CICLO (*) <span class=\"ComentarioTituloTabla\"><a>[5]</a></span></td>" + "<td class=\"TituloTabla\">FECHA DE INICIO (*) <span class=\"ComentarioTituloTabla\"><a>[6]</a></span></td>" + "<td class=\"TituloTabla\">FECHA DE FIN (*) <span class=\"ComentarioTituloTabla\"><a>[7]</a></span></td>" + "<td> </td> " + "</tr>"; #endregion #region Seccion 3 Datos Tabla "Ciclos" string DatosTablaCiclos = "<tr> " + "<td ></td> " + "<td class=\"DatosTablaReq\"\">" + strCiclo + "</td>" + "<td class=\"DatosTablaReq\"> " + String.Format("{0:dd/MM/yyyy}", DateTime.Parse(strFechaInicio)) + "</td>" + "<td class=\"DatosTablaReq\">" + String.Format("{0:dd/MM/yyyy}", DateTime.Parse(strFechaFin)) + "</td>" + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>" + "<tr>" + "<td></td> " + "<td class=\"DatosTablaReq\"\" >2</td> " + "<td class=\"DatosTablaReq\" > </td> " + "<td class=\"DatosTablaReq\" > </td> " + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>" + "<tr>" + "<td></td> " + "<td class=\"DatosTablaReq\"\" >3</td> " + "<td class=\"DatosTablaReq\" > </td> " + "<td class=\"DatosTablaReq\" > </td> " + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>"; #endregion #region Seccion 4 Titulos Tabla "Certificacion" string TitulosTablaCertificacion = "<tr>" + "<td></td> " + "<td class=\"TituloTabla\"> JEFE DE ANALISTAS CDS <span class=\"ComentarioTituloTabla\"><a>[8]</a></span></td>" + "<td class=\"TituloTabla\"> SUPERVISOR CSW <span class=\"ComentarioTituloTabla\"><a>[9]</a></span></td>" + "<td class=\"TituloTabla\"> CERTIFICADOR <span class=\"ComentarioTituloTabla\"><a>[10]</a></span></td>" + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>"; #endregion #region Seccion 4 Datos Tabla "Certificacion" string DatosTablaCertificacion = "<tr>" + "<td></td> " + "<td class=\"DatosTablaReq\" > " + strJAC + "</td>" + "<td class=\"DatosTablaReq\" >" + strSupCSW + "</td>" + "<td class=\"DatosTablaReq\" >" + strCSW + "</td>" + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>"; #endregion #region Seccion 5 Titulos Tabla "Notificacion" string TitulosTablaNotificacion = "<tr>" + "<td></td> " + "<td colspan=\"3\" class=\"TituloTabla\">Personas y/o equipos a recibir el informe de monitoreo <span class=\"ComentarioTituloTabla\"><a>[11]</a></span></td>" + "</tr>" + "<tr>" + "<td></td> " + "<td class=\"TituloTabla\" >Nro</td> " + "<td class=\"TituloTabla\" >Nombre de Persona</td> " + "<td class=\"TituloTabla\" >Correo</td> " + "<td></td> " + "</tr>"; #endregion //Revisar StoreProcedure #region Seccion 5 Datos Tabla "Notificacion" cMonitoreoAplicativo objMonitoreoAplicativo = new cMonitoreoAplicativo(); List<cMonitoreoAplicativo.cMonitoreoRequerimientoNotificacion> objListaNotificaciones = new List<cMonitoreoAplicativo.cMonitoreoRequerimientoNotificacion>(); objListaNotificaciones = objMonitoreoAplicativo.cUtilIdListaNotificacionesRequerimiento(intIdCodAppR); string DatosTablaNotificacion = ""; int seq = 1; for (int i = 0; i < objListaNotificaciones.Count; i++) { DatosTablaNotificacion += "<tr>" + "<td></td> " + "<td class=\"DatosTablaReq\" > " + seq.ToString() + "</td>" + "<td class=\"DatosTablaNotificaciones\" >" + objListaNotificaciones[i].strNombreNotificacion + "</td>" + "<td class=\"DatosTablaNotificaciones\" >" + objListaNotificaciones[i].strCorreoNotificacion + "</td>" + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>"; seq++; } #endregion #region Seccion 6 Titulos Tabla "Unidades" string TitulosTablaUnidades = "<tr>" + "<td></td> " + "<td colspan=\"4\" class=\"TituloTabla\">UNIDADES IMPACTADAS</td> " + "<td></td>" + "</tr>" + "<tr>" + "<td ></td> " + "<td class=\"TituloTabla\"> PROVEEDOR (*) </td>" + "<td class=\"TituloTabla\"> CODIGO APLICATIVO (*) </td>" + "<td class=\"TituloTabla\"> NOMBRE DEL APLICATIVO (*) </td>" + "<td class=\"TituloTabla\"> JDE (*) </td>" + "<td></td>" + "</tr>"; #endregion #region Seccion 6 Datos Tabla "Unidades" //cMonitoreoAplicativo objMonitoreoAplicativo = new cMonitoreoAplicativo(); List<cMonitoreoAplicativo.cMonitoreoRequerimientoUnidadesImpactadas> objListaUnidades = new List<cMonitoreoAplicativo.cMonitoreoRequerimientoUnidadesImpactadas>(); objListaUnidades = objMonitoreoAplicativo.cUtilIdListaUnidadesRequerimiento(intIdCodAppR); string DatosTablaUnidades = ""; int seq1 = 1; for (int i = 0; i < objListaUnidades.Count; i++) { DatosTablaUnidades += "<tr>" + "<td></td> " + "<td class=\"DatosTablaReq\" > " + objListaUnidades[i].strEmpresaResponsable + "</td>" + "<td class=\"DatosTablaNotificaciones\" >" + objListaUnidades[i].strCodAplicativo + "</td>" + "<td class=\"DatosTablaNotificaciones\" >" + objListaUnidades[i].strNombreAplicativo + "</td>" + "<td class=\"DatosTablaNotificaciones\" >" + objListaUnidades[i].strJefeDeEquipo + "</td>" + "<td class=\"ParrafoEntreTablas\"></td> " + "</tr>"; seq1++; } #endregion #region Seccion 7 Titulos Tabla "ComentariosMonitoreo" string ComentariosMonitoreo = "<tr>" + "<td></td> " + "<td></td>" + "<td></td>" + "<td></td>" + "<td></td>" + "<td></td>" + "<td></td> " + "<td></td>" + "<td></td>" + "<td></td>" + "</tr>"; //"<tr>" + //"<td></td> " + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[11]</a></span></td>" + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[12]</a></span></td>" + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[13]</a></span></td>" + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[14]</a></span></td>" + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[15]</a></span></td>" + // "<td></td> " + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[16]</a></span></td>" + // "<td><span class=\"ComentarioTituloTabla\">" + "<a>[17]</a></span></td>" + //"<td></td>" + //"</tr>"; #endregion #region Seccion 7 Titulos Tabla "ObservacionProcesoMonitoreo" string ObservacionMonitoreo = "<tr style=\"background:#BFBFBF\">" + "<td style=\"background-color:White\";></td>" + "<td colspan=\"8\" class=\"ObservacionMonitoreo\"> " + strObservacionMonitoreo + "</td>" + "</tr>"; #endregion #region Seccion 8 Titulos Tabla "Monitoreo" string TitulosTablaMonitoreo = "<tr>" + "<td></td> " + "<td class=\"TituloTabla\"> EMPRESA (*) <span class=\"ComentarioTituloTabla\">" + "<a>[11]</a></span></td>" + "<td class=\"TituloTabla\"> JEFE EQUIPO (*) <span class=\"ComentarioTituloTabla\">" + "<a>[12]</a></span></td> " + "<td class=\"TituloTabla\"> AT / AP / OE Soporte (*) <span class=\"ComentarioTituloTabla\">" + "<a>[13]</a></span><span class=\"ComentarioTituloTabla\"> <a>[18]</a></span></td>" + "<td class=\"TituloTabla\"> Grupo de ServiceDesk <span class=\"ComentarioTituloTabla\">" + "<a>[14]</a></span></td> " + "<td class=\"TituloTabla\"> REVISOR / CERTIFICADOR (*) <span class=\"ComentarioTituloTabla\">" + "<a>[15]</a></span></td> " + "<td class=\"TituloTabla\"> JOB o SERVICIO (*)</td> " + "<td class=\"TituloTabla\"> SERVIDOR / BD / MALLA SCHEDULER (*) <span class=\"ComentarioTituloTabla\">" + "<a>[16]</a></span></td> " + "<td class=\"TituloTabla\"> COD APLICATIVO (*) <span class=\"ComentarioTituloTabla\">" + "<a>[17]</a></span></td> "; #endregion #region Seccion 10 Datos Tabla "Monitoreo" #region Obtener Lista de Jobs y Ejecucion List<cMonitoreoAplicativo.cMonitoreoRequerimientoJobsYEjecucion> objListaJobYEjecucion = new List<cMonitoreoAplicativo.cMonitoreoRequerimientoJobsYEjecucion>(); objListaJobYEjecucion = objMonitoreoAplicativo.cUtilIdListaDetalladaJobMonitoreadoRequerimiento(intIdCodAppR); string DatosTablaMonitoreo = ""; #region Seccion 9 Titulo Tabla "Ejecucion" string TituloTablaEjecuciones = "<td class=\"TituloEjecuciones\">" + objListaJobYEjecucion[0].dateFechaEjecucion.Substring(0,5) + " " + objListaJobYEjecucion[0].dateFechaEjecucion.Substring(5,5) + " </td>" + //"<td class=\"TituloEjecuciones\">02-jun</td>" + //"<td class=\"TituloEjecuciones\">03-jun</td>" + "</tr>"; #endregion for (int i = 0; i < objListaJobYEjecucion.Count; i++) { DatosTablaMonitoreo += "<tr>" + "<td></td> " + "<td class=\"DatosMonitoreo\"> " + objListaJobYEjecucion[i].strEmpresa + "</td>" + "<td class=\"DatosMonitoreo\"> " + objListaJobYEjecucion[i].strJDE + "</td>" + "<td class=\"DatosMonitoreo\"> " + objListaJobYEjecucion[i].strSoporteAsignado + "</td>" + "<td class=\"DatosMonitoreo\"> " + objListaJobYEjecucion[i].strGrupoServiceDesk + "</td>" + "<td class=\"DatosMonitoreo\"> " + objListaJobYEjecucion[i].strCertificador + "</td>" + "<td class=\"DatosMonitoreo\">" + objListaJobYEjecucion[i].strNombreJobTransaccion + "</td>" + "<td class=\"DatosMonitoreo\">" + objListaJobYEjecucion[i].strMallaServidorBD + "</td>" + "<td class=\"DatosMonitoreo\"> " + objListaJobYEjecucion[i].strCodAplicativo + "</td>" + "<td class=\"EjecucionJob\"> " + objListaJobYEjecucion[i].dateFechaEjecucion + "<span style=\"color:Red\"> COMPCODE: </span>" + objListaJobYEjecucion[i].strCompCode + " </td>" + "<td class=\"EjecucionJob\"> </td> " + "</tr>"; } #endregion #endregion #region Definir Pie de Pagina "strFOOTER" const string strFOOTER = "<hr/> " + "<div> <div> <div><a>[1]</a><div><font class=\"font12\">Idem al registrado en la Hoja de Compromiso<br /> " + "Cuando no se tenga SN o ST o TK asociado se debe de colocar SN99999999</font></div></div></div></div>" + "<div><div><div><a>[2]</a><div><font class=\"font12\">Idem al registrado en la Hoja de Compromiso<br />" + "Cuando no se tenga SN o ST o TK asociado se debe de colocar ST99999999</font></div></div></div></div>" + "<div><div><div><a>[3]</a><div><font class=\"font12\">Codigo en el inventario de Aplicativo</font></div></div></div></div> " + "<div><div><div><a>[4]</a><div><font class=\"font12\">Cuando no se tenga SN o ST o TK asociado se debe de colocar TK999999</font></div></div></div></div> " + "<div><div><div><a>[5]</a><div><font class=\"font13\">Se completa cuando esta asociado a un TK</font></div></div></div></div> " + "<div><div><div><a>[6]</a><div><font class=\"font12\">Se completa cuando esta asociado a un TK</font></div></div></div></div> " + "<div><div><div><a>[7]</a><div><font class=\"font13\">Se completa cuando esta asociado a un TK</font></div></div></div></div>" + "<div><div><div><a>[8]</a><div><font class=\"font12\">Idem al registrado en la Hoja de Compromiso </font></div></div></div></div>" + "<div><div><div><a>[9]</a><div><font class=\"font12\">Idem al registrado en la Hoja de Compromiso</font></div></div></div></div>" + "<div><div><div><a>[10]</a><div><font class=\"font12\">Idem al registrado en la Hoja de Compromiso</font></div></div></div></div>" + "<div><div><div><a>[11]</a><div><font class=\"font13\">Empresa responsable del Aplicativo (BCP, TCS, EVERIS )</font></div></div></div></div>" + "<div><div><div><a>[12]</a><div><font class=\"font13\">Jefe de Equipo del Aplicativo</font></div></div></div></div> " + "<div><div><div><a>[13]</a><div><font class=\"font13\">OE o Especialista de Capa de Control a quien notificar</font></div></div></div></div>" + "<div><div><div><a>[14]</a><div><font class=\"font13\">Grupo ServiceDesk responsable del elemento o Aplicativo a Monitorear</font></div></div></div></div>" + "<div><div><div><a>[15]</a><div><font class=\"font13\">En caso se encuentre asignado CSW, ingresar el nombre del CSW</font></div></div></div></div>" + "<div><div><div><a>[16]</a><div><font class=\"font13\">Para Host completar Malla Scheduler,<br /> " + "Para otras plataformas completar Servidor y/o BD según corresponda</font></div></div></div></div> " + "<div><div><div><a>[17]</a><div><font class=\"font13\">Codigo del Aplicativo al cual pertenece el elemento</font></div></div> </div> </div> " + "<div> <div> <div><a>[18]</a><div><font class=\"font12\">Colocar el nombre del contacto, caso contrario se enviará al grupo Service Desk de soporte del aplicativo<br /> " + "</font></div></div></div></div></div> " + "</body>" + "</html> "; #endregion #region Definicion de Header XLS docHtmlExcel = strDEFDOC + strSTYLECSS + SeccionHeadCabecera + TitulosTablaReq + DatosTablaReq + ParrafoEntreTabla + TitulosTablaCiclos + DatosTablaCiclos + ParrafoEntreTabla + TitulosTablaCertificacion + DatosTablaCertificacion + ParrafoEntreTabla + TitulosTablaNotificacion + DatosTablaNotificacion + ParrafoEntreTabla + TitulosTablaUnidades + DatosTablaUnidades + ParrafoEntreTabla + ParrafoEntreTabla + ComentariosMonitoreo + ObservacionMonitoreo + TitulosTablaMonitoreo + TituloTablaEjecuciones + DatosTablaMonitoreo + ParrafoEntreTabla + ParrafoEntreTabla + #region Pendiente de Ordenar HTML #endregion "</table>" + "<div> " + strFOOTER; #endregion return docHtmlExcel; }
static public void ErrorLog_Save(Exception ex, System.Web.UI.WebControls.DetailsView dv, String spModule) { ErrorLog_Save(ex, dv, spModule, null, null, null, null); }
/// <summary> /// Redirects the client to a new URL after the ItemUpdated event /// of the <see cref="DetailsView"/> object has been raised. /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> public static void RedirectAfterUpdate(DetailsView view, String url) { RedirectAfterUpdate(view, url, null); }
/// <summary> /// Redirects the client to a new URL after the ItemUpdated event of the <see cref="DetailsView"/> /// has been raised or after the ItemCommand event of the <see cref="DetailsView"/> object has /// been raised with a CommandName of "Cancel". /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="grid">A <see cref="GridView"/> object.</param> /// <param name="url">The target location.</param> public static void RedirectAfterUpdateCancel(DetailsView view, GridView grid, String url) { url = GetRedirectUrl(grid, url); RedirectAfterUpdateCancel(view, url); }
public void DetailsView_GetPostBackOptions_CausesValidation () { DetailsView dv = new DetailsView (); dv.Page = new Page (); IButtonControl btn = new Button (); Assert.IsTrue (btn.CausesValidation); Assert.AreEqual (String.Empty, btn.CommandName); Assert.AreEqual (String.Empty, btn.CommandArgument); Assert.AreEqual (String.Empty, btn.PostBackUrl); Assert.AreEqual (String.Empty, btn.ValidationGroup); PostBackOptions options = ((IPostBackContainer) dv).GetPostBackOptions (btn); }
/// <summary> /// Redirects the client to a new URL after the ItemInserted event /// of the <see cref="DetailsView"/> object has been raised. /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> public static void RedirectAfterInsert(DetailsView view, String url) { RedirectAfterInsert(view, url, null); }
private DetailsView GetProjectDetails(UpdateType updateType) { DetailsView dvProjectDetails = new DetailsView(); DataTable projectRecord = new DataTable(); projectRecord.Columns.Add("ProjectId", typeof(Int32)); projectRecord.Columns.Add("Description", typeof(String)); DataRow dr = projectRecord.NewRow(); dr["ProjectId"] = 3; dr["Description"] = "Test Project"; projectRecord.Rows.Add(dr); dvProjectDetails.DataSource = projectRecord; dvProjectDetails.DataBind(); switch (updateType) { case UpdateType.Insert: dvProjectDetails.ChangeMode(DetailsViewMode.Insert); break; case UpdateType.Update: dvProjectDetails.ChangeMode(DetailsViewMode.Edit); break; //case EditGatewaysPresenterFixture.UpdateType.View: // dvProjectDetails.Rows(p.DetailColumns.PaymentTypeID).Cells[1].Controls.Add(Me.GetPaymentTypeIDLabel); // break; } return dvProjectDetails; }
protected override void OnLoad(EventArgs e) { if (!string.IsNullOrEmpty(DetailsViewID) && !string.IsNullOrEmpty(GridViewID)) throw new InvalidOperationException("Too many controls defined"); if (string.IsNullOrEmpty(DetailsViewID) && string.IsNullOrEmpty(GridViewID)) throw new InvalidOperationException("GridView or DetailsView ID is missing"); if (Items == null) Items = new Dictionary<string, StateContainer>(); _actionMode = string.IsNullOrEmpty(DetailsViewID) ? (string.IsNullOrEmpty(GridViewID) ? ActionMode.None : ActionMode.List) : ActionMode.Edit; switch (_actionMode) { case ActionMode.Edit: _detailView = (DetailsView)Parent.FindControl(DetailsViewID); if (_detailView != null) { _stateName = GetTableName(_detailView); if (!Items.ContainsKey(_stateName)) Items.Add(_stateName, new StateContainer()); } break; case ActionMode.List: _gridView = (GridView)Parent.FindControl(GridViewID); if (_gridView != null) { _stateName = GetTableName(_gridView); if (!Items.ContainsKey(_stateName)) Items.Add(_stateName, new StateContainer()); _gridView.PageIndexChanged += GridViewPagerIndexChanged; _gridView.Sorted += GridViewSorted; if (_gridView.BottomPagerRow != null && _gridView.BottomPagerRow.Cells[0].FindControl("GridViewPager") != null) { _pageSizer = (DropDownList) _gridView.BottomPagerRow.Cells[0].FindControl("GridViewPager").TemplateControl.FindControl( "DropDownListPageSize"); if (_pageSizer != null) _pageSizer.SelectedIndexChanged += PageSizeChanged; } if (!string.IsNullOrEmpty(FilterRepeaterID)) { FilterRepeater filterRepeater = (FilterRepeater)FindControl(Parent.Controls, FilterRepeaterID); if (filterRepeater != null) { List<UserControl> filterControls = GetFilterControls(filterRepeater); _filters = new List<DropDownList>(); foreach (UserControl ctl in filterControls) { DropDownList listbox = ctl.FindControl("DropDownList1") as DropDownList; if (listbox != null) { _filters.Add(listbox); listbox.SelectedIndexChanged += FilterSelectedIndexChanged; } } if (_filters.Count > 0) { Button btnClear = new Button(); btnClear.Text = "Снять все фильтры"; btnClear.Click += ClearFilters; btnClear.CssClass = "dropdown"; Controls.Add(btnClear); } } } } break; } if (!string.IsNullOrEmpty(RecentName) && _stateName != RecentName) Items[RecentName].Reset(); RecentName = _stateName; base.OnLoad(e); }
protected void SavePermissions(DetailsView dv, SRPUser obj) { GridView gv = (GridView)dv.FindControl("gvUserPermissions"); string groupPermissions= string.Empty; foreach(GridViewRow row in gv.Rows) { if(((CheckBox)row.FindControl("isChecked")).Checked) { groupPermissions = string.Format("{0},{1}", groupPermissions, ((Label)row.FindControl("PermissionID")).Text); } } if(groupPermissions.Length > 0) groupPermissions = groupPermissions.Substring(1, groupPermissions.Length - 1); SRPUser.UpdatePermissions((int)obj.Uid, groupPermissions, ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username); }
protected void SetUp() { this._DataPath = "/DataFiles"; this.gvList = new GridView(); this.dv = new DetailsView(); this.gvStoryList = new GridView(); }
protected void SaveGroups(DetailsView dv, SRPUser obj) { GridView gv = (GridView)dv.FindControl("gvUserGroups"); string memberGroups= string.Empty; foreach(GridViewRow row in gv.Rows) { if(((CheckBox)row.FindControl("isMember")).Checked) { memberGroups = string.Format("{0},{1}", memberGroups, ((Label)row.FindControl("GID")).Text); } } if(memberGroups.Length > 0) memberGroups = memberGroups.Substring(1, memberGroups.Length - 1); SRPUser.UpdateMemberGroups((int)obj.Uid, memberGroups, ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username); }
private void ProcessSimpleStringFilter(DetailsView sender, string filterField, ref string whereClause, ref string retColumns, ref SqlParameter[] arrParams, ref string filterStr, string minorSep, string majorSep) { var txt = ((TextBox)(sender).FindControl(filterField)).Text.Trim(); if (txt.Length > 0) { AddSqlParameter(ref arrParams, new SqlParameter("@" + filterField, txt)); whereClause = Coalesce(whereClause, string.Format("({0} like '%' + @{0} + '%')", filterField), " AND "); filterStr = Coalesce(filterStr, string.Format("{0}{1}like {2}", filterField, minorSep, txt), majorSep); //retColumns = Coalesce(retColumns, filterField, ","); } }
public string cArchivoExcelHTMLPorRequerimientoDetalleGrilla(DetailsView objDetailView, string strNombreArchivo, Page objPage, string IdRequerimiento) { int intIdRequerimiento = int.Parse(IdRequerimiento); StringBuilder sb = new StringBuilder(); #region Creamos la cabecera sb.Append(strCrearDocumentoExcelDetalleGrilla(objDetailView, intIdRequerimiento)); #endregion StringWriter sw = new StringWriter(sb); HtmlTextWriter htw = new HtmlTextWriter(sw); Page page = new Page(); HtmlForm form = new HtmlForm(); #region Crea el Archivo Excel try { objDetailView.AllowPaging = false; objDetailView.DataBind(); objDetailView.EnableViewState = false; page.EnableEventValidation = false; page.DesignerInitialize(); page.Controls.Add(form); form.Controls.Add(objDetailView); page.RenderControl(htw); objPage.Response.Clear(); objPage.Response.Buffer = true; objPage.Response.ContentType = "application/vnd.ms-excel"; objPage.Response.AppendHeader("Content-Disposition", "attachment;filename=" + strNombreArchivo + "" + DateTime.Now.ToShortDateString() + ".xls"); objPage.Response.Charset = "UTF-8"; objPage.Response.ContentEncoding = System.Text.Encoding.Default; objPage.Response.Write(sb.ToString()); objPage.Response.Flush(); objPage.Response.Close(); objPage.Response.End(); } catch (Exception ex) { return "Error al crear Archivo Excel " + ": " + ex.ToString(); } #endregion return "Por favor guardar el archivo Excel creado"; }
public void DetailsView_CurrentMode () { DetailsView view = new DetailsView (); view.DefaultMode = DetailsViewMode.Insert; Assert.AreEqual (DetailsViewMode.Insert, view.CurrentMode, "DetailsView_CurrentMode#1"); view.ChangeMode (DetailsViewMode.Edit); Assert.AreEqual (DetailsViewMode.Edit, view.CurrentMode, "DetailsView_CurrentMode#2"); }
/// <summary> /// Redirects the client to a new URL after the ItemInserted or ItemUpdated event of the <see cref="DetailsView"/> /// has been raised or after the ItemCommand event of the <see cref="DetailsView"/> object has /// been raised with a CommandName of "Cancel". /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> public static void RedirectAfterInsertUpdateCancel(DetailsView view, String url) { RedirectAfterInsertUpdateCancel(view, url, null); }
public void DetailsView_GetPostBackOptions () { DetailsView dv = new DetailsView (); dv.Page = new Page (); IButtonControl btn = new Button (); btn.CausesValidation = false; Assert.IsFalse (btn.CausesValidation, "DetailsView_GetPostBackOptions #1"); Assert.AreEqual (String.Empty, btn.CommandName, "DetailsView_GetPostBackOptions #2"); Assert.AreEqual (String.Empty, btn.CommandArgument, "DetailsView_GetPostBackOptions #3"); Assert.AreEqual (String.Empty, btn.PostBackUrl, "DetailsView_GetPostBackOptions #4"); Assert.AreEqual (String.Empty, btn.ValidationGroup, "DetailsView_GetPostBackOptions #5"); PostBackOptions options = ((IPostBackContainer) dv).GetPostBackOptions (btn); Assert.IsFalse (options.PerformValidation, "DetailsView_GetPostBackOptions #6"); Assert.IsFalse (options.AutoPostBack, "DetailsView_GetPostBackOptions #7"); Assert.IsFalse (options.TrackFocus, "DetailsView_GetPostBackOptions #8"); Assert.IsTrue (options.ClientSubmit, "DetailsView_GetPostBackOptions #9"); Assert.IsTrue (options.RequiresJavaScriptProtocol, "DetailsView_GetPostBackOptions #10"); Assert.AreEqual ("$", options.Argument, "DetailsView_GetPostBackOptions #11"); Assert.AreEqual (null, options.ActionUrl, "DetailsView_GetPostBackOptions #12"); Assert.AreEqual (null, options.ValidationGroup, "DetailsView_GetPostBackOptions #13"); btn.ValidationGroup = "VG"; btn.CommandName = "CMD"; btn.CommandArgument = "ARG"; btn.PostBackUrl = "Page.aspx"; Assert.IsFalse (btn.CausesValidation, "DetailsView_GetPostBackOptions #14"); Assert.AreEqual ("CMD", btn.CommandName, "DetailsView_GetPostBackOptions #15"); Assert.AreEqual ("ARG", btn.CommandArgument, "DetailsView_GetPostBackOptions #16"); Assert.AreEqual ("Page.aspx", btn.PostBackUrl, "DetailsView_GetPostBackOptions #17"); Assert.AreEqual ("VG", btn.ValidationGroup, "DetailsView_GetPostBackOptions #18"); options = ((IPostBackContainer) dv).GetPostBackOptions (btn); Assert.IsFalse (options.PerformValidation, "DetailsView_GetPostBackOptions #19"); Assert.IsFalse (options.AutoPostBack, "DetailsView_GetPostBackOptions #20"); Assert.IsFalse (options.TrackFocus, "DetailsView_GetPostBackOptions #21"); Assert.IsTrue (options.ClientSubmit, "DetailsView_GetPostBackOptions #22"); Assert.IsTrue (options.RequiresJavaScriptProtocol, "DetailsView_GetPostBackOptions #23"); Assert.AreEqual ("CMD$ARG", options.Argument, "DetailsView_GetPostBackOptions #24"); Assert.AreEqual (null, options.ActionUrl, "DetailsView_GetPostBackOptions #25"); Assert.AreEqual (null, options.ValidationGroup, "DetailsView_GetPostBackOptions #26"); }
static public void ErrorLog_Save(Exception ex, System.Web.UI.WebControls.DetailsView dv, String spModule, String spSource, String spPage, String spQuery, String spFullURL) { #region SQL Connection String sqlStrPortal = Connection.GetConnectionString("PS_Stage", ""); // PS_Production || PS_Stage if (System.Configuration.ConfigurationManager.AppSettings["ScriptMode"] == "Live") { sqlStrPortal = Connection.GetConnectionString("PS_Production", ""); // PS_Production || PS_Stage } using (SqlConnection con = new SqlConnection(sqlStrPortal)) { #region SQL Command using (SqlCommand cmd = new SqlCommand("", con)) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.CommandTimeout = 600; cmd.CommandText = "[dbo].[sp_error_log_net]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); #region SQL Parameters if (spModule == null) { spModule = "Portal"; } if (spSource == null) { spSource = "Ameriprise Admin"; } cmd.Parameters.Add(new SqlParameter("@SP_Module", spModule)); cmd.Parameters.Add(new SqlParameter("@SP_Source", spSource)); if (spPage == null) { spPage = ""; } cmd.Parameters.Add(new SqlParameter("@SP_Page", spPage)); if (spQuery == null) { spQuery = ""; } cmd.Parameters.Add(new SqlParameter("@SP_QueryString", spQuery)); if (spFullURL == null) { spFullURL = ""; } cmd.Parameters.Add(new SqlParameter("@SP_FullURL", spFullURL)); cmd.Parameters.Add(new SqlParameter("@SP_Ex_Message", ex.Message.ToString())); cmd.Parameters.Add(new SqlParameter("@SP_Ex_StackTrace", ex.StackTrace.ToString())); cmd.Parameters.Add(new SqlParameter("@SP_Ex_Source", ex.Source.ToString())); if (ex.InnerException != null) { cmd.Parameters.Add(new SqlParameter("@SP_Ex_InnerException", ex.InnerException.ToString())); } else { cmd.Parameters.Add(new SqlParameter("@SP_Ex_InnerException", "")); } cmd.Parameters.Add(new SqlParameter("@SP_Ex_Data", ex.Data.ToString())); if (ex.HelpLink != null) { cmd.Parameters.Add(new SqlParameter("@SP_Ex_HelpLink", ex.HelpLink.ToString())); } else { cmd.Parameters.Add(new SqlParameter("@SP_Ex_HelpLink", "")); } cmd.Parameters.Add(new SqlParameter("@SP_Ex_TargetSite", ex.TargetSite.ToString())); cmd.Parameters.Add(new SqlParameter("@SP_SourceDate", DateTime.Now)); #endregion SQL Parameters #region SQL Processing if (dv != null) { try { SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); dv.DataSource = dt; //DetailsView1.DataSource = dt; dv.DataBind(); //DetailsView1.DataBind(); } catch { cmd.ExecuteNonQuery(); } } else { try { cmd.ExecuteNonQuery(); } catch { } } #endregion SQL Processing } #endregion SQL Command } #endregion SQL Connection }
public void DetailsView_GetPostBackOptions_Null_Argument () { DetailsView dv = new DetailsView (); dv.Page = new Page (); PostBackOptions options = ((IPostBackContainer) dv).GetPostBackOptions (null); }
static public void ErrorLog_Save(Exception ex, System.Web.UI.WebControls.DetailsView dv, String spModule, String spSource, String spPage, String spQuery) { ErrorLog_Save(ex, dv, spModule, spSource, spPage, spQuery, null); }
/// <summary> /// Redirects the client to a new URL after the ItemInserted event /// of the <see cref="DetailsView"/> object has been raised. /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="grid">A <see cref="GridView"/> object.</param> /// <param name="url">The target location.</param> public static void RedirectAfterInsert(DetailsView view, GridView grid, String url) { url = GetRedirectUrl(grid, url); RedirectAfterInsert(view, url); }
protected bool Save(DetailsView sender) { try { var tab1 = ((DetailsView)sender).FindControl("TabContainer1").FindControl("TabPanel1"); var tab2 = ((DetailsView)sender).FindControl("TabContainer1").FindControl("TabPanel2"); var obj = new DAL.SurveyQuestion(); int pk = int.Parse(lblPK.Text); obj.Fetch(pk); switch (obj.QType) { case 1: obj.QText = ((HtmlTextArea)((Panel)tab1.FindControl("pnlType1")).FindControl("QText")).InnerHtml; break; case 2: var p2 = (Panel)tab1.FindControl("pnlType2"); obj.QText = ((HtmlTextArea)p2.FindControl("QText2")).InnerHtml; obj.QName = ((TextBox)p2.FindControl("QName2")).Text; obj.IsRequired = ((CheckBox)p2.FindControl("IsRequired2")).Checked; obj.DisplayControl = ((DropDownList)p2.FindControl("DisplayControl2")).SelectedValue.SafeToInt(); obj.DisplayDirection = ((DropDownList)p2.FindControl("DisplayDirection2")).SelectedValue.SafeToInt(); break; case 3: var p3 = (Panel) tab1.FindControl("pnlType3"); obj.QText = ((HtmlTextArea)p3.FindControl("QText3")).InnerHtml; obj.QName = ((TextBox)p3.FindControl("QName3")).Text; obj.IsRequired = ((CheckBox)p3.FindControl("IsRequired3")).Checked; break; case 4: var p4 = (Panel) tab1.FindControl("pnlType4"); obj.QText = ((HtmlTextArea)p4.FindControl("QText4")).InnerHtml; obj.QName = ((TextBox)p4.FindControl("QName4")).Text; obj.IsRequired = ((CheckBox)p4.FindControl("IsRequired4")).Checked; obj.DisplayControl = ((DropDownList)p4.FindControl("DisplayControl4")).SelectedValue.SafeToInt(); break; } if (obj.IsValid(BusinessRulesValidationMode.UPDATE)) { obj.Update(); //switch (obj.QType) //{ // case 2: // SaveType2Answers(obj.QID, tab2); // break; // case 4: // SaveType4Answers(obj.QID, tab2); // SaveType4Lines(obj.QID, tab2); // break; //} return true; } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) masterPage.PageError = message; return false; } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); return false; } }
/// <summary> /// Redirects the client to a new URL after the ItemUpdated event /// of the <see cref="DetailsView"/> object has been raised. /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param> public static void RedirectAfterUpdate(DetailsView view, String url, ILinkedDataSource dataSource) { view.ItemUpdated += new DetailsViewUpdatedEventHandler( delegate(object sender, DetailsViewUpdatedEventArgs e) { Redirect(url, dataSource, e.Exception); } ); }
public void DetailsViewRow_BubbleEvent () { DetailsView dv = new DetailsView (); dv.Page = new Page (); PokerDetailsViewRow row = new PokerDetailsViewRow (2, DataControlRowType.Footer, DataControlRowState.Insert); Button bt = new Button (); dv.Controls.Add (row); CommandEventArgs com = new CommandEventArgs (new CommandEventArgs ("Delete", null)); dv.ItemDeleting += new DetailsViewDeleteEventHandler (R_DataDeleting); Assert.AreEqual (false, dataDeleting, "BeforeDeleteBubbleEvent"); row.DoOnBubbleEvent (row, com); Assert.AreEqual (true, dataDeleting, "AfterDeleteBubbleEvent"); dv.ChangeMode (DetailsViewMode.Insert); com = new CommandEventArgs (new CommandEventArgs ("Insert", null)); dv.ItemInserting += new DetailsViewInsertEventHandler (dv_ItemInserting); Assert.AreEqual (false, dataInserting, "BeforeInsertBubbleEvent"); row.DoOnBubbleEvent (row, com); Assert.AreEqual (true, dataInserting, "AfterInsertBubbleEvent"); dv.ChangeMode (DetailsViewMode.Edit); com = new CommandEventArgs (new CommandEventArgs ("Update", null)); dv.ItemUpdating += new DetailsViewUpdateEventHandler (dv_ItemUpdating); Assert.AreEqual (false, dataUpdating, "BeforeUpdateBubbleEvent"); row.DoOnBubbleEvent (row, com); Assert.AreEqual (true, dataUpdating, "AfterUpdateBubbleEvent"); dv.ItemUpdating += new DetailsViewUpdateEventHandler (dv_ItemUpdating); }
/// <summary> /// Redirects the client to a new URL after the ItemCommand event /// of the <see cref="DetailsView"/> object has been raised with a /// CommandName of "Cancel". /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param> public static void RedirectAfterCancel(DetailsView view, String url, ILinkedDataSource dataSource) { view.ItemCommand += new DetailsViewCommandEventHandler( delegate(object sender, DetailsViewCommandEventArgs e) { // cancel button if ( String.Compare("Cancel", e.CommandName, true) == 0 ) { Redirect(url, dataSource); } } ); }
private void ProcessSimpleIntFilter(DetailsView sender, string filterField, ref string whereClause, ref string retColumns, ref SqlParameter[] arrParams) { var txt = ((TextBox)(sender).FindControl(filterField)).Text.Trim(); if (txt.Length > 0) { AddSqlParameter(ref arrParams, new SqlParameter("@" + filterField, int.Parse(txt))); whereClause = Coalesce(whereClause, string.Format("({0} like '%' + @{0} + '%')", filterField), " AND "); //retColumns = Coalesce(retColumns, filterField, ","); } }
/// <summary> /// Redirects the client to a new URL after the ItemInserted or ItemUpdated event of the <see cref="DetailsView"/> /// has been raised or after the ItemCommand event of the <see cref="DetailsView"/> object has /// been raised with a CommandName of "Cancel". /// </summary> /// <param name="view">A <see cref="DetailsView"/> object.</param> /// <param name="url">The target location.</param> /// <param name="dataSource">The associated <see cref="ILinkedDataSource"/> object.</param> public static void RedirectAfterInsertUpdateCancel(DetailsView view, String url, ILinkedDataSource dataSource) { RedirectAfterInsert(view, url, dataSource); RedirectAfterUpdate(view, url, dataSource); RedirectAfterCancel(view, url, dataSource); }
public override List <AutoGeneratedField> CreateAutoGeneratedFields(object dataItem, Control control) { if (!(control is DetailsView)) { throw new ArgumentException(SR.GetString(SR.InvalidDefaultAutoFieldGenerator, GetType().FullName, typeof(DetailsView).FullName)); } DetailsView detailsView = control as DetailsView; if (dataItem == null) { // note that we're not throwing an exception in this case, and the calling // code should be able to handle a null arraylist being returned return(null); } List <AutoGeneratedField> generatedFields = new List <AutoGeneratedField>(); PropertyDescriptorCollection propDescs = null; bool throwException = true; Type dataItemType = null; //The base class ensures that the AutoGeneratedFieldProperties collection is reset before this method is called. //However we are doing this again in here because we have another caller DetailsView.CreateAutoGeneratedRows which is //not being used anywhere today but kept for backward compatibility. if (AutoGeneratedFieldProperties.Count > 0) { AutoGeneratedFieldProperties.Clear(); } if (dataItem != null) { dataItemType = dataItem.GetType(); } if ((dataItem != null) && (dataItem is ICustomTypeDescriptor)) { // Get the custom properties of the object propDescs = TypeDescriptor.GetProperties(dataItem); } else if (dataItemType != null) { // directly bindable types: strings, ints etc. get treated specially, since we // don't care about their properties, but rather we care about them directly if (ShouldGenerateField(dataItemType, detailsView)) { AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties(); ((IStateManager)fieldProps).TrackViewState(); fieldProps.Name = "Item"; fieldProps.DataField = AutoGeneratedField.ThisExpression; fieldProps.Type = dataItemType; AutoGeneratedField field = CreateAutoGeneratedFieldFromFieldProperties(fieldProps); if (field != null) { generatedFields.Add(field); AutoGeneratedFieldProperties.Add(fieldProps); } } else { // complex type... we get its properties propDescs = TypeDescriptor.GetProperties(dataItemType); } } if ((propDescs != null) && (propDescs.Count != 0)) { string[] dataKeyNames = detailsView.DataKeyNames; int keyNamesLength = dataKeyNames.Length; string[] dataKeyNamesCaseInsensitive = new string[keyNamesLength]; for (int i = 0; i < keyNamesLength; i++) { dataKeyNamesCaseInsensitive[i] = dataKeyNames[i].ToLowerInvariant(); } foreach (PropertyDescriptor pd in propDescs) { Type propertyType = pd.PropertyType; if (ShouldGenerateField(propertyType, detailsView)) { string name = pd.Name; bool isKey = ((IList)dataKeyNamesCaseInsensitive).Contains(name.ToLowerInvariant()); AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties(); ((IStateManager)fieldProps).TrackViewState(); fieldProps.Name = name; fieldProps.IsReadOnly = isKey; fieldProps.Type = propertyType; fieldProps.DataField = name; AutoGeneratedField field = CreateAutoGeneratedFieldFromFieldProperties(fieldProps); if (field != null) { generatedFields.Add(field); AutoGeneratedFieldProperties.Add(fieldProps); } } } } if ((generatedFields.Count == 0) && throwException) { // this handles the case where we got back something that either had no // properties, or all properties were not bindable. throw new InvalidOperationException(SR.GetString(SR.DetailsView_NoAutoGenFields, detailsView.ID)); } return(generatedFields); }