369 lines
18 KiB
C#
369 lines
18 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
|
|
public partial class OI_RepReuniones : ClsPaginas
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// ORDEN ASIGNADAS
|
|
ViewState["Orden"] = "";
|
|
|
|
CargaFiltros();
|
|
CargaDatosOIMinutas();
|
|
CargaDatosReunion();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CargaFiltros()
|
|
{
|
|
TxtFechaI.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString();
|
|
TxtFechaF.Text = DateTime.Now.ToShortDateString();
|
|
TxtCFechaInicio.Text = TxtFechaI.Text;
|
|
TxtCFechaFin.Text = TxtFechaF.Text;
|
|
}
|
|
|
|
public void CargaDatosReunion()
|
|
{
|
|
GVConvocatoria.DataSource = new DataTable();
|
|
using (ClsOIEventos ObjProspectos = new ClsOIEventos())
|
|
{
|
|
DateTime FechaI, FechaF;
|
|
FechaI = TxtCFechaInicio.Text.ToDate();
|
|
FechaF = TxtCFechaFin.Text.ToDate();
|
|
|
|
if (ObjProspectos.GetRepEventos(-1, 11, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FechaI, FechaF))
|
|
{ GVConvocatoria.DataSource = ObjProspectos.DtResultados.FiltraParametros("", "FechaInicio DESC"); }
|
|
}
|
|
|
|
GVConvocatoria.DataBind();
|
|
UpContenido.Update();
|
|
}
|
|
public void CargaDatosOIMinutas()
|
|
{
|
|
using (ClsOIEventos ObjProspectos = new ClsOIEventos())
|
|
{
|
|
|
|
|
|
DateTime FechaI, FechaF;
|
|
int CveEventoEstatus;
|
|
FechaI = TxtFechaI.Text.ToDate();
|
|
FechaF = TxtFechaF.Text.ToDate();
|
|
if (DdlEventoEstatus.SelectedValue.ToEntero() > 0)
|
|
CveEventoEstatus = DdlEventoEstatus.SelectedValue.ToEntero();
|
|
else
|
|
CveEventoEstatus = -1;
|
|
|
|
if (ObjProspectos.GetRepEventos(-1, 5, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FechaI, FechaF))
|
|
ViewState["DTOIMinutas"] = ObjProspectos.DtResultados;
|
|
|
|
}
|
|
|
|
if (ViewState["Orden"].ToString() != string.Empty) { CargaGridOIMinutas(ViewState["Orden"].ToString()); }
|
|
else { CargaGridOIMinutas(""); }
|
|
|
|
UpContenido.Update();
|
|
}
|
|
|
|
protected void GvDatosOIMinutas_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
// e.Row.Cells(0).Width = Unit.Pixel(100) 'FechaInicio
|
|
// e.Row.Cells(1).Width = Unit.Pixel(200) 'Asunto
|
|
// e.Row.Cells(2).Width = Unit.Pixel(550) 'Descripcion
|
|
// e.Row.Cells(3).Width = Unit.Pixel(70) 'TareasTotal
|
|
|
|
//e.Row.FCLiteral("LtlFechaInicio").Text = string.Format("<a class=\"Texto\" href=\"/OI/MinutaDetalle.aspx?CveEvento={0}\">{1}</a>", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("FechaInicio").ToDateTime().ToString("dd/MM/yyyy"));
|
|
//e.Row.FCLiteral("LtlAsunto").Text = string.Format("<a class=\"Texto\" href=\"/OI/MinutaDetalle.aspx?CveEvento={0}\">{1}</a>", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("Asunto"));
|
|
}
|
|
}
|
|
|
|
//protected void LbOrden_Click(object sender, EventArgs e)
|
|
//{
|
|
// string Orden = "";
|
|
// string Campo = "";
|
|
// Literal Literal = null/* TODO Change to default(_) if this is not a reference type */;
|
|
// const string OrdenInicial = "";
|
|
// string[] Arg = new string[3];
|
|
|
|
// Arg = (LinkButton)sender.CommandArgument().ToString.Split(';');
|
|
// Campo = Arg[0];
|
|
// Literal = (Literal)(LinkButton)sender.NamingContainer.FindControl("Img" + Campo.Replace(",", "_"));
|
|
|
|
// if (ViewState(string.Format("O{0}", Campo)) != null && ViewState(string.Format("O{0}", Campo)).ToString == string.Format("{0} DESC", Campo))
|
|
// {
|
|
// 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)) = string.Format("{0} DESC", Campo);
|
|
// Literal.Text = string.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>");
|
|
// }
|
|
// Orden = OrdenInicial + ViewState(string.Format("O{0}", Campo)).ToString;
|
|
// ViewState("Orden") = Orden;
|
|
// CargaGridOIMinutas(Orden);
|
|
//}
|
|
|
|
private void CargaGridOIMinutas(string Orden)
|
|
{
|
|
if (Orden != string.Empty)
|
|
{
|
|
DataView DV = new DataView((DataTable)ViewState["DTOIMinutas"], "", Orden, DataViewRowState.CurrentRows);
|
|
GvDatosOIMinutas.DataSource = DV.ToTable();
|
|
DV.Dispose();
|
|
}
|
|
else { GvDatosOIMinutas.DataSource = (DataTable)ViewState["DTOIMinutas"]; }
|
|
GvDatosOIMinutas.DataBind();
|
|
}
|
|
|
|
protected void BtnConsultar_Click(object sender, EventArgs e)
|
|
{
|
|
CargaDatosOIMinutas();
|
|
UpContenido.Update();
|
|
}
|
|
|
|
protected void BtnCargarReunion_Click(object sender, EventArgs e)
|
|
{
|
|
CargaDatosReunion();
|
|
UpContenido.Update();
|
|
|
|
}
|
|
|
|
protected void LnkAddMinuta_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvrow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
|
int RCveEvento = gvrow.DataKey("CveEvento").ToEntero();
|
|
bool Continuar = false;
|
|
int CveEvento = -1;
|
|
List<int> LCveUsuarioCCP = new List<int>();
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
if (ObjOI_E.GetEventosUsuario2(RCveEvento, UsuarioActual.CveEmpresa))
|
|
{
|
|
LCveUsuarioCCP.Clear();
|
|
foreach (System.Data.DataRow item in ObjOI_E.DtResultados.Select("CveEvento >0"))
|
|
{
|
|
int CveUsuario = item["CveUsuario"].ToString().ToEntero();
|
|
LCveUsuarioCCP.Add(CveUsuario);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
int Folio = -1;
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
if (ObjOI_E.GetEventos2(RCveEvento, UsuarioActual.CveEmpresa) && ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
System.Data.DataRow drow = ObjOI_E.DtResultados.Rows[0];
|
|
ObjOI_E.IniciaTransacSQL();
|
|
Continuar = ObjOI_E.AddOI_Eventos2(OITipoEventos.Minuta, drow["Asunto"].ToString(), drow["descripcion"].ToString(), drow["Prioridad"].ToString().ToEntero(), drow["cveUsuarioDe"].ToString().ToEntero(),
|
|
drow["cveUsuarioPara"].ToString().ToEntero(), string.Format("{0:yyyy/MM/dd HH:mm}", drow["fechaInicio"]), string.Format("{0:yyyy/MM/dd HH:mm}", drow["fechaFin"]), drow["cveRevision"].ToString().ToEntero(), "",
|
|
LCveUsuarioCCP, new List<string>(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CorreoExterno: drow["CorreoExterno"].ToString(), Lugar: drow["Lugar"].ToString(), CveEventoPadre: RCveEvento);
|
|
CveEvento = ObjOI_E.CveEvento;
|
|
Folio = ObjOI_E.Folio;
|
|
if (CveEvento == 0)
|
|
{
|
|
Continuar = false;
|
|
}
|
|
if (Continuar) { Continuar = ObjOI_E.UpdateEstatusEvento2(2, -1, RCveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); }
|
|
if (Continuar)
|
|
{
|
|
ObjOI_E.Commit();
|
|
ObjEventosCorreo o = ObjOI_E.objCorreo;
|
|
}
|
|
else
|
|
{
|
|
ObjOI_E.RollBack();
|
|
Continuar = false;
|
|
}
|
|
}
|
|
}
|
|
if (Continuar)
|
|
{
|
|
BtnCargarReunion_Click(null, null);
|
|
this.Alert(string.Format("Se ha iniciado la minuta<br /> para ir a la minuta <a href=\"/OI/MinutaDetalle.aspx?CveEvento={0}\">click aquí</a>", CveEvento), ModExtensiones.TipoMensaje.ToastInformacion, "", 0);
|
|
}
|
|
}
|
|
|
|
protected void LnkEnviarRecordatorio_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
GridViewRow gvrow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
|
int RCveEvento = gvrow.DataKey("CveEvento").ToEntero();
|
|
enviarConvocatoria(RCveEvento);
|
|
Alert("se ha enviado la convocatoria",ModExtensiones.TipoMensaje.ToastInformacion);
|
|
}
|
|
|
|
private string GetDominio(string addstr = "")
|
|
{
|
|
return string.Format("{0}/{1}", HttpContext.Current.Request.Url.ToString().Replace(HttpContext.Current.Request.Url.PathAndQuery, ""), addstr);
|
|
}
|
|
|
|
private void enviarConvocatoria(int RCveEvento)
|
|
{
|
|
|
|
string Body;
|
|
Asuntoconvocatoria = "Convocatoria: ";
|
|
Body = MailgetBodyConvocatoria(RCveEvento);
|
|
string ArrayCC = "";
|
|
//ViewState("Para") = GlobalDTUsuarios(CveUsuarioIng)(0)("correo").ToString;
|
|
//ViewState("Asunto") = string.Format("SIG - Minuta {0}", TxtAsunto.Text);
|
|
//ViewState("Body") = Body;
|
|
//System.Threading.Thread Hilo = new System.Threading.Thread(MandaCorreo);
|
|
//Hilo.Start();
|
|
string abre = "";
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
if (ObjOI_E.GetEventosUsuario2(RCveEvento, UsuarioActual.CveEmpresa) && ObjOI_E.DtResultados != null && ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
foreach (System.Data.DataRow item in ObjOI_E.DtResultados.Rows)
|
|
{
|
|
if (item["Correo"].ToString().Trim().Length > 0)
|
|
ArrayCC = string.Format("{0}{1}{2}", ArrayCC, abre, item["Correo"].ToString().Trim());
|
|
abre = ";";
|
|
}
|
|
}
|
|
}
|
|
List<ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>();
|
|
ClsSisMail.ArchivoMail mailfile = new ClsSisMail.ArchivoMail { Ruta = string.Format("{0}Imagenes\\Bell.png", ModExtensiones.DirectorioBaseEmpresas), NombreArchivo = "Bell.png" };
|
|
LSRutasMail.Add(mailfile);
|
|
ClsSisMail.ArchivoMail itemMail = new ClsSisMail.ArchivoMail();
|
|
|
|
ClsSisMail Mail = new ClsSisMail();
|
|
Mail.SendMail(EmpresaNotificaciones, get_GlobalDTUsuarios(UsuarioActual.CveUsuario).Rows[0]["correo"].ToString()+";" + CorreoExternoconvocatoria, Asuntoconvocatoria, Body, CCP: ArrayCC, Archivos: LSRutasMail);
|
|
}
|
|
private string Asuntoconvocatoria;
|
|
private string CorreoExternoconvocatoria;
|
|
private string MailgetBodyConvocatoria(int RCveEvento)
|
|
{
|
|
|
|
int Folio = 0; string Link = ""; string Asunto = ""; string Acuerdos = ""; string Descripcion = ""; DateTime DFechai = DateTime.MinValue; DateTime DFechaf = DateTime.MinValue;
|
|
string UsuarioDe = "";
|
|
string UsuarioPara = "";
|
|
string UsuarioDeAbr = "";
|
|
System.Data.DataTable dttareas;
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
if (ObjOI_E.GetEventos2(RCveEvento, UsuarioActual.CveEmpresa) && ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
System.Data.DataRow drow = ObjOI_E.DtResultados.Rows[0];
|
|
UsuarioDe = drow["NombreRegistro"].ToString();
|
|
Folio = drow["Folio"].ToString().ToEntero();
|
|
Link = GetDominio(string.Format("OI/ConvocatoriaDetalle.aspx?CveEvento={0}", RCveEvento));
|
|
Asuntoconvocatoria = string.Format("⏰ {1} te ha invitado a una reunión, {0}", drow["Asunto"].ToString(), UsuarioDe);
|
|
CorreoExternoconvocatoria =drow["CorreoExterno"].ToString();
|
|
Asunto = drow["Asunto"].ToString();
|
|
Descripcion = drow["Descripcion"].ToString();
|
|
Acuerdos = drow["Acuerdos"].ToString();
|
|
DateTime.TryParse(drow["FechaInicio"].ToString(), out DFechai);
|
|
DateTime.TryParse(drow["FechaFin"].ToString(), out DFechaf);
|
|
//OIE.[CveEvento], OIE.[CveTipoEvento], OIE.[Folio], OIE.[Asunto], OIE.[Descripcion], OIE.[Prioridad], OIE.[CveUsuarioDe], OIE.[CveUsuarioPara],
|
|
//OIE.[CveEventoEstatus], OIE.[FechaInicio], OIE.[FechaFin], OIE.[FechaRealTermino], OIE.[CveRevision], OIE.[Archivo], OIE.[FechaIng],
|
|
//OIE.[CveUsuarioIng], OIE.[CveEmpresa], OIE.[CveUsuarioModifico], OIE.[Avance] NombreRegistro
|
|
}
|
|
ObjOI_E.GetEventos2(-1, UsuarioActual.CveEmpresa, RCveEvento);
|
|
dttareas = ObjOI_E.DtResultados;
|
|
}
|
|
if (UsuarioDe != null)
|
|
{
|
|
string[] str = UsuarioDe.Split(' ');
|
|
if (str.Length > 0 && str[0].Length > 0)
|
|
{
|
|
UsuarioDeAbr = str[0].Substring(0, 1).ToUpper();
|
|
}
|
|
if (str.Length > 1 && str[1].Length > 0)
|
|
{
|
|
UsuarioDeAbr = string.Format("{0}{1}", UsuarioDeAbr, str[1].Substring(0, 1).ToUpper());
|
|
|
|
}
|
|
}
|
|
string UsuariParaAbr = "";
|
|
if (UsuarioPara != null)
|
|
{
|
|
string[] str = UsuarioPara.Split(' ');
|
|
if (str.Length > 0 && str[0].Length > 0)
|
|
{
|
|
UsuariParaAbr = str[0].Substring(0, 1).ToUpper();
|
|
}
|
|
if (str.Length > 1 && str[1].Length > 0)
|
|
{
|
|
UsuariParaAbr = string.Format("{0}{1}", UsuariParaAbr, str[1].Substring(0, 1).ToUpper());
|
|
|
|
}
|
|
}
|
|
|
|
StringBuilder StrMail = new StringBuilder();
|
|
StrMail.Append("<html><head><meta charset=\"UTF-8\"></head><body>");
|
|
StrMail.Append(" <div style=\"text-align: center;\">");
|
|
StrMail.Append(" <div style=\"display: inline-block; width: 800px; text-align: left;\">");
|
|
StrMail.Append(" <div style=\"padding: 25px 10px 5px 10px; color: #6C6C6C; font-size: 40px; font-weight: bold;\">SIG Notificaciones</div>");
|
|
StrMail.Append(" <div style=\"border: 1px solid #ED7D31;\"></div>");
|
|
StrMail.Append(" <div style=\"padding: 10px 10px; text-align: center;\">");
|
|
StrMail.Append(" <table style=\"width: 100%\">");
|
|
StrMail.Append(" <tr>");
|
|
StrMail.Append(" <td style=\"width: 60%; text-align:left;\" >");
|
|
StrMail.Append(" <span style=\"color: #6C6C6C; font-size: 17px;\">Moderador:</span>");
|
|
StrMail.Append($" <span style=\"color: #ED7D31; font-size: 22px;font-weight: bold;\">{UsuarioDeAbr}</span>");
|
|
StrMail.Append($" <span style=\"color: #6C6C6C; font-size: 17px;\">{UsuarioDe}</span><br />");
|
|
StrMail.Append(" <span style=\"color: #6C6C6C; font-size: 17px;\">Fecha:</span>");
|
|
StrMail.Append($" <span style=\"color: #6C6C6C; font-size: 17px;\">{DFechai: dd} de {DFechai: MMMM yyyy HH:mm}</span><br />");
|
|
StrMail.Append(" </td>");
|
|
StrMail.Append(" <td style=\"width: 20%;\">");
|
|
StrMail.Append(" <span style=\"color: #8877A9; font-size: 25px; font-weight: bold;\">Convocatoria </span>");
|
|
StrMail.Append(" </td>");
|
|
StrMail.Append(" <td style=\"width: 100px;\">");
|
|
StrMail.Append(" <img src=\"Bell.png\" style=\"width: 100px;height: 100px;\">");
|
|
StrMail.Append(" </td>");
|
|
StrMail.Append(" </tr>");
|
|
StrMail.Append(" </table>");
|
|
StrMail.Append(" <div style=\"text-align: left;color:#262626\">");
|
|
StrMail.Append("");
|
|
StrMail.Append(" <div style=\"background-color: #D9D9D9; padding: 5px;\">");
|
|
StrMail.Append($" <span style=\"font-size: 32px; \">{Asunto}</span>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" <div style=\"background-color: #D9D9D9; padding: 5px; padding: 5px; padding-bottom: 25px;\">");
|
|
StrMail.Append(" <span style=\"font-size: 18px; font-weight: bold;\">Folio:</span>");
|
|
StrMail.Append($" <span style=\"font-size: 18px;\">{Folio}</span>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" <div style=\"background-color: #D9D9D9; padding: 5px; padding-bottom: 40px;\">");
|
|
StrMail.Append($" <span style=\"font-size: 18px;\">{Descripcion}</span>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" <br />");
|
|
StrMail.Append(" <div style=\"background-color: #D0CECE; padding: 5px;\">");
|
|
StrMail.Append(" <span style=\"font-size: 20px; color: #70AD47; font-weight: bold;\">ORDEN DEL DÍA</span>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" <div style=\"text-align: left;color:#262626\">");
|
|
StrMail.Append(Acuerdos);
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" <br />");
|
|
|
|
StrMail.Append(" <br />");
|
|
StrMail.Append(" <br />");
|
|
StrMail.Append($" <a href=\"{Link}\" style=\"padding: 10px 20px; text-align: center;\">Minuta</a>");
|
|
StrMail.Append(" <br />");
|
|
StrMail.Append(" <br />");
|
|
StrMail.Append(" <div>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append(" </div>");
|
|
StrMail.Append("</html></body>");
|
|
return StrMail.ToString();
|
|
}
|
|
} |