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); } }
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); }
/// <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); } }
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); } }
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); } }
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); } }
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); } }