Example #1
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);
        }
Example #2
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);
            }
        }
Example #3
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);
            }
        }
Example #4
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);
            }
        }
Example #5
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);
            }
        }
Example #6
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);
            }
        }
Example #7
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);
            }
        }
Example #8
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);
            }
        }
Example #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 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);
            }
        }
Example #10
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);
            }
        }
Example #11
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);
            }
        }
Example #12
0
		public System.Byte Agregar()
		{
			string strSQL = "INSERT INTO " + this.m_TableName + " " +
				"VALUES(null, " + this.m_IdSede + ", " + this.m_IdMencion + ", '" + this.m_Nombre + "');";
			
			clsDAL oDAL = new clsDAL();
			try
			{
				oDAL.BeginTrans();
				oDAL.ExecCommand(strSQL);
				System.Byte intIdentity = System.Convert.ToByte(oDAL.getLastIDENTITY(this.m_TableName));
				oDAL.CommitTrans();
				oDAL = null;
				return intIdentity;
			}
			catch(System.Exception Ex)
			{
				oDAL.RollBackTrans();
				throw new System.Exception("Error al insertar grupo.", Ex);
			}
		}
Example #13
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.existURL(base.Id, this.m_FullURL))
                {
                    return(false);
                }                                                                         // Comprobar que el UserId no exista.
                // Actualizar la table de los ficheros.
                string strSQL = "UPDATE " + this.m_TableFiles + " SET FileSize=" + this.m_FileSize + ", FullURL='" + this.m_FullURL + "' " +
                                "WHERE Id_Bibliografia=" + this.m_Id + ";";
                oDAL.ExecCommand(strSQL);
                // Actualizar la table de las credenciales para acceder al recurso.
                if (this.m_URLUserName != string.Empty & this.m_URLUserPass != string.Empty)
                {
                    strSQL = "UPDATE " + this.m_TableCredenciales + " SET URLUserName="******", m_URLUserPass='******' " +
                             "WHERE Id_Bibliografia=" + this.m_Id + ";";
                    oDAL.ExecCommand(strSQL);
                }
                oDAL.CommitTrans();
                oDAL = null;
                return(true);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al actualizar datos del académico.", Ex);
            }
        }
Example #14
0
        public System.UInt32 Agregar()
        {
            string strSQL = "INSERT INTO " + this.m_TableName + " " +
                            "VALUES(null, " + this.IdUsuarioMaestrante + ", " + this.IdUsuarioDocente + ", " + this.IdTema + ", '" + clsUtiles.getStringMySqlFormatedDate(this.datFechaHora) + "', '" + this.Consulta + "');";

            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                oDAL.ExecCommand(strSQL);
                System.UInt32 intIdentity = System.Convert.ToUInt32(oDAL.getLastIDENTITY(this.m_TableName));
                oDAL.CommitTrans();
                oDAL = null;
                return(intIdentity);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al insertar consulta.", Ex);
            }
        }
Example #15
0
        public System.Byte Agregar(System.Byte NoOrden, System.String NombreCorto, System.String NombreCompleto, System.String Objetivos)
        {
            string strSQL = "INSERT INTO " + this.m_TableName + " " +
                            "VALUES(null, " + NoOrden + ", '" + NombreCorto + "', '" + NombreCompleto + "', '" + Objetivos + "');";
            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                oDAL.ExecCommand(strSQL);
                System.Byte intIdentity = System.Convert.ToByte(oDAL.getLastIDENTITY(this.m_TableName));
                //System.Diagnostics.Debug.WriteLine(intIdentity);
                oDAL.CommitTrans();
                oDAL = null;
                return(intIdentity);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al insertar módulo.", Ex);
            }
        }
Example #16
0
        public System.Byte Agregar()
        {
            string strSQL = "INSERT INTO " + this.m_TableName + " " +
                            "VALUES(null, " + this.IdCurso + ", '" + this.m_Nombre + "', '" + this.m_ObjetivosGenerales + "', '" + this.m_ActividadesAprendizaje + "', '" + this.ActividadesAutoevaluacion + "');";

            clsDAL oDAL = new clsDAL();

            try
            {
                oDAL.BeginTrans();
                oDAL.ExecCommand(strSQL);
                System.Byte intIdentity = System.Convert.ToByte(oDAL.getLastIDENTITY(this.m_TableName));
                oDAL.CommitTrans();
                oDAL = null;
                return(intIdentity);
            }
            catch (System.Exception Ex)
            {
                oDAL.RollBackTrans();
                throw new System.Exception("Error al insertar tema.", Ex);
            }
        }
Example #17
0
        public bool Actualizar()
        {
            if (this.m_Id == 0)
            {
                return(false);
            }
            string strSQL = "UPDATE " + this.m_TableName + " SET Titulo='" + this.m_Titulo + "', " +
                            "Autores='" + this.m_Autores + "', Tipo=" + System.Convert.ToByte(this.m_Tipo) + " WHERE Id=" + this.m_Id + ";";
            clsDAL oDAL = new clsDAL();

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

            // PARA AGREGAR LOS TEMAS A LOS QUE PERTENECE LA BIBLIOGRAFÍA.
            // 1. Eliminar todos los temas a los que pertenece la bibliografía.
            strSQL = "DELETE FROM " + this.m_TableTemas + " WHERE Id_Bibliografia=" + this.m_Id + ";";
            oDAL.ExecCommand(strSQL);
            // 2. Proceso para insertar nuevamente, pero sólo los valores que se proporcionan.
            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);
        }