Files
SIG/OI/Minutas.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

972 lines
50 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports System.IO
Partial Class OI_Minutas
Inherits ClsPaginas
#Region "Propiedades"
Private Property CveEvento As Integer
Get
Return ViewState("CveEvento").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveEvento") = value
End Set
End Property
Private Property CveUsuarioIng As Integer
Get
Return ViewState("CveUsuarioIng").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveUsuarioIng") = value
End Set
End Property
Private Property EsNueva As Boolean
Get
Return CType(ViewState("EsNueva"), Boolean)
End Get
Set(value As Boolean)
ViewState("EsNueva") = value
End Set
End Property
Private Property Terminada As Boolean
Get
Return CType(ViewState("Terminada"), Boolean)
End Get
Set(value As Boolean)
ViewState("Terminada") = value
End Set
End Property
Private Property Modificada As Boolean
Get
Return CType(ViewState("Modificada"), Boolean)
End Get
Set(value As Boolean)
ViewState("Modificada") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Terminada = False
Modificada = False
ViewState("OrdenTarea") = ""
ViewState("OrdenAgenda") = ""
ViewState("OrdenArchivo") = ""
CargaCombos()
If Request("CveEvento") IsNot Nothing AndAlso IsNumeric(Request("CveEvento")) AndAlso Request("CveEvento").ToEntero > 0 Then
ViewState("CveEvento") = Request("CveEvento").ToEntero
CargaDatos()
Else
CargaNueva()
End If
End If
End Sub
Private Sub CargaCombos()
ddlUsuarioTarea.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
ddlUsuarioTarea.DataBind()
ddlUsuarioTarea.Items.Insert(0, New ListItem("Seleccione", "-1"))
ddlUsuarioAgenda.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
ddlUsuarioAgenda.DataBind()
ddlUsuarioAgenda.Items.Insert(0, New ListItem("Seleccione", "-1"))
ddlAgendaTipo.DataSource = GlobalDTOIAgendaTipo().FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa))
ddlAgendaTipo.DataBind()
ddlAgendaTipo.Items.Insert(0, New ListItem("Sin Tipo", "-1"))
End Sub
Private Sub CargaNueva()
ViewState("CveEvento") = -1
ViewState("EsNueva") = True
btnTerminarMinuta.Visible = False
btnEnviarMinuta.Visible = False
GetUsuarios()
End Sub
Private Sub GetUsuarios()
Dim DT As Data.DataTable = GlobalDTUsuarios.FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa), "Rol ASC")
'AGREGA JULIAN Y RENE DE FUERZAS
DT.Merge(GlobalDTUsuarios.FiltraParametros(String.Format("CveUsuario IN (2,93) AND CveEmpresa = 70", UsuarioActual.CveEmpresa), "Rol ASC"))
DT = DT.FiltraParametros("", "Rol ASC")
GVUsuarios.DataSource = AgregaGrupos(DT)
DT.Dispose()
GVUsuarios.DataBind()
End Sub
Private Function AgregaGrupos(ByRef DT As Data.DataTable) As Data.DataTable
If Not DT Is Nothing AndAlso DT.Rows.Count > 0 Then
DT.Columns.Add(New DataColumn("Grupo", GetType(String)))
Dim i As Integer = 0
Dim Gpo As String = String.Empty
Dim dbRow As DataRow
While i < DT.Rows.Count
dbRow = DT.NewRow()
If i = 0 Then
Gpo = DT.Rows(0)("Rol").ToString()
dbRow("Rol") = DT.Rows(i)("Rol")
dbRow("Grupo") = "S"
DT.Rows.InsertAt(dbRow, i)
Gpo = DT.Rows(i)("Rol").ToString()
Else
If Gpo <> DT.Rows(i)("Rol").ToString() Then
dbRow("Rol") = DT.Rows(i)("Rol")
dbRow("Grupo") = "S"
DT.Rows.InsertAt(dbRow, i)
End If
Gpo = DT.Rows(i)("Rol").ToString()
End If
i += 1
End While
End If
Return DT
End Function
Protected Sub gvUsuarios_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GVUsuarios.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If (Not IsDBNull(DataBinder.Eval(e.Row.DataItem, "Grupo"))) AndAlso CStr(DataBinder.Eval(e.Row.DataItem, "Grupo")) = "S" Then
e.Row.CssClass = "SubTotales2"
e.Row.Cells(0).Visible = False
e.Row.Cells(1).Visible = False
e.Row.Cells(2).ColumnSpan = 2
Else
e.Row.Cells(2).Visible = False
End If
End If
End Sub
Private Sub CargaDatos()
hdnCveEvento.Value = CveEvento.ToString
Dim ObjEventos As New ClsOIEventos
With ObjEventos
'If ObjEventos.GetEventos(CveEvento, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, "01/01/1900".ToDateTime, "01/01/2030".ToDateTime, "01/01/2030".ToDateTime) Then
If ObjEventos.GetEvento(CveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then 'If ObjEventos.GetEventos(CveEvento, -1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, Nothing, Nothing, Nothing) Then
If ObjEventos.DtResultados.Rows.Count > 0 Then
EsNueva = False
TxtAsunto.Text = .Asunto
TxtDescripcion.Text = .Descripcion
TxtAcuerdos.Text = .Acuerdos
lblUsuarioIng.Text = .UsuarioIng
ViewState("CveUsuarioIng") = .CveUsuarioIng
hdnCveEventoEstatus.Value = .CveEventoEstatus.ToString
'cargo los ususarios
If .GetEventosUsuario(CveEvento, UsuarioActual.CveEmpresa) Then
divUsuarios.Visible = True
divSeleccionUsuarios.Visible = True
DivUsr.Visible = False
gvUsuariosVista.DataSource = .DtResultados.FiltraParametros("CveEvento is not null")
gvUsuariosVista.DataBind()
For Each R As GridViewRow In gvUsuariosVista.Rows
LblUsuariosCCP.Text = LblUsuariosCCP.Text + R.DataKey("Nombre").ToString + ", "
Next
' TrParticipantes.Visible = True
Dim StrCorreos As New StringBuilder
' Dim CorreosCCP As New List(Of String)
For Each Row As DataRow In .DtResultados.FiltraParametros("CveEvento is not null").Rows
'CorreosCCP.Add(GlobalDTUsuarios(Row("CveUsuario").ToString.ToEntero)(0)("correo").ToString)
StrCorreos.AppendFormat("{0};", GlobalDTUsuarios(Row("CveUsuario").ToString.ToEntero)(0)("correo").ToString)
Next
ViewState("ArrayCC") = StrCorreos.ToString 'CorreosCCP.ToArray
End If
RegistraScript("TdDetalles.style.display = 'inline'")
btnTerminarMinuta.Visible = True
btnEnviarMinuta.Visible = True
' TdDetalles.visible = True
CargaDetallesTareas("")
CargaDetallesAgendas("")
CargaDetallesArchivos("")
End If
A1.Visible = False
If Not IsDBNull(.Archivo) AndAlso .Archivo <> "" AndAlso .Archivo <> "-1" Then A2.HRef = String.Format("\Empresas\{0}\OI\{1}", UsuarioActual.CveEmpresa, .Archivo) : A2.Visible = True Else A1.Visible = True
If ObjEventos.CveEventoEstatus = 4 Then
DesHabilitar()
Terminada = True
ElseIf ObjEventos.Modificada Then
btnTerminarMinuta.Text = "Terminar y Enviar Minuta"
Modificada = True
LtModificada.Visible = True
End If
End If
End With
UpSeleccionUsuarios.Update()
ObjEventos.Dispose()
End Sub
Protected Sub DesHabilitar()
btnGuardar.Enabled = False
btnTerminarMinuta.Enabled = False
' btnEnviarMinuta.enabled = False
'htmlEdDescripcion.r
LtlCSS.Text = "<style type='text/css'> .ajax__html_editor_extender_buttoncontainer{display:none;} </style>"
'RegistraScript(" $(document).ready(function () {{$get('TxtAcuerdos$HtmlEditorExtenderBehavior_ExtenderButtonContainer').style.display='none';}}); ")
TxtAsunto.Enabled = False
TxtDescripcion.Enabled = False
A1.Visible = False
Tab.Enabled = False
TxtAcuerdos.Enabled = False
btnGuardar.Text = "Abrir Minuta"
btnGuardar.Enabled = True
End Sub
Private Sub CargaDetallesTareas(Orden As String)
Dim objEventos As New ClsOIEventos
If objEventos.GetEventos(-1, 1, -1, "-1", "-1", -1, -1, -1, -1, -1, CveEvento, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If Orden <> String.Empty Then
Dim DV As New DataView(objEventos.DtResultados, "", Orden, DataViewRowState.CurrentRows)
GvEventosDetalleTareas.DataSource = DV.ToTable()
DV.Dispose()
Else
GvEventosDetalleTareas.DataSource = objEventos.DtResultados.FiltraParametros("", "FechaIng Desc")
End If
GvEventosDetalleTareas.DataBind()
TabTarea.HeaderText = String.Format("Tareas ({0})", GvEventosDetalleTareas.Rows.Count)
End If
objEventos.Dispose()
UPPDatosDetallesTareas.Update()
End Sub
Private Sub CargaDetallesAgendas(Orden As String)
Dim objEventos As New ClsOIEventos
If objEventos.GetEventos(-1, 2, -1, "-1", "-1", -1, -1, -1, -1, -1, CveEvento, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If Orden <> String.Empty Then
Dim DV As New DataView(objEventos.DtResultados, "", Orden, DataViewRowState.CurrentRows)
GvEventosDetalleAgendas.DataSource = DV.ToTable()
DV.Dispose()
Else
GvEventosDetalleAgendas.DataSource = objEventos.DtResultados.FiltraParametros("", "FechaIng Desc")
End If
GvEventosDetalleAgendas.DataBind()
TabAgenda.HeaderText = String.Format("Agendas ({0})", GvEventosDetalleAgendas.Rows.Count)
End If
objEventos.Dispose()
UPPDatosDetallesAgendas.Update()
End Sub
Private Sub CargaDetallesArchivos(Orden As String)
Dim objEventos As New ClsOIEventos
If objEventos.GetEventosComentarios(CveEvento) Then
If Orden <> String.Empty Then
Dim DV As New DataView(objEventos.DtResultados, "", Orden, DataViewRowState.CurrentRows)
GvEventosDetalleArchivos.DataSource = DV.ToTable()
DV.Dispose()
Else
GvEventosDetalleArchivos.DataSource = objEventos.DtResultados.FiltraParametros("", "FechaIng Desc")
End If
GvEventosDetalleArchivos.DataBind()
TabArchivos.HeaderText = String.Format("Archivos ({0})", GvEventosDetalleArchivos.Rows.Count)
End If
objEventos.Dispose()
UPPDatosDetallesArchivos.Update()
End Sub
Protected Sub btnGuardar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnGuardar.Click
If Terminada Then
AbrirMinuta()
Else
Guardar()
End If
End Sub
Protected Sub Guardar()
Dim Asunto As String = TxtAsunto.Text.Trim
Dim Descripcion As String = TxtDescripcion.Text.Trim
Dim Acuerdos As String = TxtAcuerdos.Text.Trim
Dim CveUsuarioCCP As Integer = -1
Dim ObjEventos As New ClsOIEventos()
Dim Archivo As String = ""
'Dim RutaGuardar As String = String.Format("{0}Empresas\{1}\OI\", GlobalDTParametros(SisParametros.DirectorioSitio).Cadena1, UsuarioActual.CveEmpresa)
'Dim RutaArchivo As String = String.Format("{0}Empresas\{1}\OI\Temp\{2}", GlobalDTParametros(SisParametros.DirectorioSitio).Cadena1, UsuarioActual.CveEmpresa, Session("Eventos"))
Dim RutaGuardar As String = String.Format("{0}\OI\", UsuarioActual.Empresa.Ruta, UsuarioActual.CveEmpresa)
Dim RutaArchivo As String = String.Format("{0}\OI\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("Eventos"))
If CveEvento = -1 Then
If ObjEventos.AddEventoMinuta(Asunto, Descripcion, Acuerdos, -1, -1, Now, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
ViewState("CveEvento") = ObjEventos.CveEvento
For Each RowCCP As GridViewRow In GVUsuarios.Rows
If RowCCP.FCCheckBox("ChkPara").Checked Then
Dim CveUsuarioPara As Integer = GVUsuarios.DataKeys(RowCCP.RowIndex).Values("CveUsuario").ToString.ToEntero
If ObjEventos.AddEventoUsuario(CveEvento, CveUsuarioPara) Then
'Genero las claves, nombres y correos aquíen se le enviará correo
CveUsuarioCCP = RowCCP.DataKey("CveUsuario").ToString().ToEntero()
If CveUsuarioCCP <> UsuarioActual.CveUsuario Then
End If
End If
End If
Next
Alert("La Nueva Minuta se guardó correctamente.", TipoMensaje.MsgInformacion)
End If
Else
If Session("Eventos") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then
If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar)
Archivo = Path.GetExtension(Session("Eventos").ToString)
End If
If ObjEventos.UpdateEventoMinuta(Asunto, Descripcion, Acuerdos, New DateTime(1799, 1, 1), Archivo, CveEvento) Then
If Archivo <> "" Then
File.Move(RutaArchivo, String.Format("{0}OI{1}{2}", RutaGuardar, CveEvento, Path.GetExtension(Archivo)))
Session("Eventos") = ""
End If
For Each RowCCP As GridViewRow In GVUsuarios.Rows
If RowCCP.FCCheckBox("ChkPara").Checked Then
Dim CveUsuarioPara As Integer = GVUsuarios.DataKeys(RowCCP.RowIndex).Values("CveUsuario").ToString.ToEntero
If ObjEventos.AddEventoUsuario(CveEvento, CveUsuarioPara) Then
'Genero las claves, nombres y correos aquíen se le enviará correo
CveUsuarioCCP = RowCCP.DataKey("CveUsuario").ToString().ToEntero()
If CveUsuarioCCP <> UsuarioActual.CveUsuario Then
End If
End If
End If
Next
Alert("La Minuta se guardó correctamente.", TipoMensaje.MsgInformacion)
End If
End If
CargaDatos()
ObjEventos.Dispose()
End Sub
Private Sub AbrirMinuta()
Dim ObjEventos As New ClsOIEventos
If ObjEventos.AbrirMinuta(CveEvento) Then
Alert("La minuta se abrio satisfactoriamente.", TipoMensaje.MsgInformacion, String.Format("document.location.href='/OI/Minutas.aspx?CveEvento={0}';", CveEvento))
Else
Alert("Ocurrió un error al abrir la minuta. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
ObjEventos.Dispose()
End Sub
Protected Sub lbAgregarTarea_Click(sender As Object, e As EventArgs) Handles lbAgregarTarea.Click
Dim ObjEventos As New ClsOIEventos()
Dim FechaInicio As String = ""
Dim FechaFin As String = ""
Dim Archivo As String = TxtArchivo2.Text
If txtFechaInicioTarea.Text <> String.Empty Then FechaInicio = txtFechaInicioTarea.Text + " " + TxtHoraInicioTarea.PostedTime
If txtFechaFinTarea.Text <> String.Empty Then FechaFin = txtFechaFinTarea.Text + " " + TxtHoraFinTarea.PostedTime
Dim RutaGuardar = String.Format("{0}OI\", UsuarioActual.Empresa.Ruta)
Dim RutaArchivo = String.Format("{0}OI\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("Minutas"))
If Session("Minutas") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then
If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar)
Archivo = Path.GetExtension(Session("Minutas").ToString)
End If
If ObjEventos.AddEventoTarea(txtAsuntoTarea.Text, txtDescripcionTarea.Text, ddlPrioridadTarea.SelectedValue.ToEntero, UsuarioActual.CveUsuario, ddlUsuarioTarea.SelectedValue.ToEntero, FechaInicio.ToDateTime, FechaFin.ToDateTime, CveEvento, TxtOrden.Text.ToDouble, -1, Archivo, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
'Alert("La Nueva Tarea se guardó correctamente.", TipoMensaje.MsgInformacion)
CargaDetallesTareas(ViewState("OrdenTarea").ToString)
End If
If TxtArchivo2.Text <> "" Then
File.Move(RutaArchivo, String.Format("{0}OI{1}{2}", RutaGuardar, ObjEventos.CveEvento, Path.GetExtension(TxtArchivo2.Text)))
Session("Minutas") = ""
End If
ObjEventos.Dispose()
txtAsuntoTarea.Text = ""
txtDescripcionTarea.Text = ""
ddlPrioridadTarea.SelectedValue = "-1"
ddlUsuarioTarea.SelectedValue = "-1"
txtFechaInicioTarea.Text = ""
txtFechaFinTarea.Text = ""
TxtArchivo2.Text = ""
TxtOrden.Text = ""
Alert("La tarea se ha guardado con exito.", TipoMensaje.MsgInformacion)
End Sub
Protected Sub lbAgregarAgenda_Click(sender As Object, e As EventArgs) Handles lbAgregarAgenda.Click
Dim ObjEventos As New ClsOIEventos()
Dim FechaInicio As String = ""
If TxtFechaInicioAgenda.Text <> String.Empty Then FechaInicio = TxtFechaInicioAgenda.Text + " " + TxtHoraInicioAgenda.PostedTime
If ObjEventos.AddEventoAgenda(ddlAgendaTipo.SelectedValue.ToEntero, txtAsuntoAgenda.Text, txtDescripcionAgenda.Text, -1, FechaInicio.ToDateTime, FechaInicio.ToDateTime, ddlUsuarioAgenda.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveEventoPadre:=CveEvento) Then
'Alert("La Nueva Tarea se guardó correctamente.", TipoMensaje.MsgInformacion)
CargaDetallesAgendas(ViewState("OrdenAgenda").ToString)
End If
ObjEventos.Dispose()
txtAsuntoAgenda.Text = ""
txtDescripcionAgenda.Text = ""
TxtFechaInicioAgenda.Text = "-1"
ddlUsuarioAgenda.SelectedValue = "-1"
ddlAgendaTipo.SelectedValue = "-1"
End Sub
Protected Sub GvEventosDetalleTareas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEventosDetalleTareas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCLiteral("lblEventoEstatus").Text = String.Format("<a class=""Texto"" href=""/OI/EventoDetalle.aspx?CveEvento={0}"">{1}</a>", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("EventoEstatus"))
End If
End Sub
Protected Sub GvEventosDetalleAgendas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEventosDetalleAgendas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("AgendaTipo").ToString = "" Then
e.Row.Cells(4).Text = "Sin Tipo"
End If
e.Row.FCLiteral("lblEventoEstatus").Text = String.Format("<a class=""Texto"" href=""/OI/EventoDetalle.aspx?CveEvento={0}"">{1}</a>", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("EventoEstatus"))
End If
End Sub
Protected Sub btnTerminarMinuta_Click(sender As Object, e As EventArgs) Handles btnTerminarMinuta.Click
'Cambiar el estatus a Terminada para inabilitarla y que no se pueda modificar
Dim objOI As New ClsOIEventos
Dim tCveSeguimiento As Integer
Dim HuboError As Boolean = False
objOI.IniciaTransacSQL()
tCveSeguimiento = objOI.AddEventoComentario(CveEvento, "Termino Minuta", "", UsuarioActual.CveUsuario)
If tCveSeguimiento > 0 Then
If Not objOI.UpdateEstatusEvento(4, tCveSeguimiento, CveEvento, UsuarioActual.CveUsuario) Then
HuboError = True
End If
Else
HuboError = True
End If
''Envia minuta si es modificada
If HuboError = False Then
Alert("La minuta se termino con exito.", TipoMensaje.MsgInformacion)
objOI.Commit()
Else
Alert("Ocurrió un error al terminar la minuta. Por favor vuelva a intentar.", TipoMensaje.MsgError)
objOI.RollBack()
End If
objOI.Dispose()
If HuboError = False AndAlso Modificada Then
If Not EnviarMinuta() Then
HuboError = True
End If
Alert("La minuta se termino con exito.", TipoMensaje.MsgInformacion)
End If
CargaDatos()
End Sub
Private Sub TerminarMinuta()
End Sub
Protected Sub btnEnviarMinuta_Click(sender As Object, e As EventArgs) Handles btnEnviarMinuta.Click
EnviarMinuta()
End Sub
Private Function EnviarMinuta() As Boolean
Dim Retorno = False
Dim Body As StringBuilder
Try
Body = GeneraContenido(CveEvento)
ViewState("Para") = GlobalDTUsuarios(CveUsuarioIng)(0)("correo").ToString
ViewState("Asunto") = String.Format("SIG - Minuta {0}", TxtAsunto.Text)
ViewState("Body") = Body
Dim Hilo As New System.Threading.Thread(AddressOf MandaCorreo)
Hilo.Start()
Alert("Se Envió por correo la Minuta", TipoMensaje.MsgInformacion)
Retorno = True
Catch ex As Exception
OnError("Ocurrió error al mandar MAIL", ex)
End Try
Return Retorno
End Function
Private Function GeneraContenido(CveEvento As Integer) As StringBuilder
Dim StrSB As New StringBuilder()
Dim DireccionURL As String = GlobalDTParametros(SisParametros.URL).Cadena1
Dim Variables As String = ""
Dim Tarea As String
Dim De As String
Dim Para As String
'Dim CCP As String
Dim Fecha As String
Dim Prioridad As String
Dim Descripcion As String
Dim Tipo As Integer
Dim objEvento As New ClsOIEventos
If objEvento.GetEvento(CveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Tarea = objEvento.Asunto
De = objEvento.UsuarioDe
Para = objEvento.UsuarioPara
Fecha = objEvento.FechaIng.ToString("dd/MM/yyyy")
Prioridad = objEvento.Prioridad
Descripcion = objEvento.Descripcion
Tipo = objEvento.CveTipoEvento
StrSB.Append("<html xmlns=""http: //www.w3.org/1999/xhtml""> ")
StrSB.Append("<head> ")
'StrSB.AppendFormat("<link href=""{0}/Styles/Estilos.css"" rel=""stylesheet"" type=""text/css""> ", DireccionURL)
StrSB.Append(" <style type=""text/css""> ")
StrSB.Append(" body ")
StrSB.Append(" { ")
StrSB.Append(" margin:0px; ")
StrSB.Append(" padding:0px 0px 0px 0px; ")
StrSB.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
StrSB.Append(" font-size: 10px; ")
StrSB.Append(" background-color:#F0F0F0; ")
StrSB.Append(" } ")
StrSB.Append(" a.Texto ")
StrSB.Append(" { ")
StrSB.Append(" font-size:11px; ")
StrSB.Append(" background-color:#F7F6F3; ")
StrSB.Append(" text-decoration:none; ")
StrSB.Append(" font-weight:bold; ")
StrSB.Append(" } ")
StrSB.Append(" .Texto ")
StrSB.Append(" { ")
StrSB.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
StrSB.Append(" } ")
StrSB.Append(" .TextoAlterno ")
StrSB.Append(" { ")
StrSB.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
StrSB.Append(" vertical-align:middle; height:20px;")
StrSB.Append(" } ")
StrSB.Append(" .BarraIdentidad ")
StrSB.Append(" { ")
StrSB.Append(" color:#FFFFFF; ")
StrSB.Append(" background:#F0F0F0; ")
StrSB.Append(" font-weight:bold; ")
StrSB.Append(" font-size:19px; ")
StrSB.Append(" font-style:oblique; ")
StrSB.Append(" } ")
StrSB.Append(" .Titulos ")
StrSB.Append(" { ")
StrSB.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
StrSB.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
StrSB.Append(" text-decoration:none; ")
StrSB.Append(" } ")
StrSB.Append(" .Verde {color: #00CC00;} ")
StrSB.Append(" .Negro {color: #000000;} ")
StrSB.Append(" .Rojo {color: #FF0000;} ")
StrSB.Append(" </style> ")
StrSB.Append("</head> ")
StrSB.Append("<body>")
StrSB.Append(" <table cellspacing=""0"" cellpadding=""0"" border=""0"" width=""980px"">")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">")
StrSB.Append(" <fieldset>")
StrSB.Append(" <legend>Minuta</legend>")
StrSB.Append(" <table width=""970px"">")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""3"" style=""width: 80px;font-weight:bold"" class=""Texto"">ASUNTO:</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.AppendFormat(" <td colspan=""3"" style=""text-align:left"" ><b><a href=""{0}{1}{2}"">{3}</a></b></td>", DireccionURL, "/OI/Minutas.aspx?CveEvento=", CveEvento, objEvento.Asunto)
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""3"" style=""width: 80px;font-weight:bold"" class=""Texto"">DESCRIPCION:</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.AppendFormat(" <td colspan=""3"" style=""text-align:left"" class=""Texto"">{0}</td>", objEvento.Descripcion)
StrSB.Append(" </tr>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""3"" style=""width: 80px;vertical-align: top;font-weight:bold"" class=""Texto"">ACUERDOS:</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.AppendFormat(" <td colspan=""3"" style=""text-align:left"" class=""Texto"">{0}</td>", objEvento.Acuerdos.Replace("&lt;", "<").Replace("&gt;", ">"))
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td style=""font-weight:bold"" class=""Texto"">FECHA:</td>")
StrSB.Append(" <td style=""font-weight:bold"" class=""Texto"">PARTICIPANTES:</td>")
StrSB.Append(" <td style=""font-weight:bold"" class=""Texto"">ARCHIVO:</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.AppendFormat(" <td style="""" class=""Texto"">{0}</td>", objEvento.FechaIng.ToString("dd/MM/yyyy HH:mm"))
StrSB.AppendFormat(" <td style="""" class=""Texto"">{0}</td>", objEvento.DtResultados.Rows(0)("UsuariosCCP"))
'StrSB.AppendFormat(" <td style="""" class=""Texto"">{0}</td>", If(Not objEvento.Archivo Is Nothing AndAlso objEvento.Archivo <> "", String.Format("<a href=""{0}/Empresas/{1}/OI/{2}"">Ver archivo adjunto</a>", DireccionURL, objEvento.CveEmpresa, objEvento.Archivo), "Sin archivo adjunto"))
StrSB.AppendFormat(" <td style="""" class=""Texto"">{0}</td>", If(Not objEvento.Archivo Is Nothing AndAlso objEvento.Archivo <> "", "Con archivo adjunto", "Sin archivo adjunto"))
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </fieldset>")
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">&nbsp;</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">")
StrSB.Append(" <fieldset>")
StrSB.Append(" <legend><h3>TAREAS</h3></legend>")
StrSB.Append(" <table>")
StrSB.Append(" <tr>")
StrSB.Append(" <td>")
If objEvento.GetEventos(-1, 1, -1, "-1", "-1", -1, -1, -1, -1, -1, CveEvento, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If objEvento.DtResultados.Rows.Count = 0 Then
StrSB.Append(" <div>")
StrSB.Append(" <table cellspacing=""0"" rules=""all"" border=""1"" style=""width: 980px; border-collapse: collapse;"">")
StrSB.Append(" <tr class=""Texto"">")
StrSB.Append(" <td colspan=""6"">MINUTA SIN TAREAS</td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </div>")
Else
StrSB.Append(" <div>")
StrSB.Append(" <table border=""1"" style=""border-collapse: collapse;"" width=""980px"" cellpadding=""0"" cellspacing=""0"">")
StrSB.Append(" <tr class=""Titulos"">")
StrSB.Append(" <td style=""width: 202px;"">Asunto</td>")
StrSB.Append(" <td>Descripcion</td>")
StrSB.Append(" <td style=""width: 152px"">Para</td>")
StrSB.Append(" <td style=""width: 112px"">Inicio</td>")
StrSB.Append(" <td style=""width: 112px"">Fin</td>")
StrSB.Append(" <td style=""width: 102px"">Estatus</td>")
StrSB.Append(" </tr>")
'StrSB.Append(" </table>")
'StrSB.Append(" <div>")
'StrSB.Append(" <table cellspacing=""0"" rules=""all"" border=""1"" style=""width: 980px; border-collapse: collapse;"">")
Dim i As Integer = 0
For Each RowTarea As DataRow In objEvento.DtResultados.FiltraParametros("", "FechaIng Desc").Rows
StrSB.AppendFormat(" <tr class=""{0}"">", If(i Mod 2 = 0, "Texto", "TextoAlterno"))
StrSB.AppendFormat(" <td style=""width: 200px;text-align:left;"">&#160;{0}</td>", RowTarea("Asunto"))
StrSB.AppendFormat(" <td style=""text-align:left;"">&#160;{0}</td>", RowTarea("Descripcion"))
StrSB.AppendFormat(" <td style=""width: 150px;text-align:left;"">&#160;{0}</td>", RowTarea("UsuarioPara"))
StrSB.AppendFormat(" <td style=""width: 110px;text-align:left;"">{0}</td>", RowTarea("FechaInicio").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm"))
StrSB.AppendFormat(" <td style=""width: 110px;text-align:left;"">{0}</td>", RowTarea("FechaFin").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm"))
StrSB.AppendFormat(" <td style=""width: 100px;text-align:left;""><a class=""Texto"" href=""{0}/OI/EventoDetalle.aspx?CveEvento={1}"">{2}</a></td>", DireccionURL, RowTarea("CveEvento"), RowTarea("EventoEstatus"))
StrSB.Append(" </tr>")
i = i + 1
Next
StrSB.Append(" </table>")
StrSB.Append(" </div>")
End If
End If
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </fieldset>")
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">&nbsp;</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">")
StrSB.Append(" <fieldset>")
StrSB.Append(" <legend><h3>AGENDAS</h3></legend>")
StrSB.Append(" <table>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">")
If objEvento.GetEventos(-1, 2, -1, "-1", "-1", -1, -1, -1, -1, -1, CveEvento, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If objEvento.DtResultados.Rows.Count = 0 Then
StrSB.Append(" <div>")
StrSB.Append(" <table cellspacing=""0"" rules=""all"" border=""1"" style=""width: 980px; border-collapse: collapse;"">")
StrSB.Append(" <tr class=""Texto"">")
StrSB.Append(" <td colspan=""6"">MINUTA SIN AGENDAS</td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </div>")
Else
StrSB.Append(" <div>")
StrSB.Append(" <table border=""1"" style=""border-collapse: collapse;"" width=""980px"" cellpadding=""0"" cellspacing=""0"">")
StrSB.Append(" <tr class=""Titulos"">")
StrSB.Append(" <td style=""width: 202px"">Asunto</td>")
StrSB.Append(" <td>Descripcion</td>")
StrSB.Append(" <td style=""width: 152px"">Para</td>")
StrSB.Append(" <td style=""width: 112px"">Fecha</td>")
StrSB.Append(" <td style=""width: 112px"">Tipo Agenda</td>")
StrSB.Append(" <td style=""width: 102px"">Estatus</td>")
StrSB.Append(" </tr>")
'StrSB.Append(" </table>")
'StrSB.Append(" <div>")
'StrSB.Append(" <table cellspacing=""0"" rules=""all"" border=""1"" style=""width: 980px; border-collapse: collapse;"">")
Dim i As Integer = 0
For Each RowAgenda As DataRow In objEvento.DtResultados.FiltraParametros("", "FechaIng Desc").Rows
StrSB.AppendFormat(" <tr class=""{0}"">", If(i Mod 2 = 0, "Texto", "TextoAlterno"))
StrSB.AppendFormat(" <td style=""width: 200px;text-align:left;"" >&#160;{0}</td>", RowAgenda("Asunto"))
StrSB.AppendFormat(" <td style=""text-align:left;"">&#160;{0}</td>", RowAgenda("Descripcion"))
StrSB.AppendFormat(" <td style=""width: 150px;text-align:left;"">&#160;{0}</td>", RowAgenda("UsuarioPara"))
StrSB.AppendFormat(" <td style=""width: 110px;text-align:left;"">{0}</td>", RowAgenda("FechaInicio").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm"))
StrSB.AppendFormat(" <td style=""width: 110px;text-align:left;"">{0}</td>", RowAgenda("AgendaTipo"))
'StrSB.AppendFormat(" <td style=""width: 100px;text-align:left;""><a class=""Texto"" href=""{0}/OI/EventoDetalle.aspx?CveEvento={1}"">{2}</a></td>", DireccionURL, RowAgenda("CveEvento"), RowAgenda("EventoEstatus"))
StrSB.AppendFormat(" <td style=""width: 100px;text-align:left;"">{0}</td>", RowAgenda("EventoEstatus"))
StrSB.Append(" </tr>")
i = i + 1
Next
StrSB.Append(" </table>")
StrSB.Append(" </div>")
End If
End If
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </fieldset>")
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">&nbsp;</td>")
StrSB.Append(" </tr>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">")
StrSB.Append(" <fieldset>")
StrSB.Append(" <legend><h3>ARCHIVOS</h3></legend>")
StrSB.Append(" <table>")
StrSB.Append(" <tr>")
StrSB.Append(" <td colspan=""2"">")
If objEvento.GetEventosComentarios(CveEvento) Then
If objEvento.DtResultados.Rows.Count = 0 Then
StrSB.Append(" <div>")
StrSB.Append(" <table cellspacing=""0"" rules=""all"" border=""1"" style=""width: 980px; border-collapse: collapse;"">")
StrSB.Append(" <tr class=""Texto"">")
StrSB.Append(" <td colspan=""6"">MINUTA SIN ARCHIVOS</td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </div>")
Else
StrSB.Append(" <div>")
StrSB.Append(" <table border=""1"" style=""border-collapse: collapse;"" width=""980px"" cellpadding=""0"" cellspacing=""0"">")
StrSB.Append(" <tr class=""Titulos"">")
StrSB.Append(" <td>Descripcion</td>")
StrSB.Append(" <td style=""width: 152px"">Adjunto</td>")
StrSB.Append(" </tr>")
'StrSB.Append(" </table>")
'StrSB.Append(" <div>")
'StrSB.Append(" <table cellspacing=""0"" rules=""all"" border=""1"" style=""width: 980px; border-collapse: collapse;"">")
Dim i As Integer = 0
For Each RowArchivo As DataRow In objEvento.DtResultados.FiltraParametros("", "FechaIng Desc").Rows
StrSB.AppendFormat(" <tr class=""{0}"">", If(i Mod 2 = 0, "Texto", "TextoAlterno"))
StrSB.AppendFormat(" <td style=""text-align:left;"">&#160;{0}</td>", RowArchivo("EventoComentario"))
'StrSB.AppendFormat(" <td style=""width: 150px;""><a class=""Texto"" href=""{0}/Empresas/{1}/OI/OI_C{2}"">Ver</a></td>", DireccionURL, UsuarioActual.CveEmpresa, RowArchivo("Archivo"))
If RowArchivo("Archivo").ToString <> "" Then
StrSB.AppendFormat(" <td style=""text-align:left;"">&#160;{0}</td>", "Si")
Else
StrSB.AppendFormat(" <td style=""text-align:left;"">&#160;{0}</td>", "No")
End If
StrSB.Append(" </tr>")
i = i + 1
Next
StrSB.Append(" </table>")
StrSB.Append(" </div>")
End If
End If
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append(" </fieldset>")
StrSB.Append(" </td>")
StrSB.Append(" </tr>")
StrSB.Append(" </table>")
StrSB.Append("</body>")
'If Not DT Is Nothing AndAlso DT.Rows.Count > 0 Then
' 'StrSB.Append(" <tr> ")
' 'StrSB.Append(" <td align=""center"" class=""Titulos"" colspan=""2"">&nbsp;Comentarios</td> ")
' 'StrSB.Append(" </tr> ")
' StrSB.Append(" <tr> ")
' StrSB.Append(" <td colspan=""2""> ")
' StrSB.Append(" <fieldset> ")
' StrSB.Append(" <legend>Comentarios</legend> ")
' StrSB.Append(" <table width=""100%""> <tr style='background-color:gray;color:White;font-family:Verdana;font-size:10px;text-align:center;vertical-align:middle;font-weight:bold;height:20px;text-decoration:none;'><th scope='col' style='width: 70px'>Fecha</th><th scope='col' style='width: 80px'>Usuario</th><th scope='col' >Comentario</th></tr>")
' 'StrSB.Append(" <table border=""1"" rules=""all"" style=""border-collapse: collapse;"" width=""100%""><tr class='texto' style='text-align:center;'><td>Fecha</td><td>Usuario</td><td>Comentario</td></tr> ")
' For i As Integer = 0 To DT.Rows.Count - 1
' StrSB.AppendFormat(" <tr class='{0}'> ", If(i Mod 2 = 0, "Texto", "TextoAlterno"))
' StrSB.AppendFormat(" <td width=""100px"">{0}</td> ", DT.Rows(i)("FechaIng"))
' StrSB.AppendFormat(" <td width=""150px"">{0}</td> ", DT.Rows(i)("NombreUsuario"))
' StrSB.AppendFormat(" <td>{0}</td> ", DT.Rows(i)("EventoComentario"))
' StrSB.Append(" </tr> ")
' Next
' StrSB.Append(" </table> ")
' StrSB.Append(" </fieldset> ")
' StrSB.Append(" </td> ")
' StrSB.Append(" </tr> ")
' DT.Dispose()
'End If
StrSB.Append("</html> ")
End If
Return StrSB
End Function
Private Sub MandaCorreo()
Dim Mail As New ClsSisMail()
Mail.SendMail(EmpresaNotificaciones, ViewState("Para").ToString, ViewState("Asunto").ToString, ViewState("Body").ToString, CCP:=ViewState("ArrayCC").ToString)
'Mail.Mandacorreo(EmpresaNotificaciones, ViewState("Para").ToString, ViewState("Asunto").ToString, ViewState("Body").ToString, CType(ViewState("ArrayCC"), String()))
End Sub
Protected Sub lbAgregarArchivo_Click(sender As Object, e As EventArgs) Handles lbAgregarArchivo.Click
Dim ObjEventoBitacora As New ClsOIEventos
Dim Archivo As String = ""
Dim RutaGuardar As String = String.Format("{0}\OI\Comentarios\", UsuarioActual.Empresa.Ruta, UsuarioActual.CveEmpresa)
Dim RutaArchivo As String = String.Format("{0}\OI\Temp\{1}", UsuarioActual.Empresa.Ruta, Session("Eventos"))
If Session("Eventos") IsNot Nothing AndAlso File.Exists(RutaArchivo) Then
If Not Directory.Exists(RutaGuardar) Then Directory.CreateDirectory(RutaGuardar)
Archivo = Path.GetExtension(Session("Eventos").ToString)
End If
If ObjEventoBitacora.AddEventoComentario(CveEvento, TxtOBs.Text.Trim, Archivo, UsuarioActual.CveUsuario) > 0 Then
If Archivo <> "" Then
File.Move(RutaArchivo, String.Format("{0}OI{1}{2}", RutaGuardar, ObjEventoBitacora.CveEventoComentario, Path.GetExtension(Archivo)))
Session("Eventos") = ""
End If
TxtOBs.Text = ""
CargaDetallesArchivos("")
End If
ObjEventoBitacora.Dispose()
End Sub
Protected Sub GvEventosDetalleArchivos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEventosDetalleArchivos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex >= 0 Then
If e.Row.DBCampo("Archivo").ToString <> "" Then
e.Row.FCHyperLink("HplA").Visible = True
e.Row.FCHyperLink("HplA").NavigateUrl = String.Format("/Empresas/{0}/OI/Comentarios/OI{1}", UsuarioActual.CveEmpresa, e.Row.DBCampo("Archivo").ToString)
End If
End If
End If
End Sub
#Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim gvi As Integer = 0
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0)
gvi = Arg(1).ToEntero
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
Campo = Campo.Substring(0, Campo.Length - 1)
If ViewState(String.Format("O{0}", Campo, gvi)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo, gvi)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo, gvi)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo, gvi)).ToString
ViewState("Orden") = Orden
CargaGrid(Orden, gvi)
End Sub
Private Sub CargaGrid(Orden As String, gvi As Integer)
If gvi = 0 Then
CargaDetallesTareas(Orden)
ViewState("OrdenTarea") = Orden
ElseIf gvi = 1 Then
CargaDetallesAgendas(Orden)
ViewState("OrdenAgenda") = Orden
ElseIf gvi = 2 Then
CargaDetallesArchivos(Orden)
ViewState("OrdenArchivo") = Orden
End If
End Sub
#End Region
End Class