Ejemplo n.º 1
0
        public string IsExiste(Enl_SubCategoriaSuplidores enlSubCategoriaSuplidores)
        {
            try
            {
                SqlCommand command = new SqlCommand("CxP.Spr_IsExiste_SubCategoriasuplidores", Connection.Get);
                command.CommandType = CommandType.StoredProcedure;
                Connection.Get.Open();

                command.Parameters.Add(new SqlParameter("@Codigo", enlSubCategoriaSuplidores.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();
                }
            }
        }
Ejemplo n.º 2
0
        public void Delete(Enl_SubCategoriaSuplidores enlSubCategoriaSuplidores)
        {
            try
            {
                SqlCommand command = new SqlCommand("CxP.Spr_Delete_SubCategoriaSuplidores", Connection.Get);
                command.CommandType = CommandType.StoredProcedure;

                Connection.Get.Open();

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

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (Connection.Get.State != ConnectionState.Closed)
                {
                    Connection.Get.Close();
                }
            }
        }
Ejemplo n.º 3
0
        public string Insert(Enl_SubCategoriaSuplidores enlSubCategoriaSuplidores)
        {
            //Validaciones De Lugar

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

            if (dalSubCategoriaSuplidores.Search(enlSubCategoriaSuplidores).Count == 0)
            {
                dalSubCategoriaSuplidores.Insert(enlSubCategoriaSuplidores);
                MessageBox.Show("Registro Guardado Correctamente", "SGF");
            }
            else
            {
                MessageBox.Show("Registro ya Existe", "SGF");
            }

            return(enlSubCategoriaSuplidores.Codigo);
        }
Ejemplo n.º 4
0
        public IList <Enl_SubCategoriaSuplidores> Search(Enl_SubCategoriaSuplidores enlSubCategoriaSuplidores)
        {
            try
            {
                SqlCommand command = new SqlCommand("CxP.Spr_Search_SubCategoriaSuplidores", Connection.Get);
                command.CommandType = CommandType.StoredProcedure;
                Connection.Get.Open();

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

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


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

                while (dr.Read())
                {
                    list.Add(new Enl_SubCategoriaSuplidores
                    {
                        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();
                }
            }
        }
Ejemplo n.º 5
0
        public IList <Enl_SubCategoriaSuplidores> Search(Enl_SubCategoriaSuplidores enlSubCategoriaSuplidores)
        {
            //Validaciones de Lugar

            var ListaSubCategoriaSuplidores = dalSubCategoriaSuplidores.Search(enlSubCategoriaSuplidores);

            if (ListaSubCategoriaSuplidores.Count != 0)
            {
                return(ListaSubCategoriaSuplidores);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        public bool Delete(Enl_SubCategoriaSuplidores enlSubCategoriaSuplidores)
        {
            //Validaciones De Lugar

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

            dalSubCategoriaSuplidores.Update(enlSubCategoriaSuplidores);
        }