public void Actualizar(SCE_PROMOCION_BE BE) { try { using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin))) { cn.Open(); string sql = "SP_SCE_PROMOCION_UPD"; using (SqlCommand cmd = new SqlCommand(sql, cn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID_PROMOCION", BE.ID_PROMOCION); cmd.Parameters.AddWithValue("@NOM_PROMOCION", BE.NOM_PROMOCION); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { throw ex; } }
public void Insertar(string nombre) { try { BE = new SCE_PROMOCION_BE(); BE.NOM_PROMOCION = nombre; DA.SCE_PROMOCION_DA DA = new DA.SCE_PROMOCION_DA(usrLogin); DA.Insertar(BE); } catch (Exception ex) { throw ex; } }
public void Actualizar(int Id, string nombre) { try { BE = new SCE_PROMOCION_BE(); BE.ID_PROMOCION = Id; BE.NOM_PROMOCION = nombre; DA.SCE_PROMOCION_DA DA = new DA.SCE_PROMOCION_DA(usrLogin); DA.Actualizar(BE); } catch (Exception ex) { throw ex; } }
public List <SCE_PROMOCION_BE> ListarConf() { List <SCE_PROMOCION_BE> lstBE = new List <SCE_PROMOCION_BE>(); SCE_PROMOCION_BE BE = null; try { using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin))) { cn.Open(); string sql = "SP_SCE_PROMOCION_SEL_CONF"; using (SqlCommand cmd = new SqlCommand(sql, cn)) { cmd.CommandType = CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { BE = new SCE_PROMOCION_BE(); BE.ID_PROMOCION = Convert.ToInt32(reader["ID_PROMOCION"]); BE.NOM_PROMOCION = Convert.ToString(reader["NOM_PROMOCION"]); lstBE.Add(BE); } return(lstBE); } } } catch (Exception ex) { throw ex; } }
public SCE_PROMOCION_BE ObtenerPorID(int Id) { SCE_PROMOCION_BE BE = null; try { using (SqlConnection cn = new SqlConnection(SCE_SQLCONEXION.GetCadConexion(usrLogin))) { cn.Open(); string sql = "SP_SCE_PROMOCION_GET"; using (SqlCommand cmd = new SqlCommand(sql, cn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID_PROMOCION", Id); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { BE = new SCE_PROMOCION_BE(); BE.ID_PROMOCION = Convert.ToInt32(reader["ID_PROMOCION"]); BE.NOM_PROMOCION = Convert.ToString(reader["NOM_PROMOCION"]); } return(BE); } } } catch (Exception ex) { throw ex; } }