Ejemplo n.º 1
0
 public InventarioDTO(SedeDTO sedeinventario, LoteDTO loteproducto, int idinventario, int cantidad, DateTime fecharegistro)
 {
     this.sedeinventario = sedeinventario;
     this.loteproducto = loteproducto;
     this.idinventario = idinventario;
     this.cantidad = cantidad;
     this.fecharegistro = fecharegistro;
 }
Ejemplo n.º 2
0
 public int Agregar(SedeDTO obj)
 {
     Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_AGREGAR);
       db.AddInParameter(dbCommand, "@nombre_sede", DbType.String, obj.NombreSede);
       db.AddInParameter(dbCommand, "@estado", DbType.String, obj.Estado);
       db.AddInParameter(dbCommand, "@direccion", DbType.String, obj.Direccion);
       int id = Convert.ToInt32 ( db.ExecuteScalar(dbCommand));
       return id;
 }
Ejemplo n.º 3
0
 public void Actualizar(SedeDTO obj)
 {
     Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_ACTUALIZAR);
       db.AddInParameter(dbCommand, "@id_sede", DbType.Int32, obj.IdSede);
       db.AddInParameter(dbCommand, "@nombre_sede", DbType.String, obj.NombreSede);
       db.AddInParameter(dbCommand, "@estado", DbType.String, obj.Estado);
       db.AddInParameter(dbCommand, "@direccion", DbType.String, obj.Direccion);
       db.ExecuteNonQuery(dbCommand);
 }
Ejemplo n.º 4
0
 public UsuarioDTO(string nombre, string apellido, string correo, SedeDTO sedeasignada, int idusuario, int idSede, string nombreusuario, string clave, int perfil)
 {
     this.nombre        = nombre;
     this.apellido      = apellido;
     this.correo        = correo;
     this.sedeasignada  = sedeasignada;
     this.idusuario     = idusuario;
     this.nombreusuario = nombreusuario;
     this.perfil        = perfil;
 }
        public List <SedeDTO> getListarSede_x_Empresa(int COD_EMPRESA)
        {
            List <SedeDTO> ListaSedeDTO = new List <SedeDTO>();
            //ListaUsuarioEmpresaDTO = null;
            string        cnxString = _appDBContext.Database.GetConnectionString();
            SqlConnection cnx       = new SqlConnection(cnxString);

            try
            {
                cnx.Open();
                using (SqlCommand Sqlcmd = new SqlCommand())
                {
                    Sqlcmd.Connection  = cnx;
                    Sqlcmd.CommandType = CommandType.StoredProcedure;
                    Sqlcmd.CommandText = "SP_S_Listar_Sede_Empresa_21";
                    Sqlcmd.Parameters.Clear();
                    Sqlcmd.Parameters.Add("@cod_empresa", SqlDbType.Int).Value = COD_EMPRESA;
                    SqlDataReader oDataReader = Sqlcmd.ExecuteReader();
                    while (oDataReader.Read())
                    {
                        SedeDTO SedeDTO = new SedeDTO();
                        SedeDTO.cod_sede  = int.Parse(oDataReader[0].ToString());
                        SedeDTO.des_sede  = oDataReader[1].ToString();
                        SedeDTO.direccion = oDataReader[2].ToString();
                        SedeDTO.activo    = bool.Parse(oDataReader[3].ToString());
                        ListaSedeDTO.Add(SedeDTO);
                    }
                }
            }
            catch (SqlException sex)
            {
                eErrorLog mensajeLogError = new eErrorLog(
                    sex.Message, "SedeRepository/getListarSede_x_Empresa(). SQL." + sex, "Error Sql");
                mensajeLogError.RegisterLog();
            }
            catch (Exception ex)
            {
                eErrorLog mensajeLogError = new eErrorLog(ex.Message, "SedeRepository/getListarSede_x_Empresa() EX." + ex, "Error");
                mensajeLogError.RegisterLog();
            }
            finally
            {
                if (cnx.State == System.Data.ConnectionState.Open)
                {
                    cnx.Close();
                }
            }


            return(ListaSedeDTO);
        }
Ejemplo n.º 6
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            SedeDTO obj = new SedeDTO();

            if (this.txtId.Text != "")
            {
                objSedeDAO.Eliminar(Convert.ToInt32(this.txtId.Text));

                Limpiar();
            }

            this.panRegistro.Visible = false;
            this.panLista.Visible = true;
            Listar();
        }
Ejemplo n.º 7
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            SedeDTO obj = new SedeDTO();

            obj = objSedeDAO.ListarPorClave(Convert.ToInt32(this.txtId.Text));

            obj.NombreSede = txtDescripcion.Text;
            obj.Direccion = txtDireccion.Text;
            if (this.chkEstado.Checked)
                obj.Estado = "1";
            else
                obj.Estado = "0";

            objSedeDAO.Actualizar(obj);
        }
Ejemplo n.º 8
0
        protected void btnGrabar_Click(object sender, EventArgs e)
        {
            SedeDTO obj = new SedeDTO();

            obj.NombreSede = txtDescripcion.Text;
            obj.Direccion = txtDireccion.Text;

            if (this.chkEstado.Checked)
                obj.Estado = "1";
            else
                obj.Estado = "0";

            int id = objSedeDAO.Agregar(obj);

            this.txtId.Text = id.ToString();

            this.btnNuevo.Visible = false;
            this.btnActualizar.Visible = true;
            this.btnEliminar.Visible = true;
            this.panRegistro.Visible = true;
            this.panLista.Visible = false;
        }
Ejemplo n.º 9
0
 public List<SedeDTO> Listar()
 {
     List<SedeDTO> Lista = new List<SedeDTO>();
       Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_LISTAR);
       using (IDataReader dr = db.ExecuteReader(dbCommand))
       {
       while (dr.Read())
       {
           SedeDTO obj = new SedeDTO();
           if (dr["id_sede"] != System.DBNull.Value)
               obj.IdSede = (int)dr["id_sede"];
           if (dr["nombre_sede"] != System.DBNull.Value)
               obj.NombreSede = (string)dr["nombre_sede"];
           if (dr["estado"] != System.DBNull.Value)
               obj.Estado = (string)dr["estado"];
           if (dr["direccion"] != System.DBNull.Value)
               obj.Direccion = (string)dr["direccion"];
           Lista.Add(obj);
       }
       }
       return Lista;
 }
Ejemplo n.º 10
0
 public SedeDTO ListarPorClave(int IdSede)
 {
     SedeDTO obj = null;
       List<SedeDTO> Lista = new List<SedeDTO>();
       Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_LISTAR_POR_CLAVE);
       db.AddInParameter(dbCommand, "@id_sede", DbType.Int32, IdSede);
       using (IDataReader dr = db.ExecuteReader(dbCommand))
       {
       while (dr.Read())
       {
           obj = new SedeDTO();
           if (dr["id_sede"] != System.DBNull.Value) obj.IdSede = (int)dr["id_sede"];
           if (dr["nombre_sede"] != System.DBNull.Value) obj.NombreSede = (string)dr["nombre_sede"];
           if (dr["estado"] != System.DBNull.Value) obj.Estado = (string)dr["estado"];
           if (dr["direccion"] != System.DBNull.Value) obj.Direccion = (string)dr["direccion"];
       }
       }
       return obj;
 }