Ejemplo n.º 1
0
        public bool Actualizar()
        {
            string strSQL = "UPDATE " + this.m_TableName + " SET Nombre='" + this.m_Nombre + "', Habilitado=" + this.m_Habilitado +
                            " WHERE Id=" + this.m_Id + ";";
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                bool boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                if (boResult & ActualizaMenciones())
                {
                    oDAL.CommitTrans();
                }
                else
                {
                    boResult = false;
                    oDAL.RollBackTrans();
                }
                oDAL = null;
                return(boResult);
            }
            catch (System.Exception Ex)
            {
                throw new System.Exception("Error al actualizar curso.", Ex);
            }
        }
Ejemplo n.º 2
0
        public bool Eliminar(System.Byte Id)
        {
            clsDAL oDAL = new clsDAL();

            try
            {
                if (Id == 0)
                {
                    return(false);
                }
                bool boResult = false;
                // Comprobar siempre si se puede eliminar antes de hacerlo, a pesar de que este método
                // es público, ya que al escribir el código se nos puede olvidar comprobar esto y MySQL
                // no admite chequeos de integridad, al menos en la 4.1.7.
                if (this.canBeDeleted(Id))
                {
                    string strSQL = "DELETE FROM " + this.m_TableName + " WHERE Id=" + Id + ";";
                    oDAL.BeginTrans();
                    boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                    boResult = boResult & Eliminar_TemaProyecto_Mencion(Id);
                    oDAL.CommitTrans();
                    oDAL = null;
                }

                return(boResult);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al eliminar tema de proyecto.", Ex);
            }
        }
Ejemplo n.º 3
0
        private bool ActualizaMenciones()
        {
            clsDAL oDAL = new clsDAL();
            // Primero borrar
            string strMenciones = string.Empty;
            string strSQL;

            for (int x = 0; x <= (this.m_Menciones.Length - 1); x++)
            {
                if (strMenciones != string.Empty)
                {
                    strMenciones += ", ";
                }
                strMenciones += this.m_Menciones[x].Id.ToString();
            }
            strSQL = "DELETE FROM " + this.m_TBL_MisMenciones + " WHERE Id_TemaProyecto=" + this.m_Id + " AND Id_Mencion NOT IN(" + strMenciones + ");";
            oDAL.ExecCommand(strSQL);
            // Hacer el update o insert
            for (int x = 0; x <= (this.m_Menciones.Length - 1); x++)
            {
                strSQL = "SELECT Id FROM " + this.m_TBL_MisMenciones + " WHERE Id_TemaProyecto=" + this.m_Id + " AND Id_Mencion=" + this.m_Menciones[x].Id + ";";
                if (!(System.Convert.ToBoolean(oDAL.getEscalarValue(strSQL))))
                {
                    strSQL = "INSERT INTO " + this.m_TBL_MisMenciones + " VALUES(null, " + this.m_Menciones[x].Id + ", " + this.m_Id + ");";
                    oDAL.ExecCommand(strSQL);
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        public System.Byte Agregar()
        {
            if (this.m_Menciones.Length == 0)
            {
                throw new System.Exception("Los temas para proyecto de investigación deben estar destinados, al menos, a una de las Menciones registradas.");
            }
            string strSQL = "INSERT INTO " + this.m_TableName + " " +
                            "VALUES(null, '" + this.m_Nombre + "', " + this.m_Habilitado + ");";

            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                oDAL.ExecCommand(strSQL);
                this.m_Id = System.Convert.ToByte(oDAL.getLastIDENTITY(this.m_TableName));
                AgregarMisMenciones(this.m_Menciones);
                oDAL.CommitTrans();
                oDAL = null;
                return(this.m_Id);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al insertar tema de proyecto.", Ex);
            }
        }
Ejemplo n.º 5
0
        public bool canBeDeleted(System.Byte Id)
        {
            bool   boResult = true;
            string strSQL   = "SELECT DISTINCT " +
                              "CASE WHEN tbl_grupo.Id_Mencion=tbl_mencion.Id THEN true ELSE false END AS Grupo, " +
                              "CASE WHEN tbl_curso_mencion.Id_Mencion=tbl_mencion.Id THEN true ELSE false END AS Curso, " +
                              "CASE WHEN tbl_mencion_tema_proyecto.Id_Mencion=tbl_mencion.Id THEN true ELSE false END AS TemaProyecto " +
                              "FROM tbl_mencion " +
                              "LEFT JOIN tbl_grupo ON tbl_mencion.Id = tbl_grupo.Id_Mencion " +
                              "LEFT JOIN tbl_curso_mencion ON tbl_mencion.Id = tbl_curso_mencion.Id_Mencion " +
                              "LEFT JOIN tbl_mencion_tema_proyecto ON tbl_mencion.Id = tbl_mencion_tema_proyecto.Id_Mencion " +
                              "WHERE tbl_mencion.Id=" + Id + ";";

            clsDAL    oDAL      = new clsDAL();
            DataTable dtMencion = oDAL.getDataTable(strSQL);

            oDAL = null;
            // Comprobar que existe un registro.
            if (dtMencion.Rows.Count == 0)
            {
                return(false);
            }

            for (int x = 0; x <= (dtMencion.Columns.Count - 1); x++)
            {
                if (System.Convert.ToBoolean(dtMencion.Rows[0][x]))
                {
                    return(false);
                }
            }
            return(boResult);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Agrega un nuevo maestrante, no agrega los datos a la tabla "tbl_maestrante_tema_proyecto"
        /// porque se entiende que si es nuevo, no es necesario esto, sin embargo, hay que implementar
        /// en el mátodo que actualiza los datos que se agrege el tema de proyecto para cuando el propio
        /// maestrante lo solicita a través de la página perfil.aspx.
        /// </summary>
        /// <returns></returns>
        public new bool Agregar()
        {
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                if (base.existUserId(base.UserId))
                {
                    return(false);
                }                                                                // Comprobar que el UserId no exista.
                if (!base.Agregar())
                {
                    return(false);
                }                                             // Comprobar que se agregan correctamente los datos generales del usuario.
                string strSQL = string.Empty;                 // Consulta para actualizar tbl_usuario.
                strSQL = "INSERT INTO " + this.m_TableName + " VALUES(" + this.m_Id + ", " + this.m_IdGrupo + ", " +
                         "'" + this.m_NoCI + "', " + this.m_IdAcademicoAutoriza + ");";
                bool boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                oDAL.CommitTrans();
                oDAL = null;
                return(boResult);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al agregar nuevo maestrante.", Ex);
            }
        }
Ejemplo n.º 7
0
        public bool Agregar()
        {
            string strSQL = "INSERT INTO " + this.m_TableName + " VALUES(null, " + this.m_IdUsuario + ", " +
                            "'" + this.m_Titulo + "', '" + this.m_Autores + "', " + System.Convert.ToByte(this.m_Tipo) + ", " +
                            System.Convert.ToByte(this.m_Soporte) + ", '" + clsUtiles.getStringMySqlFormatedDate(System.DateTime.Now) + "');";
            clsDAL oDAL = new clsDAL();

            oDAL.BeginTrans();
            bool boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));

            this.m_Id = System.Convert.ToUInt32(oDAL.getLastIDENTITY(this.m_TableName));
            // Para agregar los temas a los que pertenece la bibliografía.
            clsTema Tema = new clsTema();

            System.Byte bytCantTemas = Tema.getCantidad();
            Tema = null;
            if ((this.m_Temas.Length > 0) & (this.m_Temas.Length < bytCantTemas))        // Cuando se declaran explícitamente los temas ó cuando se han seleccionado todos.
            {
                for (int i = 0; i <= (this.m_Temas.Length - 1); i++)
                {
                    strSQL = "INSERT INTO " + this.m_TableTemas + " VALUES(null, " + this.m_Id + ", " + System.Convert.ToByte(this.m_Temas[i].IdTema) + ");";
                    oDAL.ExecCommand(strSQL);
                }
            }
            else             // Para cuando no se declaran explícitamente los temas y se desea que pertenezca a todos, se inserta un cero (0).
            {
                strSQL = "INSERT INTO " + this.m_TableTemas + " VALUES(null, " + this.m_Id + ", 0);";
            }

            oDAL.CommitTrans();
            oDAL = null;
            return(boResult);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Devuelve true si el módulo cuyo Id se pase como parámetro puede ser borrado,
        /// atendiendo a las reglas de integridad referencias, o sea si no existen registros
        /// en otras tablas a nombre del mismo.
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool canBeDeleted(System.Byte Id)
        {
            bool   boResult = true;
            string strSQL   = "SELECT DISTINCT " + //tbl_modulo.Id,
                              "CASE WHEN tbl_curso.Id_Modulo=tbl_modulo.Id THEN true ELSE false END AS Curso, " +
                              "CASE WHEN tbl_maestria.ModuloActual=tbl_modulo.Id THEN true ELSE false END AS Maestria " +
                              "FROM tbl_modulo " +
                              "LEFT JOIN tbl_curso ON tbl_modulo.Id = tbl_curso.Id_Modulo " +
                              "LEFT JOIN tbl_maestria ON tbl_modulo.Id = tbl_maestria.ModuloActual " +
                              "WHERE tbl_modulo.Id=" + Id + ";";

            clsDAL    oDAL     = new clsDAL();
            DataTable dtModulo = oDAL.getDataTable(strSQL);

            oDAL = null;
            // Comprobar que existe un registro.
            if (dtModulo.Rows.Count == 0)
            {
                return(false);
            }

            for (int x = 0; x <= (dtModulo.Columns.Count - 1); x++)
            {
                //System.Diagnostics.Debug.WriteLine("Id: " + Id + " " + dtModulo.Columns[x].ColumnName + ": " + dtModulo.Rows[0][x].ToString());
                if (System.Convert.ToBoolean(dtModulo.Rows[0][x]))
                {
                    return(false);
                }
            }
            return(boResult);
        }
Ejemplo n.º 9
0
        public new bool Actualizar()
        {
            if (this.m_Id == 0)
            {
                return(false);
            }
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                if (!base.Actualizar())
                {
                    return(false);
                }
                if (base.existUserId(base.Id, base.UserId))
                {
                    return(false);
                }                                                                         // Comprobar que el UserId no exista.
                string strSQL = "UPDATE " + this.m_TableName + " SET FuncionAcademico='" + this.m_FuncionAcademico + "' " +
                                "WHERE Id_Usuario=" + this.m_Id + ";";
                bool boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                oDAL.CommitTrans();
                oDAL = null;
                return(boResult);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al actualizar datos del académico.", Ex);
            }
        }
Ejemplo n.º 10
0
        private void setFieldsValue(System.UInt32 Id)
        {
            string    strSQL = "SELECT * FROM " + this.m_TableName + " WHERE Id=" + Id + ";";
            clsDAL    oDAL   = new clsDAL();
            DataTable dt     = oDAL.getDataTable(strSQL);

            if (dt.Rows.Count == 1)
            {
                this.m_Id               = System.Convert.ToUInt32(dt.Rows[0]["Id"]);
                this.m_IdUsuario        = System.Convert.ToUInt32(dt.Rows[0]["Id_Usuario"]);
                this.m_Titulo           = System.Convert.ToString(dt.Rows[0]["Titulo"]);
                this.m_Autores          = System.Convert.ToString(dt.Rows[0]["Autores"]);
                this.m_Tipo             = (clsBibliografia.enuTipo)(dt.Rows[0]["Tipo"]);
                this.m_Soporte          = (clsBibliografia.enuSoporte)(dt.Rows[0]["Soporte"]);
                this.m_datFechaRegistro = System.Convert.ToDateTime(dt.Rows[0]["datFechaRegistro"]);
                // Temas a los que pertenece la bibliografía
                strSQL = "SELECT * FROM " + this.m_TableTemas + " WHERE Id_Bibliografia=" + this.m_Id + ";";
                dt     = oDAL.getDataTable(strSQL);
                if (dt.Rows.Count > 0)
                {
                    clsBibliografia.struTemas[] Temas = new struTemas[dt.Rows.Count];
                    for (int i = 0; i <= (dt.Rows.Count - 1); i++)
                    {
                        Temas[i].IdTema = System.Convert.ToByte(dt.Rows[i]["Id_Tema"]);
                    }
                    this.m_Temas = Temas;
                }
            }

            oDAL = null;
        }
Ejemplo n.º 11
0
        public new bool Actualizar()
        {
            if (this.m_Id == 0)
            {
                return(false);
            }
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                if (!base.Actualizar())
                {
                    return(false);
                }
                if (base.existUserId(base.Id, base.UserId))
                {
                    return(false);
                }                                                                         // Comprobar que el UserId no exista.
                string strSQL = "UPDATE " + this.m_TableName + " SET Id_CategoriaDocente=" + this.m_IdCategoriaDocente + ", " +
                                "Id_TituloAcademico=" + this.m_IdTituloAcademico + ", FacultadDepartamento='" + this.m_FacultadDepartamento + "', " +
                                "Id_AcademicoRegistra=" + this.m_IdAcademicoRegistra + " " +
                                "WHERE Id_Usuario=" + this.m_Id + ";";
                bool boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                oDAL.CommitTrans();
                oDAL = null;
                return(boResult);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al actualizar datos del docente.", Ex);
            }
        }
Ejemplo n.º 12
0
        public bool canBeDeleted(System.Byte Id)
        {
            bool   boResult = true;
            string strSQL   = "SELECT DISTINCT " +
                              "CASE WHEN tbl_usuario_docente.Id_CategoriaDocente=tbl_categoria_docente.Id THEN true ELSE false END AS Docente " +
                              "FROM tbl_categoria_docente " +
                              "LEFT JOIN tbl_usuario_docente ON tbl_categoria_docente.Id=tbl_usuario_docente.Id_CategoriaDocente " +
                              "WHERE tbl_categoria_docente.Id=" + Id + ";";

            clsDAL    oDAL = new clsDAL();
            DataTable dtCategoriaDocente = oDAL.getDataTable(strSQL);

            oDAL = null;
            // Comprobar que existe un registro.
            if (dtCategoriaDocente.Rows.Count == 0)
            {
                return(false);
            }

            for (int x = 0; x <= (dtCategoriaDocente.Columns.Count - 1); x++)
            {
                if (System.Convert.ToBoolean(dtCategoriaDocente.Rows[0][x]))
                {
                    return(false);
                }
            }
            return(boResult);
        }
Ejemplo n.º 13
0
		public System.String[] WhyCanNotBeDeleted(System.Byte Id)
		{
			string strSQL = "SELECT DISTINCT " +
				"CASE WHEN tbl_grupo.Id_Sede=tbl_sede.Id THEN true ELSE false END AS Grupo " +
				"FROM tbl_sede " +
				"LEFT JOIN tbl_grupo ON tbl_sede.Id = tbl_grupo.Id_Sede " +
				"WHERE tbl_sede.Id=" + Id + ";";
				
			clsDAL oDAL = new clsDAL();
			DataTable dtSede = oDAL.getDataTable(strSQL);
			// Comprobar si existe el módulo.
			if(dtSede.Rows.Count==0){return ("La sede ya no existe.").Split('|');}

			// Objeto StringBuilder donde almacenaremos el resultado temporalmente.
			System.Text.StringBuilder sbResult = new System.Text.StringBuilder();
            
			for(int x=0; x<=(dtSede.Columns.Count-1); x++)
			{
				if(System.Convert.ToBoolean(dtSede.Rows[0][x]))
				{
					switch(dtSede.Columns[x].ColumnName)
					{
						case "Grupo":
						{
							if(sbResult.Length!=0){sbResult.Append("|");}
							sbResult.Append("Existe registrado, al menos, un 'Grupo' que pertenece a la misma."); 
							break;
						}
					}
				}
			}
			return sbResult.ToString().Split('|');
		}
Ejemplo n.º 14
0
        /// <summary>
        /// Agrega un nuevo mensaje tomando los valores del objeto Usuario_Mensaje
        /// actual, o sea, los valores de los campos son los establecidos a través
        /// de las propiedades que expone esta clase. Y devuelve el valor del Id
        /// que tomó el mensaje agregado.
        /// </summary>
        /// <returns></returns>
        public System.UInt32 Agregar()
        {
            string strSQL = "INSERT INTO tbl_usuario_mensaje " +
                            "VALUES(null, " + this.m_IdUsuarioFrom + ", " +
                            this.m_IdUsuarioTo + ", '" +
                            clsUtiles.getStringMySqlFormatedDate(this.m_datFechaHora) + "', '" +
                            this.m_Mensaje + "');";
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                oDAL.ExecCommand(strSQL);
                System.UInt32 intIdentity = System.Convert.ToUInt32(oDAL.getLastIDENTITY("tbl_usuario_mensaje"));
                //System.Diagnostics.Debug.WriteLine(intIdentity);
                oDAL.CommitTrans();
                oDAL = null;
                return(intIdentity);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al insertar mensaje.", Ex);
            }
        }
Ejemplo n.º 15
0
        public bool Eliminar()
        {
            if (this.m_Id == 0)
            {
                return(false);
            }
            clsDAL oDAL = new clsDAL();

            try
            {
                string strSQL = string.Empty;
                oDAL.BeginTrans();
                // 1. Eliminar él o los temas a los que corresponde.
                strSQL = "DELETE FROM tbl_bibliografia_tema WHERE Id_Bibliografia=" + this.m_Id + ";";
                oDAL.ExecCommand(strSQL);
                // 2. Eliminar él o los ficheros y sus respectivas URLs.
                strSQL = "DELETE FROM tbl_bibliografia_file WHERE Id_Bibliografia=" + this.m_Id + ";";
                oDAL.ExecCommand(strSQL);
                // 3. Eliminar las credenciales (para aquella bibliografía que se permite especificar tales parámetros).
                strSQL = "DELETE FROM tbl_bibliografia_credenciales WHERE Id_Bibliografia=" + this.m_Id + ";";
                oDAL.ExecCommand(strSQL);
                // 4. Finalmente eliminar de la tabla de tbl_bibliografia.
                strSQL = "DELETE FROM tbl_bibliografia WHERE Id=" + this.m_Id + ";";
                oDAL.ExecCommand(strSQL);
                oDAL.CommitTrans();
                oDAL = null;
                return(true);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al eliminar la bibliografía.", Ex);
            }
        }
Ejemplo n.º 16
0
        private void setFieldsValue()
        {
            clsDAL    oDAL       = new clsDAL();
            DataTable dtMaestria = oDAL.getDataTable("SELECT * FROM tbl_maestria;");

            oDAL = null;
            if (dtMaestria.Rows.Count == 1)
            {
                this.m_IdProvincia       = System.Convert.ToByte(dtMaestria.Rows[0]["Id_Provincia"]);
                this.m_IdUsuarioDirector = System.Convert.ToUInt32(dtMaestria.Rows[0]["Id_UsuarioDirector"]);
                this.m_Nombre            = System.Convert.ToString(dtMaestria.Rows[0]["Nombre"]);
                this.m_Hospedero         = System.Convert.ToString(dtMaestria.Rows[0]["Hospedero"]);
                this.m_Fundamentos       = System.Convert.ToString(clsUtiles.getFromBLOB(dtMaestria.Rows[0]["Fundamentos"]));
                this.m_RequisitosIngreso = System.Convert.ToString(clsUtiles.getFromBLOB(dtMaestria.Rows[0]["RequisitosIngreso"]));
                this.m_datFechaInicio    = System.Convert.ToDateTime(dtMaestria.Rows[0]["datFechaInicio"]);
                this.m_datFechaFin       = System.Convert.ToDateTime(dtMaestria.Rows[0]["datFechaFin"]);
                this.m_MatriculaAbierta  = System.Convert.ToBoolean(dtMaestria.Rows[0]["MatriculaAbierta"]);
                this.m_IdModuloActual    = System.Convert.ToByte(dtMaestria.Rows[0]["ModuloActual"]);
            }
            else
            {
                throw new System.Exception("Los datos de la tabla 'tbl_maestria' parecen haber sido alterados " +
                                           "fuera de la aplicación, existe más de un registro en la misma o ninguno. " +
                                           "Esta es una tabla de configuración que debería tener sólo los datos que " +
                                           "correspondan con la maestría actual.");
            }
        }
Ejemplo n.º 17
0
		public System.Byte getCantGruposTotal()
		{
			clsDAL oDAL = new clsDAL();
			System.Byte bytCant = System.Convert.ToByte(oDAL.getEscalarValue("SELECT COUNT(Id) FROM " + this.m_TableName + ";"));
			oDAL = null;
			return bytCant;
		}
Ejemplo n.º 18
0
        private void setFieldsValue(System.Byte Id)
        {
            string    strSQL   = "SELECT * FROM " + this.m_TableName + " WHERE " + this.m_TableName + ".Id=" + Id + ";";
            clsDAL    oDAL     = new clsDAL();
            DataTable dtModulo = oDAL.getDataTable(strSQL);

            oDAL = null;
            if (dtModulo.Rows.Count == 1)
            {
                this.m_Id             = System.Convert.ToByte(dtModulo.Rows[0]["Id"]);
                this.m_NoOrden        = System.Convert.ToByte(dtModulo.Rows[0]["NoOrden"]);
                this.m_NombreCorto    = System.Convert.ToString(dtModulo.Rows[0]["NombreCorto"]);
                this.m_NombreCompleto = System.Convert.ToString(dtModulo.Rows[0]["NombreCompleto"]);
                this.m_Objetivos      = System.Convert.ToString(dtModulo.Rows[0]["Objetivos"]);
            }
            else
            {
                // Cuando se pasa cero (0) como parámatro Id
                if (dtModulo.Rows.Count == 0 & Id == 0)
                {
                    this.m_Id             = 0;
                    this.m_NoOrden        = this.m_Id;
                    this.m_NombreCorto    = "No hay módulo activo";
                    this.m_NombreCompleto = this.m_NombreCorto;
                    this.m_Objetivos      = this.m_NombreCorto;
                }
            }
        }
Ejemplo n.º 19
0
		public System.Byte getCantGruposByMencion(System.Byte IdMencion)
		{
			clsDAL oDAL = new clsDAL();
			System.Byte bytCant = System.Convert.ToByte(oDAL.getEscalarValue("SELECT COUNT(Id) FROM " + this.m_TableName + " WHERE Id_Mencion=" + IdMencion + ";"));
			oDAL = null;
			return bytCant;
		}
Ejemplo n.º 20
0
        private void setFieldsValue()
        {
            string    strSQL       = "SELECT * FROM tbl_usuario_maestrante WHERE Id_Usuario=" + this.m_Id + ";";
            clsDAL    oDAL         = new clsDAL();
            DataTable dtMaestrante = oDAL.getDataTable(strSQL);

            if (dtMaestrante.Rows.Count == 1)
            {
                this.m_IdGrupo             = System.Convert.ToByte(dtMaestrante.Rows[0]["Id_Grupo"]);
                this.m_NoCI                = System.Convert.ToString(dtMaestrante.Rows[0]["NoCI"]);
                this.m_IdAcademicoAutoriza = System.Convert.ToUInt32(dtMaestrante.Rows[0]["Id_AcademicoAutoriza"]);
                // Manejar los datos de los campos que pertecen al tema de proyecto del maestrante.
                strSQL = "SELECT * FROM tbl_maestrante_tema_proyecto WHERE Id_Usuario=" + this.m_Id + ";";
                DataTable dtTemaProyecto = oDAL.getDataTable(strSQL);
                this.m_TieneTemaProyecto = false;
                if (dtTemaProyecto.Rows.Count == 1)
                {
                    this.m_IdTemaProyecto     = System.Convert.ToByte(dtTemaProyecto.Rows[0]["Id_TemaProyecto"]);
                    this.m_Argumentos         = System.Convert.ToString(dtTemaProyecto.Rows[0]["Argumentos"]);
                    this.m_datSolicitud       = System.Convert.ToDateTime(dtTemaProyecto.Rows[0]["datSolicitud"]);
                    this.m_EstadoTemaProyecto = (clsMaestrante.enuEstadoTemaProyecto)(dtTemaProyecto.Rows[0]["Estado"]);
                    this.m_IdAcademicoRevisa  = System.Convert.ToUInt32(dtTemaProyecto.Rows[0]["Id_AcademicoRevisa"]);
                    this.m_TieneTemaProyecto  = true;
                }
            }
            oDAL = null;
        }
Ejemplo n.º 21
0
        public bool canBeDeleted(System.Byte Id)
        {
            bool   boResult = true;
            string strSQL   = "SELECT DISTINCT " +
                              "CASE WHEN tbl_maestrante_tema_proyecto.Id_TemaProyecto=tbl_tema_proyecto.Id THEN true ELSE false END AS Maestrante " +
                              "FROM tbl_tema_proyecto " +
                              "LEFT JOIN tbl_maestrante_tema_proyecto ON tbl_tema_proyecto.Id = tbl_maestrante_tema_proyecto.Id_TemaProyecto " +
                              "WHERE tbl_tema_proyecto.Id=" + Id + ";";
            // Esta opción se elimina porque esta es una entidad extendida, o sea, que cuando borramos
            // el curso también borramos todos sus registro en la tabla 'tbl_curso_mencion'
            // "CASE WHEN tbl_curso_mencion.Id_Curso=tbl_curso.Id THEN true ELSE false END AS Mencion " +
            // "LEFT JOIN tbl_curso_mencion ON tbl_curso.Id = tbl_curso_mencion.Id_Curso " +

            clsDAL    oDAL           = new clsDAL();
            DataTable dtTemaProyecto = oDAL.getDataTable(strSQL);

            oDAL = null;
            // Comprobar que existe un registro.
            if (dtTemaProyecto.Rows.Count == 0)
            {
                return(false);
            }

            for (int x = 0; x <= (dtTemaProyecto.Columns.Count - 1); x++)
            {
                if (System.Convert.ToBoolean(dtTemaProyecto.Rows[0][x]))
                {
                    return(false);
                }
            }
            return(boResult);
        }
Ejemplo n.º 22
0
        public void Delete(System.UInt32 Id)
        {
            clsDAL oDAL = new clsDAL();

            oDAL.ExecCommand("DELETE FROM tbl_usuario_mensaje WHERE Id=" + Id + ";");
            oDAL = null;
        }
Ejemplo n.º 23
0
        /*
         *
         * public new DataTable getById(System.UInt32 Id)
         * {
         *      string strSQL = "SELECT * FROM " + this.m_TableName + " WHERE Id_Usuario=" + Id + ";";
         *      clsDAL oDAL = new clsDAL();
         *      DataTable dt = oDAL.getDataTable(strSQL);
         *      oDAL = null;
         *      return dt;
         * }
         *
         * /// <summary>
         * /// Devuelve la cantidad de registros de esta entidad que estén en la base de datos.
         * /// </summary>
         * /// <returns></returns>
         * public new System.UInt32 getCantidad()
         * {
         *      clsDAL oDAL = new clsDAL();
         *      System.UInt32 bytCant = System.Convert.ToUInt32(oDAL.getEscalarValue("SELECT COUNT(Id_Usuario) FROM " + this.m_TableName + ";"));
         *      oDAL = null;
         *      return bytCant;
         * }
         *
         */

        public new bool Agregar()
        {
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                if (base.existURL(this.m_FullURL))
                {
                    return(false);
                }                                                                // Comprobar si ya existe la URL.
                if (!base.Agregar())
                {
                    return(false);
                }                                             // Comprobar que se agregan correctamente los datos generales del usuario.
                string strSQL = string.Empty;                 // Consulta para actualizar tbl_usuario.
                strSQL = "INSERT INTO " + this.m_TableFiles + " VALUES(null, " + this.m_Id + ", " + this.m_FileSize + ", '" + this.m_FullURL + "');";
                oDAL.ExecCommand(strSQL);
                if (this.m_URLUserName != string.Empty & this.m_URLUserPass != string.Empty)
                {
                    strSQL = "INSERT INTO " + this.m_TableCredenciales + " VALUES(" + this.m_Id + ", '" + this.m_URLUserName + "', '" + this.m_URLUserPass + "');";
                    oDAL.ExecCommand(strSQL);
                }
                oDAL.CommitTrans();
                oDAL = null;
                return(true);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al agregar nueva bibliografía en disco compacto.", Ex);
            }
        }
Ejemplo n.º 24
0
        private void setFieldsValue(System.Byte Id)
        {
            clsDAL    oDAL = new clsDAL();
            DataTable dtProvincia;

            if (Id == 0)
            {
                dtProvincia = oDAL.getDataTable("SELECT * FROM tbl_provincia WHERE Id = (SELECT Id_Provincia FROM tbl_maestria);");
            }
            else
            {
                dtProvincia = oDAL.getDataTable("SELECT * FROM tbl_provincia WHERE Id = " + Id + ";");
            }
            oDAL = null;

            if (dtProvincia.Rows.Count == 1)
            {
                this.m_Id       = System.Convert.ToByte(dtProvincia.Rows[0]["Id"]);
                this.m_Nombre   = System.Convert.ToString(dtProvincia.Rows[0]["Nombre"]);
                this.m_Acronimo = System.Convert.ToString(dtProvincia.Rows[0]["Acronimo"]);
            }
            else
            {
                throw new System.Exception("Los datos de la tabla 'tbl_maestria' parecen haber sido alterados " +
                                           "fuera de la aplicación, existe más de un registro en la misma o ninguno. " +
                                           "Esta es una tabla de configuración que debería tener sólo los datos que " +
                                           "correspondan con la maestría actual.");
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Devuelve los campos: Id, Maestrante, Docente, Tema, FechaHoraConsulta, Consulta, FechaHoraRespuesta,
        /// Respuesta y Leida, de aquellas consultas que coincidan según los parámetros que se pasan.
        /// </summary>
        /// <param name="criterioIdTema"></param>
        /// <param name="criterioIdUsuarioDocente"></param>
        /// <param name="criterioIdusuarioMaestrante"></param>
        /// <param name="criterioCadena"></param>
        /// <returns></returns>
        public DataTable Buscar(string criterioIdTema, string criterioIdDocente,
                                string criterioIdMaestrante, string criterioCadena)
        {
            string strSQL = "SELECT tbl_consulta.Id, CONCAT(table_maestrante.Nombre, ' ', table_maestrante.Apellidos) AS Maestrante, " +
                            "CONCAT(table_docente.Nombre, ' ', table_docente.Apellidos) AS Docente, tbl_tema.Nombre AS Tema, " +
                            "tbl_consulta.datFechaHora AS FechaHoraConsulta, tbl_consulta.Consulta AS Consulta, " +
                            "tbl_consulta_respuesta.datFechaHora AS FechaHoraRespuesta, " +
                            "tbl_consulta_respuesta.Respuesta AS Respuesta,  tbl_consulta_respuesta.Leida AS Leida " +
                            "FROM tbl_consulta " +
                            "INNER JOIN tbl_usuario AS table_maestrante ON table_maestrante.Id=tbl_consulta.Id_UsuarioMaestrante " +
                            "INNER JOIN tbl_usuario AS table_docente ON table_docente.Id=tbl_consulta.Id_UsuarioDocente " +
                            "INNER JOIN tbl_tema ON tbl_consulta.Id_Tema=tbl_tema.Id " +
                            "INNER JOIN tbl_consulta_respuesta ON tbl_consulta.Id=tbl_consulta_respuesta.Id_consulta " +
                            "WHERE (tbl_consulta.Id_Tema" + criterioIdTema + ") AND " +
                            "(tbl_consulta.Id_UsuarioDocente" + criterioIdDocente + ") AND " +
                            "(tbl_consulta.Id_UsuarioMaestrante" + criterioIdMaestrante + ") AND " +
                            "(tbl_consulta.Consulta LIKE '" + criterioCadena + "' OR tbl_consulta_respuesta.Respuesta LIKE '" + criterioCadena + "') " +
                            "ORDER BY tbl_consulta_respuesta.datFechaHora DESC;";
            clsDAL    oDAL = new clsDAL();
            DataTable dt;

            dt   = oDAL.getDataTable(strSQL);
            oDAL = null;
            return(dt);
        }
Ejemplo n.º 26
0
        public bool canBeDeleted(System.UInt32 Id)
        {
            bool   boResult = true;
            string strSQL   = "SELECT DISTINCT " +
                              "CASE WHEN tbl_consulta_respuesta.Id_Consulta=tbl_consulta.Id THEN true ELSE false END AS Respuesta " +
                              "FROM tbl_consulta " +
                              "LEFT JOIN tbl_consulta_respuesta ON tbl_consulta.Id = tbl_consulta_respuesta.Id_Consulta " +
                              "WHERE tbl_consulta.Id=" + Id + ";";

            clsDAL    oDAL       = new clsDAL();
            DataTable dtConsulta = oDAL.getDataTable(strSQL);

            oDAL = null;
            // Comprobar que existe un registro.
            if (dtConsulta.Rows.Count == 0)
            {
                return(false);
            }

            for (int x = 0; x <= (dtConsulta.Columns.Count - 1); x++)
            {
                if (System.Convert.ToBoolean(dtConsulta.Rows[0][x]))
                {
                    return(false);
                }
            }
            return(boResult);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Actualiza los datos del maestrante en las tablas:
        /// "tbl_usuario", "tbl_usuario_maestrante" y agrega
        /// o actualiza según como corresponda los datos del
        /// tema de proyecto que solicita el maestrante.
        /// </summary>
        /// <returns></returns>
        public new bool Actualizar()
        {
            if (this.m_Id == 0)
            {
                return(false);
            }
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                if (!base.Actualizar())
                {
                    return(false);
                }
                if (base.existUserId(base.Id, base.UserId))
                {
                    return(false);
                }                                                                         // Comprobar que el UserId no exista.
                string strSQL = "UPDATE " + this.m_TableName + " SET Id_Grupo=" + this.m_IdGrupo + ", " +
                                "NoCI='" + this.m_NoCI + "', Id_AcademicoAutoriza=" + this.m_IdAcademicoAutoriza + " " +
                                "WHERE Id_Usuario=" + this.m_Id + ";";
                bool boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                if (!boResult)
                {
                    return(false);
                }
                if (this.m_IdTemaProyecto != 0)
                {
                    // Poner el Id de académico que revisa en cero (ninguno), si el estado es "NoRevisado"
                    if (this.m_EstadoTemaProyecto.ToString("d") == clsMaestrante.enuEstadoTemaProyecto.NoRevisado.ToString("d"))
                    {
                        this.m_IdAcademicoRevisa = 0;
                    }
                    if (this.TieneTemaProyecto)                    // Actualizar el tema de proyecto.
                    {
                        strSQL = "UPDATE tbl_maestrante_tema_proyecto SET Id_TemaProyecto=" + this.m_IdTemaProyecto + ", " +
                                 "Argumentos='" + this.m_Argumentos + "', datSolicitud='" + clsUtiles.getStringMySqlFormatedDate(this.m_datSolicitud) + "', " +
                                 "Estado=" + this.Estado.ToString("d") + ", Id_AcademicoRevisa=" + this.m_IdAcademicoRevisa + " " +
                                 "WHERE Id_Usuario=" + this.m_Id + ";";
                    }
                    else                     // Agregar el tema de proyecto.
                    {
                        strSQL = "INSERT INTO tbl_maestrante_tema_proyecto VALUES(" + this.m_Id + ", " + this.m_IdTemaProyecto + ", '" +
                                 this.m_Argumentos + "', '" + clsUtiles.getStringMySqlFormatedDate(this.m_datSolicitud) + "', " +
                                 this.Estado.ToString("d") + ", " + this.m_IdAcademicoRevisa + ");";
                    }
                    boResult = System.Convert.ToBoolean(oDAL.ExecCommand(strSQL));
                }
                oDAL.CommitTrans();
                oDAL = null;
                return(boResult);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al actualizar datos del maestrante.", Ex);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Devuelve el registro completo de la provincia cuyo Id se pase como valor del parámetro "Id"
        /// </summary>
        /// <param name="Id_Provincia"></param>
        /// <returns></returns>
        public System.Data.DataTable getById(System.Byte Id)
        {
            clsDAL    oDAL        = new clsDAL();
            DataTable dtProvincia = oDAL.getDataTable("SELECT * FROM tbl_provincia WHERE Id=" + Id + ";");

            oDAL = null;
            return(dtProvincia);
        }
Ejemplo n.º 29
0
        public string getNombre(System.Byte Id)
        {
            clsDAL oDAL      = new clsDAL();
            string strNombre = System.Convert.ToString(oDAL.getEscalarValue("SELECT Nombre FROM tbl_provincia WHERE Id=" + Id + ";"));

            oDAL = null;
            return(strNombre);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Devuelve un DataTable con las columnas "Id" y "Nombre" de todas las provincias registradas.
        /// </summary>
        /// <returns></returns>
        public System.Data.DataTable getLista()
        {
            clsDAL    oDAL        = new clsDAL();
            DataTable dtProvincia = oDAL.getDataTable("SELECT Id, Nombre FROM tbl_provincia ORDER BY Nombre;");

            oDAL = null;
            return(dtProvincia);
        }