1164 lines
48 KiB
C#
1164 lines
48 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_TareaDetalle : ClsPaginas
|
|
{
|
|
|
|
private class OI_TareaDetalle_Permisos
|
|
{
|
|
public bool EntrarOI;
|
|
public bool CheckList;
|
|
public bool EdicionGeneral;
|
|
public bool Bitacora;
|
|
public bool Avance;
|
|
public bool Reasignar;
|
|
public bool Estatus1_2_3;
|
|
public bool Estatus4_5;
|
|
}
|
|
|
|
#region Propiedades
|
|
public const string iddivAgregarMiembros = "iddivAgregarMiembros";
|
|
public const string iddivAgregar = "divModalAgregarActividad";
|
|
public const string iddivAgregarArchivo = "divModalAgregarArchivo";
|
|
public const string iddivAgregarTema = "divModalAgregartema";
|
|
public const string iddivCambiarEstatus = "divModalCambiarEstatus";
|
|
public int RCveEvento { get { return ViewState["RCveEvento"] != null ? ViewState["RCveEvento"].ToString().ToEntero() : 0; } set { ViewState["RCveEvento"] = value; } }
|
|
public int Folio { get { return ViewState["Folio"] != null ? ViewState["Folio"].ToString().ToEntero() : 0; } set { ViewState["Folio"] = value; } }
|
|
public decimal Avance { get { return ViewState["Avance"] != null ? ViewState["Avance"].ToString().ToEntero() : 0; } set { ViewState["Avance"] = value; } }
|
|
public int CveUsuarioPara { get { return ViewState["CveUsuarioPara"].ToString().ToEntero(); } set { ViewState["CveUsuarioPara"] = value; } }
|
|
public int CveUsuarioDe { get { return ViewState["CveUsuarioDe"].ToString().ToEntero(); } set { ViewState["CveUsuarioDe"] = 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; } }
|
|
private OI_TareaDetalle_Permisos Permisos { get { return ViewState["Permisos"] == null ? null : (OI_TareaDetalle_Permisos)ViewState["Permisos"]; } set { ViewState["Permisos"] = value; } }
|
|
public bool EsNuevo { get { return Convert.ToBoolean(ViewState["EsNuevo"]); } set { ViewState["EsNuevo"] = value; } }
|
|
public bool LnkAgregarCheckListVisible { get { return Convert.ToBoolean(ViewState["LnkAgregarCheckListVisible"]); } set { ViewState["LnkAgregarCheckListVisible"] = value; } }
|
|
public bool LnkUpFileVisible { get { return Convert.ToBoolean(ViewState["LnkUpFileVisible"]); } set { ViewState["LnkUpFileVisible"] = value; } }
|
|
public bool LnkUpUsuariosVisible { get { return Convert.ToBoolean(ViewState["LnkUpUsuariosVisible"]); } set { ViewState["LnkUpUsuariosVisible"] = value; } }
|
|
|
|
public System.Data.DataTable CheckListNew { get { return ViewState["CheckListNew"] != null ? (System.Data.DataTable)ViewState["CheckListNew"] : null; } set { ViewState["CheckListNew"] = value; } }
|
|
public int chklistitemindex { get { return ViewState["chklistitemindex"] != null ? ViewState["chklistitemindex"].ToString().ToEntero() : 0; } set { ViewState["chklistitemindex"] = value; } }
|
|
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
LnkAgregarCheckListVisible = true;
|
|
LnkUpFileVisible = false ;
|
|
LnkUpUsuariosVisible = false;
|
|
EsNuevo = true;
|
|
CveUsuarioPara = 0;
|
|
CveUsuarioDe = 0;
|
|
if (Request["Archivo"] != null)
|
|
{
|
|
string strArchivo = string.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ModExtensiones.Decripta(Request["Archivo"].ToString()));
|
|
if (System.IO.File.Exists(strArchivo))
|
|
{
|
|
try
|
|
{
|
|
string filename = ModExtensiones.Decripta(Request["filename"].ToString());
|
|
|
|
System.IO.FileInfo file = new System.IO.FileInfo(strArchivo);
|
|
string mimeType = "text/plain";
|
|
try { mimeType = MimeMapping.GetMimeMapping(strArchivo); }
|
|
catch (Exception) { }
|
|
// Response.Write(path)
|
|
Response.Clear();
|
|
Response.ClearHeaders();
|
|
Response.ClearContent();
|
|
Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(filename)}");
|
|
Response.AddHeader("Content-Length", file.Length.ToString());
|
|
Response.ContentType = mimeType;
|
|
Response.Flush();
|
|
Response.TransmitFile(file.FullName);
|
|
Response.End();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
this.RegistraScript("window.close();");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.RegistraScript("window.close();");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CargaTemas();
|
|
CargaEstatus();
|
|
cargaUsuarios();
|
|
if (Request["CveEvento"] != null)
|
|
{
|
|
RCveEvento = Request["CveEvento"].ToString().ToEntero();
|
|
}
|
|
if (RCveEvento > 0)
|
|
{
|
|
EsNuevo = false;
|
|
LoadTarea();
|
|
SetUsuarios();
|
|
}
|
|
else
|
|
{
|
|
portletEstatus.Visible = false;
|
|
LtlTitulo.Text = "Tarea Nueva";
|
|
TxtArchivo.Visible = true;
|
|
CveUsuarioDe = UsuarioActual.CveUsuario;
|
|
}
|
|
|
|
Setpermisos();
|
|
HypArchivo.Visible = !TxtArchivo.Visible;
|
|
}
|
|
}
|
|
}
|
|
private void Setpermisos()
|
|
{
|
|
bool esmiembro = UsuarioActual.CveUsuario.Contiene(LCveUsuarioCCP.ToArray<int>());
|
|
bool esdeel = UsuarioActual.CveUsuario == CveUsuarioDe;
|
|
bool esPara = UsuarioActual.CveUsuario == CveUsuarioPara;
|
|
Permisos = new OI_TareaDetalle_Permisos
|
|
{
|
|
EntrarOI = (EsNuevo || esmiembro),
|
|
CheckList = (EsNuevo || esdeel || esPara),
|
|
EdicionGeneral = (EsNuevo || esdeel),
|
|
Bitacora = esmiembro,
|
|
Avance = esPara,
|
|
Reasignar = esPara,
|
|
Estatus1_2_3 = esPara,
|
|
Estatus4_5 = esdeel
|
|
};
|
|
#region Permisos.EntrarOI
|
|
|
|
UpAcciones.Visible = Permisos.EntrarOI;
|
|
UpTitulo.Visible = Permisos.EntrarOI;
|
|
UpContenido.Visible = Permisos.EntrarOI;
|
|
|
|
if (Permisos.EntrarOI && !UsuarioActual.CveUsuario.Contiene(LcveuserVisto.ToArray<int>())) {
|
|
using (ClsOIEventos oieve =new ClsOIEventos())
|
|
{
|
|
oieve.UpUsuarioseventosVisto(RCveEvento, UsuarioActual.CveUsuario);
|
|
LcveuserVisto.Add(UsuarioActual.CveUsuario);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
#region Permisos.CheckList
|
|
LnkSinfuncion.Visible = Permisos.CheckList;
|
|
LnkAgregarchklistitem.Visible = Permisos.CheckList;
|
|
LnkAgregarCheckList.Visible = Permisos.CheckList && LnkAgregarCheckListVisible;
|
|
GVcheklist.Columns[0].Visible = Permisos.CheckList;
|
|
GVcheklist.Columns[3].Visible = Permisos.CheckList;
|
|
#endregion
|
|
#region Permisos.EdicionGeneral
|
|
LnkGuardar.Visible = Permisos.EdicionGeneral;
|
|
LnkUpFile.Visible = Permisos.EdicionGeneral && LnkUpFileVisible;
|
|
LnkUpUsuarios.Visible = Permisos.EdicionGeneral && LnkUpUsuariosVisible;
|
|
#endregion
|
|
#region Permisos.Bitacora
|
|
LnkAgregarActividad.Visible = Permisos.Bitacora;
|
|
#endregion
|
|
#region Permisos.Avance
|
|
BtnUpAvance.Visible = Permisos.Avance;
|
|
TxtAvance.Enabled = Permisos.Avance;
|
|
#endregion
|
|
#region Permisos.Reasignar
|
|
LnkReasignar.Visible = Permisos.Reasignar;
|
|
#endregion
|
|
LnkcambiarEstatus.Visible = Permisos.Estatus1_2_3 || Permisos.Estatus4_5;
|
|
|
|
UpAcciones.Update();
|
|
UpTitulo.Update();
|
|
UpContenido.Update();
|
|
}
|
|
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 CargaEstatus()
|
|
{
|
|
|
|
DdlEventoEstatus.DataSource = GlobalDTOIEstatusEventos;//get_GlobalDTOIRevision(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("CveUsuario = {0}", UsuarioActual.CveUsuario));
|
|
DDlEstatus.DataSource = DdlEventoEstatus.DataSource;
|
|
DdlEventoEstatus.DataBind();
|
|
DDlEstatus.DataBind();
|
|
DdlEventoEstatus.Enabled = false;
|
|
//DdlEventoEstatus.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
}
|
|
private void cargaUsuarios()
|
|
{
|
|
string FiltroAD = "";
|
|
|
|
|
|
DdlRoles.DataSource = get_GlobalDTRoles(UsuarioActual.CveEmpresa);
|
|
DdlRoles.DataBind();
|
|
DdlRoles.Items.Insert(0, new ListItem("Todos", "-1"));
|
|
|
|
DdlSucursales.DataSource = get_GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa);
|
|
DdlSucursales.DataBind();
|
|
DdlSucursales.Items.Insert(0, new ListItem("Todos", "-1"));
|
|
|
|
GVUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa);
|
|
GVUsuarios.DataBind();
|
|
UpUsuarios.Update();
|
|
|
|
|
|
GVUsuarios.DataSource = get_GlobalDTUsuarios().FiltraParametros(String.Format("CveEmpresa = {0} AND Estatus =1 {1}", UsuarioActual.CveEmpresa, FiltroAD), "Rol ASC");
|
|
GVUsuariosB.DataSource = GVUsuarios.DataSource;
|
|
GVUsuarios.DataBind();
|
|
GVUsuariosB.DataBind();
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
private void cargaActividades(ClsOIEventos ObjOI)
|
|
{
|
|
GvActividades.DataSource = null;
|
|
if (ObjOI.GetEventosComentarios(RCveEvento))
|
|
{
|
|
GvActividades.DataSource = ObjOI.DtResultados;
|
|
}
|
|
GvActividades.DataBind();
|
|
UpActividades.Update();
|
|
}
|
|
private void SetUsuarios()
|
|
{
|
|
StringBuilder StrPara = new StringBuilder();
|
|
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 chkpara = gvRow.FCCheckBox("ChkPara");
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
chkpara.Checked = false;
|
|
chkCCpara.Checked = false;
|
|
|
|
if (EsNuevo)
|
|
{
|
|
chkpara.Enabled = true;
|
|
chkCCpara.Enabled = true;
|
|
if (CveUsuario == CveUsuarioDe)
|
|
{
|
|
chkCCpara.Enabled = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
chkpara.Enabled = false;
|
|
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 == CveUsuarioPara) || (CveUsuario == CveUsuarioDe))
|
|
{
|
|
if (CveUsuario == CveUsuarioPara)
|
|
{
|
|
chkpara.Checked = true;
|
|
StrPara.AppendFormat("{3}<span class=\"linkCorreo\" data-toggle=\"tooltip\" title=\"{1}\">{2}\"{0}\"</span>", gvRow.DataKey("Nombre").ToString(), gvRow.DataKey("Correo").ToString(), palomitavisto, 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(), palomitavisto, palomitasinver);
|
|
}
|
|
}
|
|
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(), palomitavisto, palomitasinver);
|
|
}
|
|
}
|
|
}
|
|
LtlPara.Text = StrPara.ToString();
|
|
LtlDeUser.Text = StrDeUser.ToString();
|
|
LtlCCPara.Text = StrCCPara.ToString();
|
|
|
|
|
|
}
|
|
|
|
public void LoadTarea()
|
|
{
|
|
GVcheklist.DataSource = new System.Data.DataTable();
|
|
using (ClsOIEventos ObjOI_E = new ClsOIEventos())
|
|
{
|
|
if (ObjOI_E.GetEventos2(RCveEvento, UsuarioActual.CveEmpresa) && ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
PnlUsuarios.Visible = true;
|
|
portletMiembros.Visible = false;
|
|
LnkUpFileVisible = true;
|
|
LnkUpUsuariosVisible = true;
|
|
System.Data.DataRow drow = ObjOI_E.DtResultados.Rows[0];
|
|
|
|
Folio = drow["Folio"].ToString().ToEntero();
|
|
Avance = drow["Avance"].ToString().ToDecimal();
|
|
|
|
TxtAsunto.Text = drow["Asunto"].ToString();
|
|
TxtDescripcion.Text = drow["Descripcion"].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"]);
|
|
DdlTema.SelectedValueExist(drow["CveRevision"].ToString());
|
|
DdlEventoEstatus.SelectedValueExist(drow["CveEventoEstatus"].ToString());
|
|
DDlEstatus.SelectedValueExist(drow["CveEventoEstatus"].ToString());
|
|
HypArchivo.Text = string.Format("{0}<br /><i class=\"fa fa-download\"></i>", drow["Archivo"].ToString());
|
|
HypArchivo.NavigateUrl = string.Format("~/OI/TareaDetalle.aspx?Archivo={0}&filename={1}", ModExtensiones.Encripta(string.Format("OIFiles\\{0}\\{1}", Folio, drow["Archivo"])), ModExtensiones.Encripta(drow["Archivo"].ToString()));
|
|
TxtArchivo.Visible = (drow["Archivo"].ToString().Length == 0);
|
|
portletArchivo.Visible = !TxtArchivo.Visible;
|
|
LnkUpFile.Text = (portletArchivo.Visible ? "<i class=\"fa fa-pencil\"></i> Actualizar archivo" : "<i class=\"fa fa-plus\"></i> Agregar archivo");
|
|
Literal3.Text = portletArchivo.Visible ? "Actualizar archivo" : "Agregar archivo";
|
|
BtnActualizarArchivo.Text = portletArchivo.Visible ? "Actualizar" : "Agregar";
|
|
CveUsuarioDe = drow["CveUsuarioDe"].ToString().ToEntero();
|
|
CveUsuarioPara = drow["CveUsuarioPara"].ToString().ToEntero();
|
|
TxtAvance.Text = string.Format("{0:##0}", drow["Avance"]);
|
|
TxtUsuarioreg.Text = string.Format("{0}", drow["NombreRegistro"]);
|
|
TxtFechaIng.Text = string.Format("{0:dd/MM/yyyy}", drow["FechaIng"]);
|
|
//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]
|
|
|
|
LtlTitulo.Text = drow["Titulo"].ToString();
|
|
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 );
|
|
if(item["Visto"].ToString().ToEntero() == 1)
|
|
{
|
|
LcveuserVisto.Add(CveUsuario);
|
|
}
|
|
}
|
|
}
|
|
if (ObjOI_E.Getcheklist(RCveEvento))
|
|
{
|
|
GVcheklist.DataSource = ObjOI_E.DtResultados;
|
|
if (ObjOI_E.DtResultados.Rows.Count > 0)
|
|
{
|
|
portletChekList.Visible = true;
|
|
LnkAgregarCheckListVisible = false;
|
|
}
|
|
}
|
|
cargaActividades(ObjOI_E);
|
|
}
|
|
}
|
|
GVcheklist.DataBind();
|
|
}
|
|
|
|
protected void LnkGuardar_Click(object sender, EventArgs e)
|
|
{
|
|
string errorMessage = "";
|
|
if (EsNuevo)
|
|
{
|
|
int cveUsuarioDe = UsuarioActual.CveUsuario;
|
|
List<int> listaCCP = new List<int>();
|
|
int cveUsuarioPara = -1;
|
|
|
|
foreach (GridViewRow gvRow in GVUsuariosB.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox chkpara = gvRow.FCCheckBox("ChkPara");
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
if (chkpara.Checked)
|
|
{
|
|
cveUsuarioPara = CveUsuario;
|
|
}
|
|
if (chkCCpara.Checked)
|
|
{
|
|
listaCCP.Add(CveUsuario);
|
|
//cveUsuarioDe = CveUsuario;
|
|
}
|
|
}
|
|
}
|
|
//if (!cveUsuarioDe.Contiene(listaCCP.ToArray<int>()))
|
|
//{
|
|
// listaCCP.Add(cveUsuarioDe);
|
|
//}
|
|
//if (!cveUsuarioPara.Contiene(listaCCP.ToArray<int>()))
|
|
//{
|
|
// listaCCP.Add(cveUsuarioPara);
|
|
//}
|
|
OITipoEventos cveTipoEvento = OITipoEventos.Tarea;
|
|
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 = "";
|
|
if (txtFechaF.Text.ToDateTimeExcat().Year <= 1999)
|
|
{
|
|
if (txtFechaF.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", txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fechaFin = txtFechaF.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm");
|
|
}
|
|
int cveRevision = DdlTema.SelectedValue.ToEntero();
|
|
string archivoname = "";
|
|
string rutaarchivoOri = "";
|
|
string ArchivoExtencion = "";
|
|
foreach (Archivo item in TxtArchivo.getfiles().Archivos)
|
|
{
|
|
archivoname = item.filenameO;
|
|
ArchivoExtencion = string.Format("{0}{1}", (item.Extencion.Length > 0 ? "." : ""), item.Extencion);
|
|
rutaarchivoOri = string.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, item.patch, item.filename);
|
|
}
|
|
|
|
|
|
int cveUsuarioIng = UsuarioActual.CveUsuario;
|
|
int cveEmpresa = UsuarioActual.CveEmpresa;
|
|
bool Continuar = false;
|
|
int Folio = -1;
|
|
int CveEvento = -1;
|
|
|
|
if (cveUsuarioDe <= 0)
|
|
{
|
|
errorMessage = "No se selecciono el miembro 'C C Para'";
|
|
}
|
|
|
|
if (cveUsuarioPara <= 0)
|
|
{
|
|
errorMessage = "No se selecciono el miembro 'Para'";
|
|
|
|
}
|
|
if (errorMessage.Length == 0)
|
|
{
|
|
|
|
List<string> chkList = new List<string>();
|
|
if (CheckListNew != null)
|
|
{
|
|
foreach (System.Data.DataRow item in CheckListNew.Rows)
|
|
{
|
|
chkList.Add(item["EventoComentario"].ToString());
|
|
}
|
|
|
|
}
|
|
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, UsuarioActual.Empresa);
|
|
CveEvento = objOI.CveEvento;
|
|
Folio = objOI.Folio;
|
|
if (CveEvento == 0)
|
|
{
|
|
Continuar = false;
|
|
}
|
|
if (Continuar)
|
|
{
|
|
objOI.Commit();
|
|
|
|
}
|
|
else
|
|
{
|
|
objOI.RollBack();
|
|
Continuar = false;
|
|
}
|
|
}
|
|
if (Continuar && CveEvento > 0)
|
|
{
|
|
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);
|
|
}
|
|
this.Alert("Se ha agregadó la nueva tarea", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("location.replace(\"/OI/TareaDetalle.aspx?CveEvento={0}\");", CveEvento));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
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 = "";
|
|
if (txtFechaF.Text.ToDateTimeExcat().Year <= 1999)
|
|
{
|
|
if (txtFechaF.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", txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fechaFin = txtFechaF.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm");
|
|
}
|
|
int cveRevision = DdlTema.SelectedValue.ToEntero();
|
|
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, UsuarioActual.Empresa);
|
|
|
|
if (Continuar)
|
|
{
|
|
objOI.Commit();
|
|
|
|
}
|
|
else
|
|
{
|
|
objOI.RollBack();
|
|
Continuar = false;
|
|
}
|
|
}
|
|
if (Continuar)
|
|
{
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
cargaActividades(objOI);
|
|
}
|
|
this.Alert("Se actualizó la tarea", ModExtensiones.TipoMensaje.MsgInformacion);
|
|
|
|
}
|
|
}
|
|
|
|
if (errorMessage.Length > 0)
|
|
{
|
|
this.Alert(errorMessage, ModExtensiones.TipoMensaje.MsgAdvertencia);
|
|
|
|
}
|
|
}
|
|
|
|
protected void LnkEliminarchek_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvrow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
|
|
|
if (EsNuevo)
|
|
{
|
|
CheckListNew = CheckListNew.FiltraParametros(string.Format("CveEventoCheckList <> {0}", gvrow.DataKey("CveEventoCheckList")));
|
|
GVcheklist.DataSource = CheckListNew;
|
|
GVcheklist.DataBind();
|
|
}
|
|
else
|
|
{
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
if (objOI.Removecheklist(gvrow.DataKey("CveEventoCheckList").ToEntero(), gvrow.DataKey("CveEvento").ToEntero(), UsuarioActual.CveUsuario))
|
|
{
|
|
Alert("Se ha eliminadó la actividad", ModExtensiones.TipoMensaje.ToastInformacion);
|
|
if (objOI.Getcheklist(RCveEvento))
|
|
{
|
|
GVcheklist.DataSource = objOI.DtResultados;
|
|
GVcheklist.DataBind();
|
|
cargaActividades(objOI);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
protected void LnkAgregarCheckList_Click(object sender, EventArgs e)
|
|
{
|
|
portletChekList.Visible = true;
|
|
LnkAgregarCheckListVisible = false;
|
|
if (RCveEvento > 0)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
GVcheklist.Columns[0].Visible = false;
|
|
CheckListNew = new System.Data.DataTable();
|
|
//CveEventoCheckList,CveEvento,CveTipoEvento,EventoComentario,Estatus,CveUsuario,Usuario,FechaIng
|
|
CheckListNew.Columns.Add("CveEventoCheckList", typeof(int));
|
|
CheckListNew.Columns.Add("CveEvento", typeof(int));
|
|
CheckListNew.Columns.Add("CveTipoEvento", typeof(int));
|
|
CheckListNew.Columns.Add("EventoComentario", typeof(String));
|
|
CheckListNew.Columns.Add("Estatus", typeof(bool));
|
|
CheckListNew.Columns.Add("CveUsuario", typeof(int));
|
|
CheckListNew.Columns.Add("Usuario", typeof(string));
|
|
CheckListNew.Columns.Add("FechaIng", typeof(DateTime));
|
|
|
|
}
|
|
UpChkList.Update();
|
|
}
|
|
protected void LnkAgregarchklistitem_Click(object sender, EventArgs e)
|
|
{
|
|
if (RCveEvento > 0)
|
|
{
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
if (objOI.Addcheklist(RCveEvento, TxtActividad.Text, UsuarioActual.CveUsuario))
|
|
{
|
|
Alert("Se agregó la actividad", ModExtensiones.TipoMensaje.ToastInformacion);
|
|
if (objOI.Getcheklist(RCveEvento))
|
|
{
|
|
GVcheklist.DataSource = objOI.DtResultados;
|
|
GVcheklist.DataBind();
|
|
cargaActividades(objOI);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
System.Data.DataRow drow = CheckListNew.NewRow();
|
|
drow["CveEventoCheckList"] = chklistitemindex++;
|
|
drow["EventoComentario"] = TxtActividad.Text;
|
|
drow["Estatus"] = false;
|
|
//CveEventoCheckList,CveEvento,CveTipoEvento,EventoComentario,Estatus,CveUsuario,Usuario,FechaIng
|
|
CheckListNew.Rows.Add(drow);
|
|
GVcheklist.DataSource = CheckListNew;
|
|
GVcheklist.DataBind();
|
|
}
|
|
TxtActividad.Text = "";
|
|
}
|
|
protected void ChkEstatus_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
CheckBox chk = (CheckBox)sender;
|
|
GridViewRow gvrow = (GridViewRow)chk.NamingContainer;
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
if (objOI.Upcheklist(gvrow.DataKey("CveEventoCheckList").ToEntero(), gvrow.DataKey("CveEvento").ToEntero(), gvrow.DataKey("EventoComentario"), chk.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa))
|
|
{
|
|
Alert("Se actualizó el estatus de la actividad", ModExtensiones.TipoMensaje.ToastInformacion);
|
|
if (objOI.Getcheklist(RCveEvento))
|
|
{
|
|
GVcheklist.DataSource = objOI.DtResultados;
|
|
GVcheklist.DataBind();
|
|
cargaActividades(objOI);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
protected void LnkEditarCheck_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
protected void BtnCambiarEstatus_Click(object sender, EventArgs e)
|
|
{
|
|
int CveEstatus = DDlEstatus.SelectedValue.ToEntero();
|
|
|
|
if ((Permisos.Estatus1_2_3 && CveEstatus.Contiene(new int[] { 1, 2, 3 })) || (Permisos.Estatus4_5 && CveEstatus.Contiene(new int[] { 45 })))
|
|
{
|
|
using (ClsOIEventos objOI = new ClsOIEventos())
|
|
{
|
|
|
|
|
|
if (objOI.UpdateEstatusEvento2(CveEstatus, -1, RCveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa))
|
|
{
|
|
//CargaEstatusEventos(DdlEventoEstatus.SelectedValue.ToEntero);
|
|
|
|
//if (DdlEventoEstatus.SelectedValue.ToEntero == 3 | DdlEventoEstatus.SelectedValue.ToEntero == 1)
|
|
// EnviarCorreoCambioEstatus(false);
|
|
//CargaDatos();
|
|
string mensaje = string.Format("Se cambio el Estatus de \"{0}\" a \"{1}\"", DdlEventoEstatus.SelectedItem.Text, DDlEstatus.SelectedItem.Text);
|
|
DdlEventoEstatus.SelectedValueExist(DDlEstatus.SelectedValue);
|
|
UpEstatus.Update();
|
|
this.RegistraScript(string.Format("$('#{0}').modal('hide')", iddivCambiarEstatus));
|
|
Alert(mensaje, ModExtensiones.TipoMensaje.ToastInformacion);
|
|
cargaActividades(objOI);
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert(string.Format("No tiene permiso para cambiar al estatus '{0}'", DDlEstatus.SelectedItem.Text), ModExtensiones.TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
|
|
protected void LnkcambiarEstatus_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivCambiarEstatus));
|
|
}
|
|
|
|
|
|
|
|
protected void LnkSinfuncion_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
protected void LnkAgregarTema_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarTema));
|
|
}
|
|
|
|
protected void BtnAgregarTema_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
using (ClsOIEventos objoi = new ClsOIEventos())
|
|
{
|
|
if (objoi.AddRevisionesEventos(TxtTema.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
|
{
|
|
Alert("Tema agregada con éxito.", ModExtensiones.TipoMensaje.MsgInformacion);
|
|
this.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 LnkAgregarActividad_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregar));
|
|
}
|
|
|
|
protected void BtnAgregarComentario_Click(object sender, EventArgs e)
|
|
{
|
|
string Comentario = TxtComentario.Text;
|
|
int CveComentario = 0;
|
|
string archivoname = "";
|
|
string rutaarchivoOri = "";
|
|
string ArchivoExtencion = "";
|
|
foreach (Archivo item in Txtfilecomentario.getfiles().Archivos)
|
|
{
|
|
archivoname = item.filenameO;
|
|
ArchivoExtencion = string.Format("{0}{1}", (item.Extencion.Length > 0 ? "." : ""), item.Extencion);
|
|
rutaarchivoOri = string.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, item.patch, item.filename);
|
|
}
|
|
using (ClsOIEventos objoi = new ClsOIEventos())
|
|
{
|
|
CveComentario = objoi.AddEventoComentario2(RCveEvento, Comentario, archivoname, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa);
|
|
if (CveComentario > 0) { cargaActividades(objoi); }
|
|
}
|
|
Txtfilecomentario.Text = "";
|
|
if (CveComentario > 0)
|
|
{
|
|
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}{2}", ruta, CveComentario, archivoname);//, ArchivoExtencion);
|
|
System.IO.File.Move(rutaarchivoOri, ruta);
|
|
}
|
|
this.RegistraScript(string.Format("$('#{0}').modal('hide')", iddivAgregar));
|
|
this.Alert("Comentario agregadó", ModExtensiones.TipoMensaje.ToastInformacion);
|
|
//this.Alert("Se ha agregado la nueva tarea", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("location.replace(\"/OI/TareaDetalle.aspx?CveEvento={0}\");", CveEvento));
|
|
}
|
|
TxtComentario.Text = "";
|
|
}
|
|
|
|
protected void GvActividades_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
HyperLink HplA = e.Row.FCHyperLink("HplA");
|
|
string archivoname = e.Row.DBCampo("Archivo");
|
|
string CveComentario = e.Row.DBCampo("CveEventoComentario");
|
|
HplA.Visible = archivoname != "";
|
|
if (HplA.Visible)
|
|
{
|
|
HplA.NavigateUrl = string.Format("~/OI/TareaDetalle.aspx?Archivo={0}&filename={1}", ModExtensiones.Encripta(string.Format("OIFiles\\{0}\\{1}", Folio, archivoname)), ModExtensiones.Encripta(archivoname));
|
|
}
|
|
|
|
}
|
|
//Visible='<%# Eval("Archivo").ToString() != "" %>' data-archivo ='<%# string.Format("",Eval("CveEventoComentario").ToString()) %>'
|
|
//string.Format("~/OI/TareaDetalle.aspx?Archivo={0}&filename={1}", ModExtensiones.Encripta(string.Format("OIFiles\\{0}\\{1}", Folio, drow["Archivo"])), ModExtensiones.Encripta(drow["Archivo"].ToString()))
|
|
}
|
|
|
|
protected void LnkUpFile_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarArchivo));
|
|
|
|
}
|
|
|
|
protected void BtnActualizarArchivo_Click(object sender, EventArgs e)
|
|
{
|
|
string archivoname = "";
|
|
string rutaarchivoOri = "";
|
|
string ArchivoExtencion = "";
|
|
foreach (Archivo item in txtActualizarArchivo.getfiles().Archivos)
|
|
{
|
|
archivoname = item.filenameO;
|
|
ArchivoExtencion = string.Format("{0}{1}", (item.Extencion.Length > 0 ? "." : ""), item.Extencion);
|
|
rutaarchivoOri = string.Format("{0}{1}{2}", AppDomain.CurrentDomain.BaseDirectory, item.patch, item.filename);
|
|
}
|
|
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);
|
|
}
|
|
string rutafin = string.Format("{0}{1}", ruta, archivoname);//, ArchivoExtencion);
|
|
int index = 0;
|
|
while (System.IO.File.Exists(rutafin))
|
|
{
|
|
archivoname = string.Format("{0}{1}", index++, archivoname);
|
|
rutafin = string.Format("{0}{1}", ruta, archivoname);
|
|
}
|
|
System.IO.File.Move(rutaarchivoOri, rutafin);
|
|
bool continuar = false;
|
|
using (ClsOIEventos objoi = new ClsOIEventos())
|
|
{
|
|
continuar = objoi.AddUPEventoArchivo(RCveEvento, archivoname, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa);
|
|
|
|
}
|
|
if (continuar)
|
|
{
|
|
LoadTarea();
|
|
this.RegistraScript(string.Format("$('#{0}').modal('hide')", iddivAgregarArchivo));
|
|
this.Alert("Archivo Actualizadó", ModExtensiones.TipoMensaje.ToastInformacion);
|
|
}
|
|
UpContenido.Update();
|
|
UpAcciones.Update();
|
|
}
|
|
|
|
protected void BtnUpAvance_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
bool continuar = false;
|
|
using (ClsOIEventos objoi = new ClsOIEventos())
|
|
{
|
|
continuar = objoi.UPEventoAAvance(RCveEvento, TxtAvance.Text.ToDecimal(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa);
|
|
if (continuar)
|
|
{
|
|
if (objoi.DtResultados.Rows.Count > 0)
|
|
{
|
|
LtlTitulo.Text = objoi.DtResultados.Rows[0]["Titulo"].ToString();
|
|
}
|
|
cargaActividades(objoi);
|
|
}
|
|
}
|
|
if (continuar)
|
|
{
|
|
this.Alert("Avance Actualizadó", ModExtensiones.TipoMensaje.ToastInformacion);
|
|
|
|
}
|
|
UpTitulo.Update();
|
|
}
|
|
|
|
protected void LnkAddTtemaB_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarTema));
|
|
}
|
|
|
|
protected void LnkReasignar_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarMiembros));
|
|
LtlTituloUsuarios.Text = "Reasignar Tarea";
|
|
BtnUpMiembros.Visible = false;
|
|
BtnReasignarTarea.Visible = true;
|
|
foreach (GridViewRow gvRow in GVUsuarios.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
gvRow.FCCheckBox("ChkPara").Checked = false;
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
chkCCpara.Checked = false;
|
|
if (CveUsuario == CveUsuarioPara)
|
|
{
|
|
chkCCpara.Checked = true ;
|
|
chkCCpara.Enabled = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
UpUsuarios.Update();
|
|
}
|
|
protected void LnkUpUsuarios_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript(string.Format("$('#{0}').modal()", iddivAgregarMiembros));
|
|
LtlTituloUsuarios.Text = "Actualizar miembros";
|
|
BtnUpMiembros.Visible = true;
|
|
BtnReasignarTarea.Visible = false;
|
|
|
|
foreach (GridViewRow gvRow in GVUsuarios.Rows)
|
|
{
|
|
if (gvRow.RowType == DataControlRowType.DataRow)
|
|
{
|
|
int CveUsuario = gvRow.DataKey("CveUsuario").ToString().ToEntero();
|
|
CheckBox chkpara = gvRow.FCCheckBox("ChkPara");
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
chkpara.Checked = false;
|
|
chkCCpara.Checked = false;
|
|
chkCCpara.Enabled = true;
|
|
chkpara.Enabled = true;
|
|
|
|
|
|
if ((CveUsuario == CveUsuarioPara) || (CveUsuario == CveUsuarioDe))
|
|
{
|
|
if (CveUsuario == CveUsuarioPara)
|
|
{
|
|
chkpara.Checked = true;
|
|
}
|
|
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 chkpara = gvRow.FCCheckBox("ChkPara");
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
if (chkpara.Checked)
|
|
{
|
|
_cveUsuarioPara = CveUsuario;
|
|
}
|
|
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)
|
|
{
|
|
cargaActividades(oieve);
|
|
}
|
|
}
|
|
if (continuar)
|
|
{
|
|
LCveUsuarioCCP = listaCCP;
|
|
this.CveUsuarioPara = _cveUsuarioPara;
|
|
SetUsuarios();
|
|
Setpermisos();
|
|
}
|
|
UpContenido.Update();
|
|
this.RegistraScript(string.Format("$('#{0}').modal('hide')", iddivAgregarMiembros));
|
|
}
|
|
|
|
|
|
|
|
protected void BtnReasignarTarea_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string errorMessage = "";
|
|
|
|
if (!EsNuevo)
|
|
{
|
|
int cveUsuarioDe = UsuarioActual.CveUsuario;
|
|
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 chkpara = gvRow.FCCheckBox("ChkPara");
|
|
CheckBox chkCCpara = gvRow.FCCheckBox("ChkCCP");
|
|
if (chkpara.Checked)
|
|
{
|
|
cveUsuarioPara = CveUsuario;
|
|
}
|
|
if (chkCCpara.Checked)
|
|
{
|
|
listaCCP.Add(CveUsuario);
|
|
//cveUsuarioDe = CveUsuario;
|
|
}
|
|
}
|
|
}
|
|
|
|
OITipoEventos cveTipoEvento = OITipoEventos.Tarea;
|
|
string asunto = TxtAsunto.Text;
|
|
string descripcion = TxtDescripcion.Text;
|
|
int prioridad = DdlPrioridad.SelectedValue.ToEntero();
|
|
string fechaInicio = "";
|
|
if (txtFechaI.Text.ToDateTimeExcat().Year <= 1999)
|
|
{
|
|
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 = "";
|
|
if (txtFechaF.Text.ToDateTimeExcat().Year <= 1999)
|
|
{
|
|
fechaFin = string.Format("{0:yyyy/MM/dd} 23:59", txtFechaF.Text.ToDateTimeExcat("dd/MM/yyyy"));
|
|
}
|
|
else
|
|
{
|
|
fechaFin = txtFechaF.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm");
|
|
}
|
|
int cveRevision = DdlTema.SelectedValue.ToEntero();
|
|
string archivoname = "";
|
|
string rutaarchivoOri = "";
|
|
|
|
|
|
int cveUsuarioIng = UsuarioActual.CveUsuario;
|
|
int cveEmpresa = UsuarioActual.CveEmpresa;
|
|
bool Continuar = false;
|
|
int Folio = -1;
|
|
int CveEvento = -1;
|
|
|
|
|
|
if (cveUsuarioPara <= 0)
|
|
{
|
|
errorMessage = "No se selecciono el miembro 'Para'";
|
|
|
|
}
|
|
if (cveUsuarioPara == cveUsuarioDe)
|
|
{
|
|
errorMessage = "Debe reasignar la tarea a otro usuario ";
|
|
|
|
}
|
|
if (errorMessage.Length > 0)
|
|
{
|
|
Alert(errorMessage, ModExtensiones.TipoMensaje.MsgAdvertencia);
|
|
}
|
|
else
|
|
{
|
|
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, UsuarioActual.Empresa, RCveEvento);
|
|
CveEvento = objOI.CveEvento;
|
|
Folio = objOI.Folio;
|
|
if (CveEvento == 0)
|
|
{
|
|
Continuar = false;
|
|
}
|
|
if (Continuar)
|
|
{
|
|
objOI.Commit();
|
|
|
|
}
|
|
else
|
|
{
|
|
objOI.RollBack();
|
|
Continuar = false;
|
|
}
|
|
}
|
|
}
|
|
if (Continuar && CveEvento > 0)
|
|
{
|
|
this.Alert("Se ha agregadó la nueva tarea", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("location.replace(\"/OI/TareaDetalle.aspx?CveEvento={0}\");", CveEvento));
|
|
}
|
|
|
|
}
|
|
}
|
|
} |