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); }
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)); } }
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)); } } }
public static bool Add(string abrevia, string descripcion, string tipo, string marca, string largo, string ancho, string porc) { Boolean respuesta; Conexion conn = new Conexion(); if (largo == "") { largo = "null"; } if (ancho == "") { ancho = "null"; } if (porc == "") { porc = "null"; } int ds = conn.Count("Select count(Abreviatura) from [Producto] where Abreviatura=\'" + abrevia + "\';"); if (ds == 0) { respuesta = conn.Crear("Producto", "Abreviatura,Descripcion, Porcentaje,Largo,Tipo,Ancho, Marca", "\'" + abrevia + "',\'" + descripcion + "\'," + porc + "," + largo + "," + tipo + "," + ancho + "," + "\'" + marca + "\'"); return(respuesta); } return(false); }
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); }
public static bool DeleteProd(string id) { Conexion conn = new Conexion(); int ds = conn.Count("Select count(Producto) from [Producto] where Producto=\'" + id + "\';"); if (ds != 0) { return(conn.Eliminar("Producto", "Producto = " + id)); } return(false); }
public static bool DeleteUser(string id) { Conexion conn = new Conexion(); int ds = conn.Count("Select count(usuario) from [Usuario] where usuario=\'" + id + "\';"); if (ds != 0) { return(conn.Eliminar("Usuario", "usuario = " + id)); } return(false); }
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); }
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); }
public static bool InsertRol(string name) { Conexion conn = new Conexion(); int ds = conn.Count("Select count(nombre) from [Rol] where nombre=\'" + name + "\';"); if (ds == 0) { conn.Crear("Rol", "Nombre", "\'" + name + "\'"); return(true); } return(false); }
public static bool Add(string nickname, string nombre, string apellido, string dpi, string password, string rol) { Conexion conn = new Conexion(); int ds = conn.Count("Select count(NickName) from [usuario] where NickName=\'" + nickname + "\';"); if (ds == 0) { conn.Crear("Usuario", "NickName,Nombre, Apellido,Dpi,Rol,Contrasenia", "\'" + nickname + "',\'" + nombre + "',\'" + apellido + "',\'" + dpi + "\'," + rol + ",\'" + password + "\'"); return(true); } return(false); }
public static bool Add(string nombre, string nit, string apellido, string direccion, string telefono) { Conexion conn = new Conexion(); if (nit != "") { int ds = conn.Count("Select count(nit) from [cliente] where nit=\'" + nit + "\';"); if (ds == 0) { return(conn.Crear("Cliente", "Nombre , Nit, Apellido, Direccion, Telefono ", "\'" + nombre + "\','" + nit + "\','" + apellido + "\','" + direccion + "\','" + telefono + "\'")); } } else { return(conn.Crear("Cliente", "Nombre , Nit, Apellido, Direccion, Telefono ", "\'" + nombre + "\','" + nit + "\','" + apellido + "\','" + direccion + "\','" + telefono + "\'")); } return(false); }