/// <summary> /// Carga un pedido /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { try { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.NoCliente = result.Rows[0]["noCliente"].ToString(); this.IdChofer = Convert.ToInt32(result.Rows[0]["idChofer"]); this.FechaCreacion = Convert.ToDateTime(result.Rows[0]["fechaCreacion"]); this.FechaEntregar = Convert.ToDateTime(result.Rows[0]["fechaEntregar"]); this.Notas = result.Rows[0]["notas"].ToString(); this.EsAtendido = Convert.ToBoolean(result.Rows[0]["esAtendido"]); this.Status = Convert.ToBoolean(result.Rows[0]["status"]); return(true); } else { return(false); } } catch (Exception) { throw; } }
/// <summary> /// Lista de alumnos registrados /// </summary> public DataTable Lista(int idProfesor) { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_LIST"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, idProfesor); return(DBaccess.ExecuteSQLSelect(cmd)); }
/// <summary> /// Lista de alumnos registrados /// </summary> public DataTable Lista(string pista) { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_LIST"); DBaccess.ParameterAdd(cmd, "@pista", SqlDbType.VarChar, pista); return(DBaccess.ExecuteSQLSelect(cmd)); }
/// <summary> /// Agrega registros de pedidos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { try { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@noCliente", SqlDbType.VarChar, this.NoCliente); DBaccess.ParameterAdd(cmd, "@idChofer", SqlDbType.VarChar, this.IdChofer); DBaccess.ParameterAdd(cmd, "@fechaCreacion", SqlDbType.VarChar, this.FechaCreacion); DBaccess.ParameterAdd(cmd, "@fechaEntregar", SqlDbType.VarChar, this.FechaEntregar); DBaccess.ParameterAdd(cmd, "@notas", SqlDbType.VarChar, this.Notas); DBaccess.ParameterAdd(cmd, "@esAtendido", SqlDbType.VarChar, this.EsAtendido); DBaccess.ParameterAdd(cmd, "@status", SqlDbType.Bit, this.Status); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } } catch (Exception) { throw; } }
/// <summary> /// Carga una empresa /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.NoCliente = result.Rows[0]["noCliente"].ToString(); this.Nombre = result.Rows[0]["nombre"].ToString(); this.RFC = result.Rows[0]["rfc"].ToString(); this.Telefono = result.Rows[0]["telefono"].ToString(); this.Colonia = result.Rows[0]["colonia"].ToString(); this.Calle = result.Rows[0]["calle"].ToString(); this.NoInterior = Convert.ToInt32(result.Rows[0]["noInt"].ToString()); this.NoExterior = Convert.ToInt32(result.Rows[0]["noExt"].ToString()); this.CodPostal = Convert.ToInt32(result.Rows[0]["cPostal"].ToString()); this.FechaRegistro = Convert.ToDateTime(result.Rows[0]["fechaRegistro"].ToString()); this.Status = Convert.ToBoolean(result.Rows[0]["status"]); this.Precio = Convert.ToInt32(result.Rows[0]["idPrecio"]); return(true); } else { return(false); } }
/// <summary> /// Agrega registros de empresas /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@noCliente", SqlDbType.VarChar, this.NoCliente); DBaccess.ParameterAdd(cmd, "@nombre", SqlDbType.VarChar, this.Nombre); DBaccess.ParameterAdd(cmd, "@rfc", SqlDbType.VarChar, this.RFC); DBaccess.ParameterAdd(cmd, "@tel", SqlDbType.VarChar, this.Telefono); DBaccess.ParameterAdd(cmd, "@colonia", SqlDbType.VarChar, this.Colonia); DBaccess.ParameterAdd(cmd, "@calle", SqlDbType.VarChar, this.Calle); DBaccess.ParameterAdd(cmd, "@noInt", SqlDbType.Int, this.NoInterior); DBaccess.ParameterAdd(cmd, "@noExt", SqlDbType.Int, this.NoExterior); DBaccess.ParameterAdd(cmd, "@cPostal", SqlDbType.VarChar, this.CodPostal); DBaccess.ParameterAdd(cmd, "@fechaRegistro", SqlDbType.DateTime, this.FechaRegistro); DBaccess.ParameterAdd(cmd, "@status", SqlDbType.Bit, this.Status); DBaccess.ParameterAdd(cmd, "@idPrecio", SqlDbType.TinyInt, this.Precio); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } }
/// <summary> /// Carga un alumno /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.Nombre = result.Rows[0]["nombre"].ToString(); this.ApPaterno = result.Rows[0]["apellidoP"].ToString(); this.ApMaterno = result.Rows[0]["apellidoM"].ToString(); this.Celular = result.Rows[0]["celular"].ToString(); this.Radio = result.Rows[0]["radio"].ToString(); this.Email = result.Rows[0]["email"].ToString(); this.Status = Convert.ToBoolean(result.Rows[0]["status"]); return(true); } else { return(false); } }
/// <summary> /// Elimina alumnos registrados /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Delete() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_DELETE"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); return(DBaccess.EjecutarSQLNonQuery(cmd) > 0); }
/// <summary> /// Lista de alumnos registrados /// </summary> public DataTable ListaFiltro(int id, string pista) { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_LISTFILTRO"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, id); DBaccess.ParameterAdd(cmd, "@pista", SqlDbType.VarChar, pista); return(DBaccess.ExecuteSQLSelect(cmd)); }
/// <summary> /// Agrega registros de alumnos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@precio", SqlDbType.Decimal, this.Precio); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } }
/// <summary> /// Agrega registros de alumnos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@descripcion", SqlDbType.VarChar, this.Descripcion); DBaccess.ParameterAdd(cmd, "@valor", SqlDbType.VarChar, this.Valor); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } }
/// <summary> /// Si el nombre y password son correctos, regresara 'true' /// </summary> public bool Login() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIX + "_login"); DBaccess.ParameterAdd(cmd, "@username", SqlDbType.VarChar, this.UserName); DBaccess.ParameterAdd(cmd, "@password", SqlDbType.VarChar, this.Password); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this._id = Convert.ToInt32(result.Rows[0]["id"]); return(this.Load()); } else { return(false); } }
/// <summary> /// Carga un alumno /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.Precio = Convert.ToDecimal(result.Rows[0]["precio"]); return(true); } else { return(false); } }
/// <summary> /// Agrega registros de alumnos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@nombre", SqlDbType.VarChar, this.Nombre); DBaccess.ParameterAdd(cmd, "@fechaInicio", SqlDbType.DateTime, this.FechaInicio); DBaccess.ParameterAdd(cmd, "@fechaFin", SqlDbType.DateTime, this.FechaFin); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } }
/// <summary> /// Carga un alumno /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.Descripcion = result.Rows[0]["descripcion"].ToString(); this.Valor = Convert.ToInt32(result.Rows[0]["valor"].ToString()); return(true); } else { return(false); } }
/// <summary> /// Carga un alumno /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.Nombre = result.Rows[0]["nombre"].ToString(); this.FechaInicio = Convert.ToDateTime(result.Rows[0]["fechaInicio"].ToString()); this.FechaFin = Convert.ToDateTime(result.Rows[0]["fechaFin"].ToString()); return(true); } else { return(false); } }
/// <summary> /// Carga un alumno /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.IdContacto = Convert.ToInt32(result.Rows[0]["idContacto"]); this.IdEmpresa = Convert.ToInt32(result.Rows[0]["idEmpresa"]); this.FechaInicio = Convert.ToDateTime(result.Rows[0]["fechaRegistro"].ToString()); this.Status = Convert.ToBoolean(result.Rows[0]["status"]); return(true); } else { return(false); } }
/// <summary> /// Agrega registros de alumnos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@profesor", SqlDbType.VarChar, this.Profesor); DBaccess.ParameterAdd(cmd, "@grado", SqlDbType.VarChar, this.Grado); DBaccess.ParameterAdd(cmd, "@tipoGrado", SqlDbType.VarChar, this.TipoGrado); DBaccess.ParameterAdd(cmd, "@cedula", SqlDbType.VarChar, this.Cedula); DBaccess.ParameterAdd(cmd, "@institucion", SqlDbType.VarChar, this.Institucion); DBaccess.ParameterAdd(cmd, "@fecha", SqlDbType.DateTime, this.Fecha); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } }
/// <summary> /// Agrega registros de alumnos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { int n = 0; SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@idContacto", SqlDbType.Int, this.IdContacto); DBaccess.ParameterAdd(cmd, "@idEmpresa", SqlDbType.Int, this.IdEmpresa); DBaccess.ParameterAdd(cmd, "@fechaRegistro", SqlDbType.DateTime, this.FechaInicio); DBaccess.ParameterAdd(cmd, "@status", SqlDbType.Bit, this.Status); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { n = DBaccess.EjecutarSQLNonQuery(cmd); //return s; } return(n > 0); }
/// <summary> /// Carga un usuario /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIX + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this._id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Name = result.Rows[0]["name"].ToString(); this.UserName = result.Rows[0]["username"].ToString(); this.Password = result.Rows[0]["password"].ToString(); this.RegistrationDate = Convert.ToDateTime(result.Rows[0]["regDate"]); this.ExpirationDate = Convert.ToDateTime(result.Rows[0]["expDate"]); this.Status = Convert.ToBoolean(result.Rows[0]["status"]); return(true); } else { return(false); } }
/// <summary> /// Agrega registros de alumnos /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool UpSert() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_UPSERT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DBaccess.ParameterAdd(cmd, "@nombre", SqlDbType.VarChar, this.Nombre); DBaccess.ParameterAdd(cmd, "@apellidoP", SqlDbType.VarChar, this.ApPaterno); DBaccess.ParameterAdd(cmd, "@apellidoM", SqlDbType.VarChar, this.ApMaterno); DBaccess.ParameterAdd(cmd, "@celular", SqlDbType.VarChar, this.Celular); DBaccess.ParameterAdd(cmd, "@radio", SqlDbType.VarChar, this.Radio); DBaccess.ParameterAdd(cmd, "@email", SqlDbType.VarChar, this.Email); DBaccess.ParameterAdd(cmd, "@status", SqlDbType.Bit, this.Status); if (this._id == 0) { this._id = Convert.ToInt32(DBaccess.EjecutarSQLScalar(cmd)); return(this._id > 0); } else { bool s = DBaccess.EjecutarSQLNonQuery(cmd) > 0; return(s); } }
/// <summary> /// Carga un alumno /// </summary> /// <returns>'true' si fue correcto, 'false' si fue incorrecto</returns> public bool Load() { SqlCommand cmd = DBaccess.CreateSQLCommand(K_PREFIJO + "_SELECT"); DBaccess.ParameterAdd(cmd, "@id", SqlDbType.Int, this.Id); DataTable result = DBaccess.ExecuteSQLSelect(cmd); if (result.Rows.Count > 0) { this.Id = Convert.ToInt32(result.Rows[0]["id"]); this.Profesor = Convert.ToInt32(result.Rows[0]["profesor"].ToString()); this.Grado = result.Rows[0]["grado"].ToString(); this.TipoGrado = Convert.ToInt32(result.Rows[0]["tipoGrado"].ToString()); this.Cedula = result.Rows[0]["cedula"].ToString(); this.Institucion = result.Rows[0]["institucion"].ToString(); this.Fecha = Convert.ToDateTime(result.Rows[0]["fecha"].ToString()); return(true); } else { return(false); } }