Esempio n. 1
0
        public string UpdateDebeHaberCuentaProveedor(int cod_cuenta_corriente, decimal debe, decimal haber)
        {
            string respuesta;


            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("UpdateDebeHaberCuentaProveedor", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_cuenta_corriente", cod_cuenta_corriente);
                cmd.Parameters.AddWithValue("@debe", debe);

                cmd.Parameters.AddWithValue("@haber", haber);


                respuesta = cmd.ExecuteNonQuery() == 1 ? "Se actualizó la cuenta correctamente" : "Error al actualizar la cuenta";

                cn.Close();
            }

            return(respuesta);
        }
Esempio n. 2
0
        public string DeleteStockMedida(int cod_pro_stock)
        {
            string respuesta;

            try
            {
                using (cn = Conexion.ConexionDB())
                {
                    SqlCommand cmd = new SqlCommand("DeleteStockMedida", cn)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    cmd.Parameters.AddWithValue("@cod_pro_stock", cod_pro_stock);

                    cmd.ExecuteNonQuery();
                }
                respuesta = "Producto por medida eliminado correctamente";
            }
            catch (Exception ex)
            {
                respuesta = "Error al eliminar producto por medida: " + ex.Message;
            }

            return(respuesta);
        }
Esempio n. 3
0
        public string UpdateProveedor(int cod_proveedor, string nombre, string telefono, int cod_dir, int cp, string email,
                                      string razon_social)
        {
            string respuesta;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("UpdateProveedor", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_proveedor", cod_proveedor);
                cmd.Parameters.AddWithValue("@nombre", nombre);
                cmd.Parameters.AddWithValue("@telefono", telefono);
                cmd.Parameters.AddWithValue("@cod_dir", cod_dir);
                cmd.Parameters.AddWithValue("@cp", cp);
                cmd.Parameters.AddWithValue("@email", email);
                cmd.Parameters.AddWithValue("@razon_social", razon_social);

                respuesta = cmd.ExecuteNonQuery() == 1 ? "Se modificó el proveedor correctamente" : "Error al modificar el proveedor";

                cn.Close();
                return(respuesta);
            }
        }
Esempio n. 4
0
        public string InsertCBU(string CBU, int cod_proveedor)
        {
            string respuesta;


            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("InsertCBU", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };


                cmd.Parameters.AddWithValue("@cbu", CBU);
                cmd.Parameters.AddWithValue("@cod_proveedor", cod_proveedor);

                respuesta = cmd.ExecuteNonQuery() == 1 ? "Se agregó el CBU correctamente" : "Error al ingresar el CBU";

                cn.Close();
            }



            return(respuesta);
        }
Esempio n. 5
0
        public bool ValidarUsuario(string IDUsuario, string Clave)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("ValidarUsuario", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@nom_usu", IDUsuario);
                cmd.Parameters.AddWithValue("@psw_usud", Clave);

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    cn.Close();
                    return(true);
                }
                else
                {
                    cn.Close();
                    return(false);
                }
            }
        }
Esempio n. 6
0
        public string InsertFacturaProv(int cod_ord_cpr, int numero_factura, DateTime fecha_recepcion, decimal importe,
                                        string observaciones, bool sumada)
        {
            string respuesta;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("InsertFacturaProv", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_ord_cpr", cod_ord_cpr);
                cmd.Parameters.AddWithValue("@numero_factura", numero_factura);
                cmd.Parameters.AddWithValue("@fecha_recepcion", fecha_recepcion);
                cmd.Parameters.AddWithValue("@observaciones", observaciones);
                cmd.Parameters.AddWithValue("@importe", importe);
                cmd.Parameters.AddWithValue("@sumada", sumada);

                respuesta = cmd.ExecuteNonQuery() == 1 ? "Se ingresó la factura correctamente" : "Error al ingresarla factura";

                cn.Close();
                return(respuesta);
            }
        }
Esempio n. 7
0
        public string InsertStockMedida(int cod_med, int cod_pro_stock)
        {
            string respuesta;


            try
            {
                using (cn = Conexion.ConexionDB())
                {
                    SqlCommand cmd = new SqlCommand("InsertStockMedida", cn)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    cmd.Parameters.AddWithValue("@cod_med", cod_med);
                    cmd.Parameters.AddWithValue("@cod_pro_stock", cod_pro_stock);

                    cmd.ExecuteNonQuery();
                }
                respuesta = "Producto por medida agregado correctamente.";
            }
            catch (Exception)
            {
                respuesta = "No se pudo agregar el producto por medida." + Environment.NewLine +
                            "Ya existe el producto seleccionado con la medida seleccionada.";
            }

            cn.Close();
            return(respuesta);
        }
Esempio n. 8
0
        public string InsertInformeRecep(int cod_ord_cpr, int cod_factura, string resultado_calidad, string problemas,
                                         string estado_pd, DateTime fecha_creacion)
        {
            string respuesta;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("InsertInformeRecep", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_ord_cpr", cod_ord_cpr);
                cmd.Parameters.AddWithValue("@cod_factura", cod_factura);
                cmd.Parameters.AddWithValue("@problemas", problemas);
                cmd.Parameters.AddWithValue("@estado_pd", estado_pd);
                cmd.Parameters.AddWithValue("@fecha_creacion", fecha_creacion);
                cmd.Parameters.AddWithValue("@resultado_calidad", resultado_calidad);

                respuesta = cmd.ExecuteNonQuery() == 1 ? "Se ingresó el registro correctamente" : "Error al ingresar el registro";

                cn.Close();
                return(respuesta);
            }
        }
Esempio n. 9
0
        public string InsertBienUsoProveedor(int cod_proveedor, int cod_pro_buso)
        {
            string respuesta;

            try
            {
                using (cn = Conexion.ConexionDB())
                {
                    SqlCommand cmd = new SqlCommand("InsertBienUsoProveedor", cn)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    cmd.Parameters.AddWithValue("@cod_proveedor", cod_proveedor);
                    cmd.Parameters.AddWithValue("@cod_pro_buso", cod_pro_buso);
                    cmd.ExecuteNonQuery();

                    cn.Close();
                }
                respuesta = "Se agregó el bien de uso al proveedor correctamente.";
            }
            catch (Exception)
            {
                respuesta = "No se pudo agregar el bien de uso al proveedor. " + Environment.NewLine +
                            "Ya existe el bien de uso seleccionado con el proveedor seleccionado";
            }


            return(respuesta);
        }
Esempio n. 10
0
        public bool PedidoDevolucionTieneNotaCreditoAsociada(int cod_pd)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("PedidoDevolucionTieneNotaCreditoAsociada", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_pd", cod_pd);

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    cn.Close();
                    return(true);
                }
                else
                {
                    cn.Close();
                    return(false);
                }
            }
        }
Esempio n. 11
0
        public string DeleteMarcaBienUso(int cod_pro_buso)
        {
            string respuesta;

            try
            {
                using (cn = Conexion.ConexionDB())
                {
                    SqlCommand cmd = new SqlCommand("DeleteMarcaBienUso", cn)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    cmd.Parameters.AddWithValue("@cod_pro_buso", cod_pro_buso);

                    cmd.ExecuteNonQuery();

                    cn.Close();
                }
                respuesta = "Se borró la marca al bien de uso correctamente";
            }
            catch (Exception ex)
            {
                respuesta = "No se pudo borrar la marca al bien de uso. " + Environment.NewLine +
                            ex.Message;
            }

            return(respuesta);
        }
Esempio n. 12
0
        public bool BienUsoTieneMarcaAsociada(int cod_pro_buso)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("BienUsoTieneMarcaAsociada", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_pro_buso", cod_pro_buso);

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    cn.Close();
                    return(true);
                }
                else
                {
                    cn.Close();
                    return(false);
                }
            }
        }
Esempio n. 13
0
        public string DeleteBienesUsoProveedor(int cod_proveedor)
        {
            string respuesta;

            try
            {
                using (cn = Conexion.ConexionDB())
                {
                    SqlCommand cmd = new SqlCommand("DeleteBienesUsoProveedor", cn)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    cmd.Parameters.AddWithValue("@cod_proveedor", cod_proveedor);
                    cmd.ExecuteNonQuery();

                    cn.Close();
                }
                respuesta = "Se eliminó la asociación del proveedor con los bienes de uso que proveía";
            }
            catch (Exception ex)
            {
                respuesta = "No se pudo eliminar la asociación del proveedor con los bienes de uso que provee:" +
                            Environment.NewLine + ex.Message;
            }

            return(respuesta);
        }
Esempio n. 14
0
        public bool FacturaProvTieneInformeAsociado(int @cod_factura)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("FacturaProvTieneInformeAsociado", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_factura", @cod_factura);

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    cn.Close();
                    return(true);
                }
                else
                {
                    cn.Close();
                    return(false);
                }
            }
        }
Esempio n. 15
0
        public bool CotizacionSCTieneOrdenCompraAsociada(int cod_cotizacion)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("CotizacionSCTieneOrdenCompraAsociada", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_pro_stock", cod_cotizacion);

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    cn.Close();
                    return(true);
                }
                else
                {
                    cn.Close();
                    return(false);
                }
            }
        }
Esempio n. 16
0
        public bool ProveedorTieneCBU(int cod_proveedor)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("ProveedorTieneCBU", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_proveedor", cod_proveedor);

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    cn.Close();
                    return(true);
                }
                else
                {
                    cn.Close();
                    return(false);
                }
            }
        }
Esempio n. 17
0
        public string InsertMarcaBienUso(int cod_mar, int cod_pro_buso)
        {
            string respuesta;

            try
            {
                using (cn = Conexion.ConexionDB())
                {
                    SqlCommand cmd = new SqlCommand("InsertMarcaBienUso", cn)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    cmd.Parameters.AddWithValue("@cod_mar", cod_mar);
                    cmd.Parameters.AddWithValue("@cod_pro_buso", cod_pro_buso);

                    cmd.ExecuteNonQuery();

                    cn.Close();
                }

                respuesta = "Marca agregada al bien de uso correctamente";
            }
            catch (Exception)
            {
                respuesta = "No se pudo agregar la marca al bien de uso. " + Environment.NewLine +
                            "Ya existe la marca seleccionada con el bien de uso seleccionado";;
            }

            return(respuesta);
        }
Esempio n. 18
0
        public void DeleteBienesPorSolcitudCompra(int cod_sc)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("DeleteBienesPorSolcitudCompra", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_sc", cod_sc);

                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 19
0
        public void DeleteCotizacionSC(int cod_cotizacion)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("DeleteCotizacionSC", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_cotizacion", cod_cotizacion);

                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 20
0
        public void InsertRegistracionCompra(int cod_ir, DateTime fecha_reg)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("InsertRegistracionCompra", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_ir", cod_ir);
                cmd.Parameters.AddWithValue("@fecha_reg", fecha_reg);
                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 21
0
        public void DeleteProveedor(int cod_proveedor)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("DeleteProveedor", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_proveedor", cod_proveedor);

                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 22
0
        public void UpdateStockActualRegis(int cod_pro_stock, int cantidad)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("UpdateStockActualRegis", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_pro_stock", cod_pro_stock);
                cmd.Parameters.AddWithValue("@cantidad", cantidad);

                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 23
0
        public void UpdateCotizacionSC(int cod_sc, int codOrdenCompra)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("UpdateCotizacionSC", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_sc", cod_sc);
                cmd.Parameters.AddWithValue("@cod_ord_cpr", codOrdenCompra);

                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 24
0
        public void InsertPedidoDev(int cod_ir, DateTime fecha_creacion)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("InsertPedidoDev", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_ir", cod_ir);
                cmd.Parameters.AddWithValue("@fecha_creacion", fecha_creacion);

                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 25
0
        public void UpdateHaberCuenta(decimal haber, int cod_cuenta_corriente)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("UpdateHaberCuenta", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_cuenta_corriente", cod_cuenta_corriente);
                cmd.Parameters.AddWithValue("@haber", haber);


                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 26
0
        public void RegistrarNotaCredito(int cod_nc, int cod_cuenta_corriente)
        {
            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("RegistrarNotaCredito", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_nc", cod_nc);
                cmd.Parameters.AddWithValue("@cod_cuenta_corriente", cod_cuenta_corriente);


                cmd.ExecuteNonQuery();

                cn.Close();
            }
        }
Esempio n. 27
0
        ////public void UpdateListadoSolicitudesCompraOrdenesToNull()
        ////{
        ////    adapter.UpdateListadoSolicitudesCompraOrdenesToNull();
        ////}

        public string DeleteSolicitudCompra(int cod_sc)
        {
            string respuesta;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("DeleteSolicitudCompra", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_sc", cod_sc);
                respuesta = cmd.ExecuteNonQuery() == 1 ? "Se eliminó la solicitud correctamente": "Error al eliminar la solicitud";

                cn.Close();
                return(respuesta);
            }
        }
Esempio n. 28
0
        public string GetNombreStockByCodStock(int cod_pro_stock)
        {
            string resultado;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("GetNombreStockByCodStock", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_pro_stock", cod_pro_stock);

                resultado = cmd.ExecuteScalar().ToString();

                cn.Close();
            }
            return(resultado);
        }
Esempio n. 29
0
        public string GetMedidaByCodMedida(int cod_med)
        {
            string resultado;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("GetMedidaByCodMedida", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@cod_med", cod_med);

                resultado = cmd.ExecuteScalar().ToString();

                cn.Close();
            }
            return(resultado);
        }
Esempio n. 30
0
        public int GetCodMedidaByNombreMedida(string nombre)
        {
            int resultado;

            using (cn = Conexion.ConexionDB())
            {
                SqlCommand cmd = new SqlCommand("GetCodMedidaByNombreMedida", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@nombre", nombre);

                resultado = (int)cmd.ExecuteScalar();

                cn.Close();
            }
            return(resultado);
        }