796 lines
36 KiB
C#
796 lines
36 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
|
|
public partial class OI_ConvocatoriaDetalle : ClsPaginas
|
|
{
|
|
|
|
#region Propiedades
|
|
public const string iddivAgregarTema = "divModalAgregartema";
|
|
public const string iddivTomarAsistencia = "iddivTomarAsistencia";
|
|
public const string iddivAgregarMiembros = "iddivAgregarMiembros";
|
|
public int CveEventoMinuta { get { return ViewState["CveEventoMinuta"] != null ? ViewState["CveEventoMinuta"].ToString().ToEntero() : 0; } set { ViewState["CveEventoMinuta"] = value; } }
|
|
public int RCveEvento { get { return ViewState["RCveEvento"] != null ? ViewState["RCveEvento"].ToString().ToEntero() : 0; } set { ViewState["RCveEvento"] = value; } }
|
|
public int RCveEventoPadre { get { return ViewState["RCveEventoPadre"] != null ? ViewState["RCveEventoPadre"].ToString().ToEntero() : 0; } set { ViewState["RCveEventoPadre"] = value; } }
|
|
public bool EsNuevo { get { return Convert.ToBoolean(ViewState["EsNuevo"]); } set { ViewState["EsNuevo"] = value; } }
|
|
public List<int> LCveUsuarioCCP { get { if (ViewState["LCveUsuarioCCP"] == null) { ViewState["LCveUsuarioCCP"] = new List<int>(); } return (List<int>)ViewState["LCveUsuarioCCP"]; } set { ViewState["LCveUsuarioCCP"] = value; } }
|
|
public List<int> LcveuserVisto { get { if (ViewState["LcveuserVisto"] == null) { ViewState["LcveuserVisto"] = new List<int>(); } return (List<int>)ViewState["LcveuserVisto"]; } set { ViewState["LcveuserVisto"] = value; } }
|
|
public int CveUsuarioDe { get { return ViewState["CveUsuarioDe"].ToString().ToEntero(); } set { ViewState["CveUsuarioDe"] = value; } }
|
|
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
EsNuevo = true;
|
|
CargaTemas();
|
|
cargaUsuarios();
|
|
|
|
if (Request["CveEvento"] != null)
|
|
{
|
|
RCveEvento = Request["CveEvento"].ToString().ToEntero();
|
|
}
|
|
if (Request["CveEventoPadre"] != null)
|
|
{
|
|
|
|
RCveEventoPadre = Request["CveEventoPadre"].ToString().ToEntero();
|
|
}
|
|
if (RCveEvento > 0)
|
|
{
|
|
LnkEnviarCorreo.Visible = true;
|
|
EsNuevo = false;
|
|
//LnkGuardar.Visible = false;
|
|
loadConvocatoria();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void CargaTemas()
|
|
{
|
|
DdlTema.DataSource = get_GlobalDTOIRevision(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("CveUsuario = {0}", UsuarioActual.CveUsuario));
|
|
DdlTema.DataBind();
|
|
DdlTema.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
}
|
|
private void cargaUsuarios()
|
|
{
|
|
string FiltroAD = "";
|
|
|
|
GVUsuariosB.DataSource = get_GlobalDTUsuarios().FiltraParametros(String.Format("CveEmpresa = {0} AND Estatus =1 {1}", UsuarioActual.CveEmpresa, FiltroAD), "Rol ASC");
|
|
GVUsuarios.DataSource = GVUsuariosB.DataSource;
|
|
DdlModera.DataSource = GVUsuariosB.DataSource;
|
|
DdlModerador.DataSource = GVUsuariosB.DataSource;
|
|
GVUsuariosB.DataBind();
|
|
DdlModerador.DataBind();
|
|
DdlModera.DataBind();
|
|
GVUsuarios.DataBind();
|
|
DdlModerador.SelectedValueExist(UsuarioActual.CveUsuario.ToString());
|
|
}
|
|
|
|
private void loadConvocatoria()
|
|
{
|
|
int CveEventoHijo = 0;
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
|
|
if (ObjOI_E.GetEventos2(-1, UsuarioActual.CveEmpresa, RCveEvento) && ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
System.Data.DataRow drow = ObjOI_E.DtResultados.Rows[0];
|
|
CveEventoHijo = drow["CveEvento"].ToString().ToEntero();
|
|
CveEventoMinuta = drow["CveEvento"].ToString().ToEntero();
|
|
LnkOpenModalAsistencia.Visible = true;
|
|
}
|
|
if (ObjOI_E.GetEventos2(RCveEvento, UsuarioActual.CveEmpresa) && ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
System.Data.DataRow drow = ObjOI_E.DtResultados.Rows[0];
|
|
portletMiembros.Visible = false;
|
|
pnlmiembrosvista.Visible = true;
|
|
TxtAsunto.Text = drow["Asunto"].ToString();
|
|
TxtDescripcion.Text = drow["Descripcion"].ToString();
|
|
TxtAsistentesExternos.Text = drow["Asistencia"].ToString();
|
|
TxtDuracion.Text = drow["Duracion"].ToString();
|
|
DdlPrioridad.SelectedValueExist(drow["Prioridad"].ToString());
|
|
txtFechaI.Text = string.Format("{0:dd/MM/yyyy HH:mm}", drow["FechaInicio"]);
|
|
txtFechaF.Text = string.Format("{0:dd/MM/yyyy HH:mm}", drow["FechaFin"]);
|
|
TxtLugar.Text = string.Format("{0}", drow["Lugar"]);
|
|
TxtCorreoExterno.Text = string.Format("{0}", drow["CorreoExterno"]);
|
|
TxtOrdendeldia.Text = string.Format("{0}", drow["Acuerdos"]).Replace("<", "< ");
|
|
DdlTema.SelectedValueExist(drow["CveRevision"].ToString());
|
|
int CveUsuarioIng = drow["CveUsuarioIng"].ToString().ToEntero();
|
|
CveUsuarioDe = drow["CveUsuarioDe"].ToString().ToEntero();
|
|
int CveEventoEstatus = drow["CveEventoEstatus"].ToString().ToEntero();
|
|
bool permisoeditar = UsuarioActual.CveUsuario == CveUsuarioDe || UsuarioActual.CveUsuario == CveUsuarioIng;
|
|
LnkIniciar.Visible = permisoeditar && (CveEventoHijo <= 0);
|
|
HypIrMinuta.Visible = (CveEventoHijo > 0);
|
|
HypIrMinuta.NavigateUrl = string.Format("/OI/MinutaDetalle.aspx?CveEvento={0}", CveEventoHijo);
|
|
TxtAsunto.Enabled = permisoeditar;
|
|
TxtDescripcion.Enabled = permisoeditar;
|
|
txtFechaI.Enabled = permisoeditar;
|
|
txtFechaF.Enabled = permisoeditar;
|
|
TxtLugar.Enabled = permisoeditar;
|
|
TxtCorreoExterno.Enabled = permisoeditar;
|
|
TxtOrdendeldia.Enabled = permisoeditar;
|
|
if (ObjOI_E.GetEventosUsuario2(RCveEvento, UsuarioActual.CveEmpresa))
|
|
{
|
|
LCveUsuarioCCP.Clear();
|
|
LcveuserVisto.Clear();
|
|
foreach (System.Data.DataRow item in ObjOI_E.DtResultados.Select("CveEvento >0"))
|
|
{
|
|
int CveUsuario = item["CveUsuario"].ToString().ToEntero();
|
|
LCveUsuarioCCP.Add(CveUsuario);
|
|
if (item["Visto"].ToString().ToEntero() == 1)
|
|
{
|
|
LcveuserVisto.Add(CveUsuario);
|
|
}
|
|
}
|
|
}
|
|
SetUsuarios();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void SetUsuarios()
|
|
{
|
|
StringBuilder StrDeUser = new StringBuilder();
|
|
StringBuilder StrCCPara = new StringBuilder();
|
|
|
|
foreach (GridViewRow gvRow in GVUsuariosB.Rows)
|
|
{
|
|
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
chkCCpara.Checked = false;
|
|
|
|
if (EsNuevo)
|
|
{
|
|
chkCCpara.Enabled = true;
|
|
if (CveUsuario == UsuarioActual.CveUsuario)
|
|
{
|
|
chkCCpara.Checked = true;
|
|
chkCCpara.Enabled = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
chkCCpara.Enabled = false;
|
|
}
|
|
string palomitavisto = "";
|
|
string palomitasinver = "<i class=\"fa fa-check\" aria-hidden=\"true\"></i>";
|
|
if (CveUsuario == UsuarioActual.CveUsuario || CveUsuario.Contiene(LcveuserVisto.ToArray<int>()))
|
|
{
|
|
palomitavisto = palomitasinver;
|
|
palomitasinver = "";
|
|
}
|
|
if (CveUsuario == CveUsuarioDe)
|
|
{
|
|
chkCCpara.Checked = true;
|
|
StrDeUser.AppendFormat("{3}<span class=\"linkCorreo\" data-toggle=\"tooltip\" title=\"{1}\">{2}\"{0}\"</span>", gvRow.DataKey("Nombre").ToString(), gvRow.DataKey("Correo").ToString(), "", "");
|
|
|
|
}
|
|
else if (CveUsuario.Contiene(LCveUsuarioCCP.ToArray<int>()))
|
|
{
|
|
chkCCpara.Checked = true;
|
|
StrCCPara.AppendFormat("{3}<span class=\"linkCorreo cssnowrap\" data-toggle=\"tooltip\" title=\"{1}\">{2}\"{0}\"</span>; ", gvRow.DataKey("Nombre").ToString(), gvRow.DataKey("Correo").ToString(), "", "");
|
|
}
|
|
}
|
|
}
|
|
LtlDeUser.Text = StrDeUser.ToString();
|
|
int longitud = StrCCPara.ToString().Length;
|
|
if (longitud > 0)
|
|
{
|
|
LtlCCPara.Text = StrCCPara.ToString().Substring(0, longitud - 1);
|
|
|
|
}
|
|
else
|
|
{
|
|
LtlCCPara.Text = "";
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
protected void LnkUpUsuarios_Click(object sender, EventArgs e)
|
|
{
|
|
RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarMiembros));
|
|
LtlTituloUsuarios.Text = "Actualizar miembros";
|
|
BtnUpMiembros.Visible = true;
|
|
DdlModera.SelectedValueExist(CveUsuarioDe.ToString());
|
|
foreach (GridViewRow gvRow in GVUsuarios.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
chkCCpara.Checked = false;
|
|
chkCCpara.Enabled = true;
|
|
|
|
|
|
if ((CveUsuario == CveUsuarioDe))
|
|
{
|
|
if (CveUsuario == CveUsuarioDe)
|
|
{
|
|
chkCCpara.Checked = true;
|
|
}
|
|
}
|
|
else if (CveUsuario.Contiene(LCveUsuarioCCP.ToArray<int>()))
|
|
{
|
|
chkCCpara.Checked = true;
|
|
}
|
|
}
|
|
}
|
|
UpUsuarios.Update();
|
|
}
|
|
|
|
protected void BtnUpMiembros_Click(object sender, EventArgs e)
|
|
{
|
|
List<int> listaCCP = new List<int>();
|
|
int _cveUsuarioPara = -1;
|
|
|
|
foreach (GridViewRow gvRow in GVUsuarios.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
if (chkCCpara.Checked)
|
|
{
|
|
listaCCP.Add(CveUsuario);
|
|
//cveUsuarioDe = CveUsuario;
|
|
}
|
|
}
|
|
}
|
|
bool continuar = false;
|
|
using (ClsOIEventos oieve = new ClsOIEventos())
|
|
{
|
|
continuar = oieve.UpEventoMiembros(RCveEvento, _cveUsuarioPara, listaCCP, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario);
|
|
if (continuar)
|
|
{
|
|
}
|
|
}
|
|
if (continuar)
|
|
{
|
|
LCveUsuarioCCP = listaCCP;
|
|
//this.CveUsuariode = _cveUsuarioPara;
|
|
SetUsuarios();
|
|
//Setpermisos();
|
|
}
|
|
UpContenido.Update();
|
|
RegistraScript(string.Format("$('#{0}').modal('hide')", iddivAgregarMiembros));
|
|
}
|
|
|
|
protected void LnkAddTtemaModal_Click(object sender, EventArgs e)
|
|
{
|
|
RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarTema));
|
|
}
|
|
|
|
|
|
protected void LnkGuardar_Click(object sender, EventArgs e)
|
|
{
|
|
string errorMessage = "";
|
|
|
|
int cveUsuarioDe = DdlModerador.SelectedValue.ToEntero();
|
|
List<int> listaCCP = new List<int>();
|
|
int cveUsuarioPara = -1;
|
|
//string Nombrepara = "";
|
|
string Nombrede = "";
|
|
foreach (GridViewRow gvRow in GVUsuariosB.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
if (CveUsuario == cveUsuarioDe)
|
|
{
|
|
Nombrede = gvRow.DataKey("Nombre").ToString();
|
|
}
|
|
if (chkCCpara.Checked)
|
|
{
|
|
listaCCP.Add(CveUsuario);
|
|
//cveUsuarioDe = CveUsuario;
|
|
}
|
|
}
|
|
}
|
|
OITipoEventos cveTipoEvento = OITipoEventos.Convocatorias;
|
|
string asunto = TxtAsunto.Text;
|
|
string descripcion = TxtDescripcion.Text;
|
|
int prioridad = DdlPrioridad.SelectedValue.ToEntero();
|
|
string fechaInicio = "";
|
|
if (txtFechaI.Text.ToDateTimeExcat().Year <= 1999)
|
|
{
|
|
if (txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999)
|
|
{
|
|
errorMessage = "No se ingresó una fecha de inicio valida";
|
|
|
|
}
|
|
else
|
|
{
|
|
fechaInicio = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy/MM/dd HH:mm");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fechaInicio = txtFechaI.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm");
|
|
}
|
|
string fechaFin = "";
|
|
DateTime dfechaF;
|
|
if ((dfechaF = txtFechaI.Text.ToDateTimeExcat()).Year <= 1999)
|
|
{
|
|
if ((dfechaF = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy")).Year <= 1999)
|
|
{
|
|
errorMessage = "No se ingresó una fecha fin valida";
|
|
|
|
}
|
|
else
|
|
{
|
|
fechaFin = string.Format("{0:yyyy/MM/dd} 23:59", dfechaF);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fechaFin = dfechaF.ToString("yyyy/MM/dd HH:mm");
|
|
}
|
|
int cveRevision = DdlTema.SelectedValue.ToEntero();
|
|
string archivoname = "";
|
|
string rutaarchivoOri = "";
|
|
|
|
|
|
int cveUsuarioIng = UsuarioActual.CveUsuario;
|
|
int cveEmpresa = UsuarioActual.CveEmpresa;
|
|
int Folio = -1;
|
|
int CveEvento = -1;
|
|
|
|
if (cveUsuarioDe <= 0)
|
|
{
|
|
errorMessage = "Asegúrese de seleccionar al menos un miembro \"C C Para\"";
|
|
}
|
|
if (EsNuevo)
|
|
{
|
|
bool Continuar = false;
|
|
if (errorMessage.Length == 0)
|
|
{
|
|
|
|
List<string> chkList = new List<string>();
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
objOI.IniciaTransacSQL();
|
|
Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, CorreoExterno: TxtCorreoExterno.Text, Acuerdos: TxtOrdendeldia.Text.Replace("< ", "<"), Lugar: TxtLugar.Text, CveEventoPadre: (RCveEventoPadre > 0 ? RCveEventoPadre : -1), Duracion: TxtDuracion.Text);
|
|
|
|
CveEvento = objOI.CveEvento;
|
|
Folio = objOI.Folio;
|
|
if (CveEvento == 0)
|
|
{
|
|
Continuar = false;
|
|
}
|
|
if (Continuar)
|
|
{
|
|
objOI.Commit();
|
|
//ObjEventosCorreo o = objOI.objCorreo;
|
|
//string mailbody = MailgetBodyNuevatarea(o.Folio, o.Link, o.Asunto, o.Descripcion, string.Format("{0:dd/MM/yyyy}", fechaInicio.ToDateTime()), string.Format("{0:HH:mm horas}", fechaInicio.ToDateTime()), string.Format("{0:dd/MM/yyyy}", fechaFin.ToDateTime()), string.Format("{0:HH:mm horas}", fechaFin.ToDateTime()), o.Prioridad, o.Tema, Nombrede, Nombrepara);
|
|
//EnviarCorreo(UsuarioActual.Empresa, o.AsuntoCorreo, mailbody, o.mailPara, "");
|
|
}
|
|
else
|
|
{
|
|
objOI.RollBack();
|
|
Continuar = false;
|
|
}
|
|
}
|
|
if (Continuar && CveEvento > 0)
|
|
{
|
|
enviarConvocatoria(CveEvento);
|
|
if (rutaarchivoOri.Length > 0)
|
|
{
|
|
string ruta = string.Format("{0}OIFiles\\", UsuarioActual.Empresa.Ruta);
|
|
if (!System.IO.Directory.Exists(ruta))
|
|
{
|
|
System.IO.Directory.CreateDirectory(ruta);
|
|
}
|
|
ruta = string.Format("{0}{1}\\", ruta, Folio);
|
|
if (!System.IO.Directory.Exists(ruta))
|
|
{
|
|
System.IO.Directory.CreateDirectory(ruta);
|
|
}
|
|
ruta = string.Format("{0}{1}", ruta, archivoname);//, ArchivoExtencion);
|
|
System.IO.File.Move(rutaarchivoOri, ruta);
|
|
}
|
|
Alert(string.Format("Se ha agregadó la nueva convocatoria.<br/><a href=\"data:text/plain;charset=utf-8,{0}\" download=\"Agendar.ics\" class=\"btn btn-default\">⏰ Agendar</a>", HttpUtility.UrlEncode(ICString)), ModExtensiones.TipoMensaje.MsgInformacion, string.Format("location.replace(\"/OI/ConvocatoriaDetalle.aspx?CveEvento={0}\");", CveEvento));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
bool Continuar = true;
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
objOI.IniciaTransacSQL();
|
|
Continuar = objOI.UP_Eventos2(RCveEvento, asunto, descripcion, prioridad, fechaInicio, fechaFin, cveRevision, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
if (Continuar)
|
|
{
|
|
|
|
Continuar = objOI.UpdateEventoMinuta(asunto, descripcion, TxtOrdendeldia.Text.Replace("< ", "<"), dfechaF, "-1", RCveEvento);
|
|
}
|
|
if (Continuar)
|
|
{
|
|
objOI.Commit();
|
|
enviarConvocatoria(RCveEvento);
|
|
Alert(string.Format("Convocatoria actualizada.<br/><a href=\"data:text/plain;charset=utf-8,{0}\" download=\"Agendar.ics\" class=\"btn btn-default\">⏰ Agendar</a>", HttpUtility.UrlEncode(ICString)));
|
|
}
|
|
else
|
|
{
|
|
objOI.RollBack();
|
|
Continuar = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (errorMessage.Length > 0)
|
|
{
|
|
Alert(errorMessage, ModExtensiones.TipoMensaje.MsgAdvertencia);
|
|
|
|
}
|
|
}
|
|
protected void BtnAgregarTema_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
using (ClsOIEventos objoi = new ClsOIEventos())
|
|
{
|
|
if (objoi.AddRevisionesEventos(TxtTema.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
|
{
|
|
Alert(string.Format("El Tema \"{0}\" fue agregada con éxito.", TxtTema.Text.Trim()), ModExtensiones.TipoMensaje.MsgInformacion);
|
|
RegistraScript(string.Format("$('#{0}').modal('hide')", iddivAgregarTema));
|
|
TxtTema.Text = "";
|
|
set_GlobalDTOIRevision(-1, objoi.DtResultados);
|
|
CargaTemas();
|
|
UpContenido.Update();
|
|
}
|
|
else { Alert("Ocurrió un error al agregar la revisión. Por favor vuelva a intentar.", ModExtensiones.TipoMensaje.MsgError); }
|
|
|
|
}
|
|
}
|
|
|
|
protected void GVUsuariosB_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
string CveRol = e.Row.DBCampo("CveRol");
|
|
string CveSubProyecto = e.Row.DBCampo("CveSubProyecto");
|
|
e.Row.CssClass = "items";
|
|
//e.Row.Attributes.Add("data-rol", CveRol);
|
|
//e.Row.Attributes.Add("data-sucursal", CveRol);
|
|
}
|
|
}
|
|
|
|
protected void GVUsuarios_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
string CveRol = e.Row.DBCampo("CveRol");
|
|
string CveSubProyecto = e.Row.DBCampo("CveSubProyecto");
|
|
e.Row.CssClass = "items";
|
|
//e.Row.Attributes.Add("data-rol", CveRol);
|
|
//e.Row.Attributes.Add("data-sucursal", CveRol);
|
|
}
|
|
}
|
|
|
|
protected void LnkIniciar_Click(object sender, EventArgs e)
|
|
{
|
|
bool Continuar = false;
|
|
int CveEvento = -1;
|
|
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)
|
|
{
|
|
CveEventoMinuta = CveEvento;
|
|
LnkOpenModalAsistencia.Visible = true;
|
|
UpAcciones.Update();
|
|
Alert(string.Format("Se ha iniciado la minuta, si desea ir a la minuta <a href=\"/OI/MinutaDetalle.aspx?CveEvento={0}\">Click Aquí</a>.", CveEvento), ModExtensiones.TipoMensaje.ToastInformacion, "", 0);
|
|
LnkOpenModalAsistencia_Click(null, null);
|
|
}
|
|
}
|
|
|
|
protected void LnkOpenModalAsistencia_Click(object sender, EventArgs e)
|
|
{
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
GvTomarAsistencia.DataSource = null;
|
|
if (ObjOI_E.GetEventosUsuario2(CveEventoMinuta, UsuarioActual.CveEmpresa)) { GvTomarAsistencia.DataSource = ObjOI_E.DtResultados; }
|
|
}
|
|
GvTomarAsistencia.DataBind();
|
|
UpTomarASistencia.Update();
|
|
RegistraScript(string.Format("$('#{0}').modal();", iddivTomarAsistencia));
|
|
}
|
|
|
|
protected void LnkUpAsistencia_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
List<int> listaasistencia = new List<int>();
|
|
foreach (GridViewRow gvRow in GvTomarAsistencia.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox ChkAsistio = gvRow.FCCheckBox("ChkAsistio");
|
|
if (ChkAsistio.Checked)
|
|
{
|
|
listaasistencia.Add(CveUsuario);
|
|
}
|
|
}
|
|
}
|
|
bool continuar = false;
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
continuar = (ObjOI_E.UPMinutasAsistentes(CveEventoMinuta, UsuarioActual.CveEmpresa, TxtAsistentesExternos.Text, UsuarioActual.CveUsuario, listaasistencia));
|
|
}
|
|
if (continuar)
|
|
{
|
|
if (CveEventoMinuta > 0)
|
|
{
|
|
Alert(string.Format("Se ingresó la asistencia correctamente, si desea ir a la minuta <a href=\"/OI/MinutaDetalle.aspx?CveEvento={0}\">Click Aquí</a>.", CveEventoMinuta));
|
|
}
|
|
else
|
|
{
|
|
Alert("se ingresó la asistencia correctamente.");
|
|
|
|
}
|
|
RegistraScript(string.Format("$('#{0}').modal('hide');", iddivTomarAsistencia));
|
|
}
|
|
}
|
|
|
|
protected void GvTomarAsistencia_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
e.Row.CssClass = "items";
|
|
}
|
|
}
|
|
|
|
|
|
private string GetDominio(string addstr = "")
|
|
{
|
|
return string.Format("{0}/{1}", HttpContext.Current.Request.Url.ToString().Replace(HttpContext.Current.Request.Url.PathAndQuery, ""), addstr);
|
|
}
|
|
string UsuarioDemail = "";
|
|
string ICString = "";
|
|
private void enviarConvocatoria(int RCveEvento)
|
|
{
|
|
|
|
string Body;
|
|
string UsuarioDe = "";
|
|
|
|
#region "Body"
|
|
int Folio = 0; string Link = ""; string Asunto = ""; string Acuerdos = ""; string Descripcion = ""; DateTime DFechai = DateTime.MinValue; DateTime DFechaf = DateTime.MinValue;
|
|
UsuarioDe = "";
|
|
string UsuarioPara = "";
|
|
string UsuarioDeAbr = "";
|
|
string CorreoRegistro = "";
|
|
|
|
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();
|
|
UsuarioDemail = drow["NombreRegistro"].ToString();
|
|
CorreoRegistro = drow["CorreoRegistro"].ToString().Split(',')[0].Split(';')[0];
|
|
Folio = drow["Folio"].ToString().ToEntero();
|
|
Link = GetDominio(string.Format("OI/ConvocatoriaDetalle.aspx?CveEvento={0}", RCveEvento));
|
|
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>");
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
Body = StrMail.ToString();//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);
|
|
ICString = GenerateIcsContent(string.Format("{0:yyyy/MM/dd} 00:00", txtFechaI.Text.ToDateTime()).ToDateTime(), string.Format("{0:yyyy/MM/dd} 23:59", txtFechaI.Text.ToDateTime()).ToDateTime(),
|
|
UsuarioDe, CorreoRegistro, TxtLugar.Text, Asunto,Descripcion,string.Format("Convocatoria_{0}",RCveEvento) );
|
|
ClsSisMail.ArchivoMail ICSFile = new ClsSisMail.ArchivoMail { Ruta = "",ArchivoBinario= Encoding.ASCII.GetBytes(ICString), NombreArchivo = "Agendar.ics" };
|
|
LSRutasMail.Add(ICSFile);
|
|
ClsSisMail.ArchivoMail itemMail = new ClsSisMail.ArchivoMail();
|
|
|
|
|
|
ClsSisMail Mail = new ClsSisMail();
|
|
Mail.SendMail(EmpresaNotificaciones, get_GlobalDTUsuarios(UsuarioActual.CveUsuario).Rows[0]["correo"].ToString() + ";" + TxtCorreoExterno.Text, string.Format("⏰ {1} te ha invitado a una reunión, {0}", TxtAsunto.Text, UsuarioDemail), Body, CCP: ArrayCC, Archivos: LSRutasMail);
|
|
}
|
|
protected void LnkEnviarCorreo_Click(object sender, EventArgs e)
|
|
{
|
|
enviarConvocatoria(RCveEvento);
|
|
Alert("Se Envió por correo la convocatoria", ModExtensiones.TipoMensaje.MsgInformacion);
|
|
}
|
|
|
|
|
|
public string GenerateIcsContent(DateTime FechaInicio, DateTime FechaFin, string Nombreorganizador, string Correoorganizador, string Ubicacion, string Asunto, string descripcion, string uuid)
|
|
{
|
|
var DTSTART = FechaInicio.ToUniversalTime().ToString("yyyyMMddTHHmmssZ");
|
|
var DTEND = FechaFin.ToUniversalTime().ToString("yyyyMMddTHHmmssZ");
|
|
|
|
/*
|
|
BEGIN:VCALENDAR
|
|
VERSION:2.0
|
|
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
|
|
BEGIN:VEVENT
|
|
UID:uid1@example.com
|
|
DTSTAMP:19970714T170000Z
|
|
ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com
|
|
DTSTART:19970714T170000Z
|
|
DTEND:19970715T035959Z
|
|
SUMMARY:Bastille Day Party
|
|
END:VEVENT
|
|
END:VCALENDAR
|
|
*/
|
|
StringBuilder strICS = new StringBuilder();
|
|
strICS.AppendLine("BEGIN:VCALENDAR");
|
|
strICS.AppendLine("VERSION:2.0");
|
|
strICS.AppendLine("METHOD:PUBLISH");
|
|
strICS.AppendLine("BEGIN:VEVENT");
|
|
strICS.AppendLine(string.Format("ORGANIZER;CN={0}:MAILTO:{1}", Nombreorganizador.Replace(":", "").Replace(";", ""), Correoorganizador));
|
|
strICS.AppendLine(string.Format("DTSTART:{0}", DTSTART));
|
|
strICS.AppendLine(string.Format("DTEND:{0}", DTEND));
|
|
strICS.AppendLine(string.Format("LOCATION:{0}", Ubicacion));
|
|
strICS.AppendLine(string.Format("UID:{0}", uuid));
|
|
strICS.AppendLine(string.Format("DTSTAMP:{0}", NowADS().ToUniversalTime().ToString("yyyyMMddTHHmmssZ")));
|
|
strICS.AppendLine(string.Format("SUMMARY:{0}", Asunto));
|
|
strICS.AppendLine(string.Format("DESCRIPTION:{0}", descripcion));
|
|
strICS.AppendLine("PRIORITY:5");
|
|
strICS.AppendLine("CLASS:PUBLIC");
|
|
strICS.AppendLine("END:VEVENT");
|
|
strICS.AppendLine("END:VCALENDAR");
|
|
return strICS.ToString();
|
|
}
|
|
|
|
|
|
} |