Exemplo n.º 1
0
        public void Delete(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
        {
            try
            {
                SqlCommand command = new SqlCommand("Inv.Spr_Delete_SubCategoriaArticulos", Connection.Get);
                command.CommandType = CommandType.StoredProcedure;

                Connection.Get.Open();

                command.Parameters.Add(new SqlParameter("@Codigo", enlSubCategoriaArticulo.Codigo)
                {
                    SqlDbType = SqlDbType.NVarChar
                });

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (Connection.Get.State != ConnectionState.Closed)
                {
                    Connection.Get.Close();
                }
            }
        }
Exemplo n.º 2
0
        public string Insert(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
        {
            //Validaciones De Lugar

            if (dalNumeracion.ObtenerTipo("SubCategoria de Articulos") == "Automatico")
            {
                if (!string.IsNullOrEmpty(dalNumeracion.ObtenerPrefijo("SubCategoria de Articulos")))
                {
                    enlSubCategoriaArticulo.Codigo = dalNumeracion.ObtenerPrefijo("SubCategoria de Articulos") + dalNumeracion.ObtenerNumero("SubCategoria de Articulos").ToString("00000000");
                }
                else
                {
                    enlSubCategoriaArticulo.Codigo = dalNumeracion.ObtenerNumero("SubCategoria de Articulos").ToString("00000000");
                }
            }

            if (dalSubCategoriaArticulos.IsExiste(enlSubCategoriaArticulo) == "False")
            {
                dalSubCategoriaArticulos.Insert(enlSubCategoriaArticulo);
                MessageBox.Show("Registro Guardado Correctamente", "SGF");
            }
            else
            {
                MessageBox.Show("Registro ya Existe", "SGF");
            }
            return(enlSubCategoriaArticulo.Codigo);
        }
Exemplo n.º 3
0
        public string IsExiste(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
        {
            try
            {
                SqlCommand command = new SqlCommand("Inv.Spr_IsExiste_SubCategoriaArticulos", Connection.Get);
                command.CommandType = CommandType.StoredProcedure;
                Connection.Get.Open();

                command.Parameters.Add(new SqlParameter("@Codigo", enlSubCategoriaArticulo.Codigo)
                {
                    SqlDbType = SqlDbType.NVarChar
                });
                command.Parameters.Add("@IsExiste", SqlDbType.Bit);
                command.Parameters["@IsExiste"].Direction = ParameterDirection.Output;

                command.ExecuteNonQuery();

                return(command.Parameters["@IsExiste"].Value.ToString());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (Connection.Get.State != ConnectionState.Closed)
                {
                    Connection.Get.Close();
                }
            }
        }
Exemplo n.º 4
0
        public IList <Enl_SubCategoriaArticulos> Search(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
        {
            try
            {
                SqlCommand command = new SqlCommand("Inv.Spr_Search_SubCategoriaArticulos", Connection.Get);
                command.CommandType = CommandType.StoredProcedure;
                Connection.Get.Open();

                command.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@Codigo",
                    SqlDbType     = SqlDbType.NVarChar,
                    Value         = enlSubCategoriaArticulo.Codigo
                });

                command.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@Nombre",
                    SqlDbType     = SqlDbType.NVarChar,
                    Value         = enlSubCategoriaArticulo.Nombre
                });



                var dr   = command.ExecuteReader();
                var list = new List <Enl_SubCategoriaArticulos>();

                while (dr.Read())
                {
                    list.Add(new Enl_SubCategoriaArticulos
                    {
                        Codigo = dr.GetString(dr.GetOrdinal("Codigo")),
                        Nombre = dr.GetString(dr.GetOrdinal("Nombre")),
                        Nota   = dr.GetString(dr.GetOrdinal("Nota")),
                    });
                }

                return(list);
            }
            catch (Exception)
            {
                //Guardar Error en Tabla
                throw;
            }
            finally
            {
                if (Connection.Get.State != ConnectionState.Closed)
                {
                    Connection.Get.Close();
                }
            }
        }
Exemplo n.º 5
0
        public IList <Enl_SubCategoriaArticulos> Search(Enl_SubCategoriaArticulos enlCategoriaArticulo)
        {
            //Validaciones de Lugar

            var ListaSubCategoriaArticulos = dalSubCategoriaArticulos.Search(enlCategoriaArticulo);

            if (ListaSubCategoriaArticulos.Count != 0)
            {
                return(ListaSubCategoriaArticulos);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
        public bool Delete(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
        {
            //Validaciones De Lugar

            if (!string.IsNullOrEmpty(enlSubCategoriaArticulo.Codigo))
            {
                if (MessageBox.Show("Realmente Desea Eliminar El Registro", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    dalSubCategoriaArticulos.Delete(enlSubCategoriaArticulo);
                    MessageBox.Show("Registro Eliminado Exitosamente", "SGF");
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 7
0
 public string IsExiste(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
 {
     return(dalSubCategoriaArticulos.IsExiste(enlSubCategoriaArticulo));
 }
Exemplo n.º 8
0
        public void Update(Enl_SubCategoriaArticulos enlSubCategoriaArticulo)
        {
            //Validaciones De Lugar

            dalSubCategoriaArticulos.Update(enlSubCategoriaArticulo);
        }