Пример #1
0
        public static bool Add(string producto, string cantidad, string precio, string metros)
        {
            Conexion conn = new Conexion();

            int ds = conn.Count("Select count(producto) from [Inventario] where producto=\'" + producto + "\';");

            if (ds == 0)
            {
                Inv_Bodega(producto, cantidad);

                return(conn.Crear("Inventario", "Sucursal, Producto, Cantidad, Precio, Metros_Cuadrados ", "1 ," + producto + "," + cantidad + "," + precio + "," + metros));
            }
            else
            {
                Inv_Bodega(producto, cantidad);
                DataSet Producto_ = conn.Buscar_Mostrar("Inventario", "Producto" + "= " + producto);

                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(Producto_.GetXml());

                XmlNodeList _Producto   = xDoc.GetElementsByTagName("NewDataSet");
                XmlNodeList cant        = ((XmlElement)_Producto[0]).GetElementsByTagName("Cantidad");
                XmlNodeList metros_cuad = ((XmlElement)_Producto[0]).GetElementsByTagName("Metros_Cuadrados");

                string  metros_cuadrados = metros_cuad[0].InnerText;
                string  cantid           = cant[0].InnerText;
                decimal metros1          = Convert.ToDecimal(metros_cuadrados, CultureInfo.CreateSpecificCulture("en-US"));
                decimal metros2          = Convert.ToDecimal(metros, CultureInfo.CreateSpecificCulture("en-US"));

                decimal metrostotales = metros1 + metros2;
                return(conn.Modificar("Inventario", "Cantidad =" + (Convert.ToInt64(cantid) + Convert.ToInt64(cantidad)) + ", Metros_Cuadrados=" + Convert.ToString(metrostotales).Replace(",", "."), "Producto=" + producto));
            }
        }
Пример #2
0
        public static bool Rest(string producto, string cantidad)
        {
            Conexion conn = new Conexion();

            int ds = conn.Count("Select count(producto) from [Bodega] where producto=\'" + producto + "\';");

            if (ds == 0)
            {
                return(conn.Crear("Bodega", "Producto, Cantidad ", "\'" + producto + "\'," + cantidad));
            }
            else
            {
                DataSet Producto_ = conn.Buscar_Mostrar("Bodega", "Producto" + "= " + producto);

                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(Producto_.GetXml());

                XmlNodeList _Producto = xDoc.GetElementsByTagName("NewDataSet");
                XmlNodeList cant      = ((XmlElement)_Producto[0]).GetElementsByTagName("Cantidad");
                string      cantid    = cant[0].InnerText;

                if (Convert.ToInt64(cantidad) > Convert.ToInt64(cantid))
                {
                    return(false);
                }
                else
                {
                    return(conn.Modificar("Bodega", "Cantidad =" + (Convert.ToInt64(cantid) - Convert.ToInt64(cantidad)), "Producto=" + producto));
                }
            }
        }
Пример #3
0
        public static bool EditPro(string id, string abrevia, string descripcion, string tipo, string marca, string largo, string ancho, string porc)
        {
            Conexion conn = new Conexion();

            int ds = conn.Count("Select count(Producto) from [Producto] where usuario=\'" + id + "\';");

            if (largo == "")
            {
                largo = "null";
            }
            if (ancho == "")
            {
                ancho = "null";
            }

            if (porc == "")
            {
                porc = "null";
            }


            if (ds != 0)
            {
                int cantnick = conn.Count("Select count(Abreviatura) from [Producto] where Abreviatura=\'" + abrevia + "\'  And Producto!= " + id + ";");
                if (cantnick == 0)
                {
                    return(conn.Modificar("Producto", "Abreviatura" + "=" + "\'" + abrevia + "\' " + "," + "Descripcion " + " = " + "\'" + descripcion + "\' , Tipo = " + tipo + "," + " Marca " + " = " + "\'" + marca + "\' " + "," + " Largo " + " = " + largo + ", " + " Ancho " + " = " + "" + ancho + ", " + " Porcentaje " + " = " + "" + porc, "Producto" + "= " + id));
                }
            }
            return(false);
        }
Пример #4
0
        public static bool EditRol(string name, string id)
        {
            Conexion conn = new Conexion();

            int ds = conn.Count("Select count(nombre) from [Rol] where nombre=\'" + name + "\';");

            if (ds == 0)
            {
                conn.Modificar("Rol", "Nombre" + "=" + "\'" + name + "\' ", "Rol" + "= " + id);
                return(true);
            }

            return(false);
        }
Пример #5
0
        public static void Inv_Bodega(string producto, string cantidad)
        {
            Conexion conn      = new Conexion();
            DataSet  Producto_ = conn.Buscar_Mostrar("Bodega", "Producto" + "= " + producto);

            XmlDocument xDoc = new XmlDocument();

            xDoc.LoadXml(Producto_.GetXml());

            XmlNodeList _Producto = xDoc.GetElementsByTagName("NewDataSet");
            XmlNodeList cant      = ((XmlElement)_Producto[0]).GetElementsByTagName("Cantidad");
            string      cantid    = cant[0].InnerText;

            conn.Modificar("Bodega", "Cantidad =" + (Convert.ToInt64(cantid) - Convert.ToInt64(cantidad)), "Producto=" + producto);
        }
Пример #6
0
        public static bool EditUser(string id, string nickname, string nombre, string apellido, string rol, string pass, string dpi)
        {
            Conexion conn = new Conexion();

            int ds = conn.Count("Select count(usuario) from [Usuario] where usuario=\'" + id + "\';");

            if (ds != 0)
            {
                int cantnick = conn.Count("Select count(nickname) from [Usuario] where NickName=\'" + nickname + "\'  And Usuario!= " + id + ";");
                if (cantnick == 0)
                {
                    return(conn.Modificar("Usuario", "Nombre" + "=" + "\'" + nombre + "\' " + "," + " Contrasenia " + " = " + "\'" + pass + "\' , Rol = " + rol + "," + " NickName " + " = " + "\'" + nickname + "\' " + "," + " Apellido " + " = " + "\'" + apellido + "\', " + " Dpi " + " = " + "\'" + dpi + "\' ", "Usuario" + "= " + id));
                }
            }
            return(false);
        }
Пример #7
0
        public static bool EditCliente(string id, string nombre, string nit, string apellido, string direccion, string telefono)
        {
            Conexion conn = new Conexion();



            int ds = conn.Count("Select count(id) from [Cliente] where id=\'" + id + "\';");



            if (ds != 0)
            {
                int cantnit = conn.Count("Select count(nit) from [Cliente] where nit=\'" + nit + "\'  And Cliente!= " + id + ";");

                if (cantnit == 0)
                {
                    conn.Modificar("Cliente", "Nombre" + "=" + "\'" + nombre + "\' " + "," + " Nit " + " = " + "\'" + nit + "\' " + "," + " Apellido " + " = " + "\'" + apellido + "\' " + "," + " Direccion " + " = " + "\'" + direccion + "\' " + "," + " Telefono " + " = " + "\'" + telefono + "\' ", "Cliente" + "= " + id);
                    return(true);
                }
            }

            return(false);
        }