public bool Delete(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Productos_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GenCodigo(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60GenNewItem", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@cencosid", SqlDbType.Char, 8).Value = BE.cencosid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update_fichatecnica(string empresaid, tb_60productos BE) { return tablaDA.Update_fichatecnica(empresaid, BE); }
private void GenProductidOLD() { var BL = new tb_60productosBL(); var BE = new tb_60productos(); var dt = new DataTable(); BE.moduloid = modulo.ToString(); BE.cencosid = cencosid.Text.Trim() + estacion.Text.Trim(); dt = BL.GenCodigo(EmpresaID, BE).Tables[0]; dt.Rows[0]["item"].ToString().PadLeft(3, '0'); foreach (DataGridViewRow fila in griddetallemov.Rows) { griddetallemov.Rows[fila.Index].Cells["productid"].Value.ToString(); } }
private void Delete() { try { if (productid.Text.Trim().Length != 13) { MessageBox.Show("Código de producto invalido !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { tb_60productosBL BL = new tb_60productosBL(); tb_60productos BE = new tb_60productos(); BE.moduloid = modulo.Trim(); BE.productid = productid.Text.Trim(); BE.status = "9"; BE.usuar = VariablesPublicas.Usuar.Trim(); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos eliminados correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); limpiar_documento(); form_bloqueado(false); subgrupoid.Enabled = false; productid.Enabled = true; btn_nuevo.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_salir.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Update() { try { if (productid.Text.Trim().Length != 13) { MessageBox.Show("Código de producto invalido !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (productname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese nombre de producto !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (unmed.SelectedIndex == -1) { MessageBox.Show("Seleccione la unidad de medida !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (unmedenvase.SelectedIndex == -1) { MessageBox.Show("Seleccione la unidad de medida !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (unidenvase.Text == "") { MessageBox.Show("Ingrese Equivalente !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { tb_60productosBL BL = new tb_60productosBL(); tb_60productos BE = new tb_60productos(); BE.moduloid = modulo.Trim(); BE.lineaid = lineaid.Text.Trim(); BE.grupoid = grupoid.Text.Trim(); BE.subgrupoid = subgrupoid.Text.Trim(); BE.item = item.Text.Trim(); BE.productname = productname.Text.Trim().ToUpper(); BE.productidold = productidold.Text.Trim().ToUpper(); BE.titulo = titulo.Text.Trim().ToUpper(); BE.compo = compo.Text.Trim().ToUpper(); BE.colorid = colorid.Text.Trim(); BE.colorname = colorname.Text.Trim().ToUpper(); BE.marcaid = marcaid.Text.Trim(); if (coleccionid.SelectedValue != null) BE.coleccionid = coleccionid.SelectedValue.ToString(); if (generoid.SelectedValue != null) BE.generoid = generoid.SelectedValue.ToString(); if (temporadaid.SelectedValue != null) BE.temporadaid = temporadaid.SelectedValue.ToString(); if (unmed.SelectedValue != null) BE.unmed = unmed.SelectedValue.ToString(); if (unmedenvase.SelectedValue != null) BE.unmedenvase = unmedenvase.SelectedValue.ToString(); BE.procedenciaid = procedenciaid.SelectedIndex.ToString(); BE.unidenvase = Convert.ToDecimal(unidenvase.Text.Trim()); BE.unmedpeso = unmedpeso.Text.Trim().ToUpper(); BE.peso = Convert.ToDecimal(peso.Text.Trim().PadLeft(0, '0')); BE.status = estado.SelectedIndex.ToString(); BE.usuar = VariablesPublicas.Usuar.Trim(); BE.nserie = nserie.Text.ToString(); // Asignando el valor de la imagen // Stream usado como buffer System.IO.MemoryStream ms = new System.IO.MemoryStream(); // Se guarda la imagen en el buffer if (modulo == "0500") { if (go_foto.Image != null) { go_foto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); } } // Se extraen los bytes del buffer para asignarlos como valor para el // parámetro. BE.Foto = ms.GetBuffer(); if (BL.Update(EmpresaID, BE)) { SEGURIDAD_LOG("M"); MessageBox.Show("Datos Modificado Correctamente !!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void get_nuevo_producto() { tb_60productosBL BL = new tb_60productosBL(); tb_60productos BE = new tb_60productos(); DataTable DT = new DataTable(); BE.moduloid = moduloid.Text.Trim(); BE.lineaid = lineaid.Text.Trim(); BE.grupoid = grupoid.Text.Trim(); BE.subgrupoid = subgrupoid.Text.Trim(); DT = BL.GetAll_nuevocodprod(EmpresaID, BE).Tables[0]; try { //item.Text = Convert.ToString(Convert.ToInt16(DT.Rows[0]["item"].ToString().Substring(10, 3)) + 1).PadLeft(3, '0'); //productid.Text = lineaid.Text + grupoid.Text + subgrupoid.Text + item.Text; item.Text = DT.Rows[0]["productid"].ToString().Substring(10, 3); productid.Text = DT.Rows[0]["productid"].ToString(); } catch { item.Text = "000"; productid.Text = lineaid.Text + grupoid.Text + subgrupoid.Text + item.Text; } if (productid.Text.Trim().Length == 13) { generar_denominacion(); form_bloqueado(true); titulo.Focus(); btn_cancelar.Enabled = true; btn_grabar.Enabled = true; btn_log.Enabled = true; } }
public bool Update_CodigoOLD(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Productos_UPDATE_CodigoOLD", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; cmd.Parameters.Add("@productidold", SqlDbType.Char, 15).Value = BE.productidold; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; cmd.Parameters.Add("@fepialmac", SqlDbType.DateTime).Value = BE.fepialmac; cmd.Parameters.Add("@feuialmac", SqlDbType.DateTime).Value = BE.feuialmac; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void btn_busqueda_Click(object sender, EventArgs e) { var BL = new tb_60productosBL(); var BE = new tb_60productos(); BE.moduloid = modulo.ToString(); BE.codigo = cencosid.Text.Trim() + estacion.Text.Trim(); BE.filtro = "2"; BE.productname = txt_busqueda.Text.ToString(); Tablaproducto = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablaproducto.Rows.Count > 0) { dgbproductos.DataSource = Tablaproducto; btn_editar.Enabled = true; btn_eliminar.Enabled = true; btn_imprimir.Enabled = true; btn_salir.Enabled = true; } else { dgbproductos.DataSource = Tablaproducto; } }
private void btn_agregar_Click(object sender, EventArgs e) { productid.Text = string.Empty; productname.Text = string.Empty; var BL = new tb_60productosBL(); var BE = new tb_60productos(); var dt = new DataTable(); BE.moduloid = modulo.ToString(); BE.cencosid = cencosid.Text.Trim() + estacion.Text.Trim(); dt = BL.GenCodigo(EmpresaID, BE).Tables[0]; item.Text = dt.Rows[0]["item"].ToString().PadLeft(3, '0'); ssModo = "NEW"; btn_grabar.Enabled = true; productid.Focus(); }
private void Update() { try { if (productid.Text.Trim().Length != 13) { MessageBox.Show("Código de producto invalido !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (productname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese nombre de producto !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (unmed.SelectedIndex == -1) { MessageBox.Show("Seleccione la unidad de medida !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (unmedenvase.SelectedIndex == -1) { MessageBox.Show("Seleccione la unidad de medida !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (unidenvase.Text == string.Empty) { MessageBox.Show("Ingrese Equivalente !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_60productosBL(); var BE = new tb_60productos(); BE.moduloid = moduloiddes.SelectedValue.ToString(); if (moduloiddes.SelectedValue.ToString() == "0000") { MessageBox.Show("Seleccione Almacen", "Information"); return; } BE.lineaid = lineaid.Text.Trim(); BE.grupoid = grupoid.Text.Trim(); BE.subgrupoid = subgrupoid.Text.Trim(); BE.item = item.Text.Trim(); BE.productid = productid.Text.Trim(); BE.productname = productname.Text.Trim().ToUpper(); BE.productidold = productidold.Text.Trim().ToUpper(); BE.titulo = titulo.Text.Trim().ToUpper(); BE.compo = compo.Text.Trim().ToUpper(); BE.colorid = colorid.Text.Trim(); BE.colorname = colorname.Text.Trim().ToUpper(); BE.marcaid = marcaid.Text.Trim(); if (coleccionid.SelectedValue != null) { BE.coleccionid = coleccionid.SelectedValue.ToString(); } if (generoid.SelectedValue != null) { BE.generoid = generoid.SelectedValue.ToString(); } if (temporadaid.SelectedValue != null) { BE.temporadaid = temporadaid.SelectedValue.ToString(); } if (unmed.SelectedValue != null) { BE.unmed = unmed.SelectedValue.ToString(); } if (unmedenvase.SelectedValue != null) { BE.unmedenvase = unmedenvase.SelectedValue.ToString(); } BE.procedenciaid = procedenciaid.SelectedIndex.ToString(); BE.unidenvase = Convert.ToDecimal(unidenvase.Text.Trim()); BE.unmedpeso = unmedpeso.Text.Trim().ToUpper(); BE.peso = Convert.ToDecimal(peso.Text.Trim().PadLeft(0, '0')); BE.status = estado.SelectedIndex.ToString(); BE.usuar = VariablesPublicas.Usuar.Trim(); BE.nserie = nserie.Text.ToString(); var ms = new System.IO.MemoryStream(); BE.Foto = ms.GetBuffer(); if (BL.Update(EmpresaID, BE)) { SEGURIDAD_LOG("M"); MessageBox.Show("Datos Modificados Correctamente !!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; pnl_busqueda.Enabled = true; } } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Llenar_Datos() { if (cbo_moduloides.SelectedIndex != -1 && cbo_moduloides.SelectedValue.ToString() != "0000" && cbo_moduloides.SelectedValue.ToString() != "0200") { var BE = new tb_60productos(); var BL = new tb_60productosBL(); BE.moduloid = cbo_moduloides.SelectedValue.ToString(); BE.productname = txtbusqueda.Text.Trim(); Tablaproducto = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablaproducto.Rows.Count > 0) { MDI_dgb_productos.DataSource = Tablaproducto; } else { MDI_dgb_productos.DataSource = Tablaproducto; } } else { } }
private void get_nuevo_producto() { var BL = new tb_60productosBL(); var BE = new tb_60productos(); var DT = new DataTable(); BE.moduloid = moduloiddes.SelectedValue.ToString(); if (moduloiddes.SelectedValue.ToString() == "0000") { MessageBox.Show("Seleccione Almacen", "Information"); return; } BE.lineaid = lineaid.Text.Trim(); BE.grupoid = grupoid.Text.Trim(); BE.subgrupoid = subgrupoid.Text.Trim(); DT = BL.GetAll_nuevocodprod(EmpresaID, BE).Tables[0]; try { item.Text = DT.Rows[0]["productid"].ToString().Substring(10, 3); productid.Text = DT.Rows[0]["productid"].ToString(); } catch { item.Text = "000"; productid.Text = lineaid.Text + grupoid.Text + subgrupoid.Text + item.Text; } if (productid.Text.Trim().Length == 13) { generar_denominacion(); form_bloqueado(true); titulo.Focus(); btn_cancelar.Enabled = true; btn_grabar.Enabled = true; btn_log.Enabled = true; } }
private void form_cargar_datos(String posicion) { try { var BL = new tb_60productosBL(); var BE = new tb_60productos(); var dt = new DataTable(); BE.moduloid = moduloiddes.SelectedValue.ToString(); if (moduloiddes.SelectedValue.ToString() == "0000") { MessageBox.Show("Seleccione Almacen", "Information"); return; } if (productid.Text.Trim().Length > 0) { BE.productid = productid.Text.Trim(); } BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { limpiar_documento(); ssModo = "EDIT"; lineaid.Text = dt.Rows[0]["lineaid"].ToString().Trim(); lineaname.Text = dt.Rows[0]["lineaname"].ToString().Trim(); grupoid.Text = dt.Rows[0]["grupoid"].ToString().Trim(); gruponame.Text = dt.Rows[0]["gruponame"].ToString().Trim(); subgrupoid.Text = dt.Rows[0]["subgrupoid"].ToString().Trim(); subgruponame.Text = dt.Rows[0]["subgruponame"].ToString().Trim(); item.Text = dt.Rows[0]["item"].ToString().Trim(); productid.Text = dt.Rows[0]["productid"].ToString().Trim(); productname.Text = dt.Rows[0]["productname"].ToString().Trim(); nom_producto = dt.Rows[0]["productname"].ToString().Trim(); productidold.Text = dt.Rows[0]["productidold"].ToString().Trim(); titulo.Text = dt.Rows[0]["titulo"].ToString().Trim(); compo.Text = dt.Rows[0]["compo"].ToString().Trim(); colorid.Text = dt.Rows[0]["colorid"].ToString().Trim(); colorname.Text = dt.Rows[0]["colorname"].ToString().Trim(); marcaid.Text = dt.Rows[0]["marcaid"].ToString().Trim(); marcaname.Text = dt.Rows[0]["marcaname"].ToString().Trim(); if (dt.Rows[0]["coleccionid"].ToString().Trim().Length > 0) { coleccionid.SelectedValue = dt.Rows[0]["coleccionid"].ToString().Trim(); } if (dt.Rows[0]["generoid"].ToString().Trim().Length > 0) { generoid.SelectedValue = dt.Rows[0]["generoid"].ToString().Trim(); } if (dt.Rows[0]["temporadaid"].ToString().Trim().Length > 0) { temporadaid.SelectedValue = dt.Rows[0]["temporadaid"].ToString().Trim(); } procedenciaid.SelectedIndex = Convert.ToInt32(dt.Rows[0]["paisid"]); txt_paisname.Text = dt.Rows[0]["paisname"].ToString().Trim(); nserie.Text = dt.Rows[0]["nserie"].ToString().Trim(); estado.SelectedIndex = Convert.ToInt32(dt.Rows[0]["status"]); if (dt.Rows[0]["unmed"].ToString().Trim().Length > 0) { unmed.SelectedValue = dt.Rows[0]["unmed"].ToString().Trim(); } if (dt.Rows[0]["unmedenvase"].ToString().Trim().Length > 0) { unmedenvase.SelectedValue = dt.Rows[0]["unmedenvase"].ToString().Trim(); } else { unmedenvase.SelectedIndex = -1; } unidenvase.Text = dt.Rows[0]["unidenvase"].ToString().Trim(); unmedpeso.Text = dt.Rows[0]["unmedpeso"].ToString().Trim(); peso.Text = dt.Rows[0]["peso"].ToString().Trim().PadLeft(1, '0'); subgrupoid.Enabled = false; productid.Enabled = true; btn_editar.Enabled = true; btn_eliminar.Enabled = true; btn_imprimir.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_log.Enabled = true; btn_salir.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool Update_Foto(string empresaid, tb_60productos BE) { return tablaDA.Update_Foto(empresaid, BE); }
public DataSet GetReport(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Productos_REPORT", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@productname", SqlDbType.VarChar, 500).Value = BE.productname; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid; cmd.Parameters.Add("@grupoid", SqlDbType.Char, 4).Value = BE.grupoid; cmd.Parameters.Add("@subgrupoid", SqlDbType.Char, 3).Value = BE.subgrupoid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Productos_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@productname", SqlDbType.VarChar, 500).Value = BE.productname; cmd.Parameters.Add("@unmed", SqlDbType.Char, 3).Value = BE.unmed; cmd.Parameters.Add("@peso", SqlDbType.Decimal).Value = BE.peso; cmd.Parameters.Add("@unmedpeso", SqlDbType.Char, 3).Value = BE.unmedpeso; cmd.Parameters.Add("@unmedenvase", SqlDbType.Char, 3).Value = BE.unmedenvase; cmd.Parameters.Add("@unidenvase", SqlDbType.Decimal).Value = BE.unidenvase; cmd.Parameters.Add("@precioenvase", SqlDbType.Decimal).Value = BE.precioenvase; cmd.Parameters.Add("@etiquetaname", SqlDbType.VarChar, 40).Value = BE.etiquetaname; cmd.Parameters.Add("@colorid", SqlDbType.Char, 3).Value = BE.colorid; cmd.Parameters.Add("@colorname", SqlDbType.VarChar, 30).Value = BE.colorname; cmd.Parameters.Add("@marcaid", SqlDbType.Char, 2).Value = BE.marcaid; cmd.Parameters.Add("@coleccionid", SqlDbType.Char, 3).Value = BE.coleccionid; cmd.Parameters.Add("@temporadaid", SqlDbType.Char, 1).Value = BE.temporadaid; cmd.Parameters.Add("@categoriaid", SqlDbType.Char, 2).Value = BE.categoriaid; cmd.Parameters.Add("@generoid", SqlDbType.Char, 1).Value = BE.generoid; cmd.Parameters.Add("@tejidoid", SqlDbType.Char, 2).Value = BE.tejidoid; cmd.Parameters.Add("@telaid", SqlDbType.Char, 2).Value = BE.telaid; cmd.Parameters.Add("@tallaid", SqlDbType.Char, 2).Value = BE.tallaid; cmd.Parameters.Add("@coltalla", SqlDbType.Char, 2).Value = BE.coltalla; cmd.Parameters.Add("@coltallaname", SqlDbType.Char, 4).Value = BE.coltallaname; cmd.Parameters.Add("@moneda", SqlDbType.Char, 1).Value = BE.moneda; cmd.Parameters.Add("@precventa", SqlDbType.Decimal).Value = BE.precventa; cmd.Parameters.Add("@precvent2", SqlDbType.Decimal).Value = BE.precvent2; cmd.Parameters.Add("@precvent3", SqlDbType.Decimal).Value = BE.precvent3; cmd.Parameters.Add("@precvent4", SqlDbType.Decimal).Value = BE.precvent4; cmd.Parameters.Add("@precvent5", SqlDbType.Decimal).Value = BE.precvent5; cmd.Parameters.Add("@precventant", SqlDbType.Decimal).Value = BE.precventant; cmd.Parameters.Add("@conce", SqlDbType.VarChar, 30).Value = BE.conce; cmd.Parameters.Add("@diluc", SqlDbType.VarChar, 30).Value = BE.diluc; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@compo", SqlDbType.VarChar, 50).Value = BE.compo; cmd.Parameters.Add("@titulo", SqlDbType.VarChar, 80).Value = BE.titulo; cmd.Parameters.Add("@productidold", SqlDbType.Char, 15).Value = BE.productidold; cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid; cmd.Parameters.Add("@grupoid", SqlDbType.Char, 4).Value = BE.grupoid; cmd.Parameters.Add("@subgrupoid", SqlDbType.Char, 3).Value = BE.subgrupoid; cmd.Parameters.Add("@item", SqlDbType.Char, 3).Value = BE.item; cmd.Parameters.Add("@codctadebe", SqlDbType.Char, 10).Value = BE.codctadebe; cmd.Parameters.Add("@codctahaber", SqlDbType.Char, 10).Value = BE.codctahaber; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; cmd.Parameters.Add("@fepialmac", SqlDbType.DateTime).Value = BE.fepialmac; cmd.Parameters.Add("@feuialmac", SqlDbType.DateTime).Value = BE.feuialmac; cmd.Parameters.Add("@procedenciaid", SqlDbType.Char, 1).Value = BE.procedenciaid; cmd.Parameters.Add("@nserie", SqlDbType.VarChar, 20).Value = BE.nserie; cmd.Parameters.Add("@foto", SqlDbType.Image).Value = BE.Foto; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void Delete() { try { if (productid.Text.Trim().Length != 13) { MessageBox.Show("Código de producto invalido !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_60productosBL(); var BE = new tb_60productos(); BE.moduloid = modulo.Trim(); BE.productid = productid.Text.Trim(); BE.productidold = "0"; BE.usuar = VariablesPublicas.Usuar.Trim(); BE.fepialmac = DateTime.Now.Date; BE.feuialmac = DateTime.Now.Date; if (BL.Update_CodigoOLD(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos eliminados correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); limpiar_documento(); form_bloqueado(false); productid.Enabled = true; btn_nuevo.Enabled = true; btn_salir.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool Update_Foto(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Productos_UPDATE_FOTOS", cnx)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; cmd.Parameters.Add("@docname", SqlDbType.VarChar, 100).Value = BE.docname; cmd.Parameters.Add("@foto", SqlDbType.Image).Value = BE.Foto; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void estacion_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { var numdo = string.Empty; if (estacion.Text.Trim().Length > 0) { numdo = estacion.Text.Trim().PadLeft(3, '0'); } estacion.Text = numdo; var BL = new tb_60productosBL(); var BE = new tb_60productos(); var dt = new DataTable(); BE.moduloid = modulo.ToString(); BE.cencosid = cencosid.Text.Trim() + estacion.Text.Trim(); dt = BL.GenCodigo(EmpresaID, BE).Tables[0]; item.Text = dt.Rows[0]["item"].ToString().PadLeft(3, '0'); var BL2 = new tb_co_persona_cencosBL(); var BE2 = new tb_co_persona_cencosBE(); BE2.cencosid = cencosid.Text.ToString(); BE2.cencosestacion = estacion.Text.ToString(); var dt2 = new DataTable(); dt2 = BL2.GetAll(EmpresaID, BE2).Tables[0]; if (dt2.Rows.Count > 0) { lblnombre.Text = dt2.Rows[0]["nombrelargo"].ToString(); } else { lblnombre.Text = string.Empty; } productid.Focus(); } }
private void ValidaProducto() { if (productid.Text.Trim().Length == 13) { var BL = new tb_60productosBL(); var BE = new tb_60productos(); var dt = new DataTable(); BE.moduloid = modulo; BE.productid = productid.Text.Trim(); BE.status = "0"; dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { lineaid.Text = dt.Rows[0]["lineaid"].ToString().Trim(); lineaname.Text = dt.Rows[0]["lineaname"].ToString().Trim(); grupoid.Text = dt.Rows[0]["grupoid"].ToString().Trim(); gruponame.Text = dt.Rows[0]["gruponame"].ToString().Trim(); subgrupoid.Text = dt.Rows[0]["subgrupoid"].ToString().Trim(); subgruponame.Text = dt.Rows[0]["subgruponame"].ToString().Trim(); productid.Text = dt.Rows[0]["productid"].ToString().Trim(); productname.Text = dt.Rows[0]["productname"].ToString().Trim(); } else { productid.Text = string.Empty; productname.Text = string.Empty; } } else { productid.Text = string.Empty; productname.Text = string.Empty; } }
private void form_cargar_datos() { try { var BL = new tb_60productosBL(); var BE = new tb_60productos(); BE.moduloid = modulo.ToString(); BE.filtro = "1"; Tablaproducto = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablaproducto.Rows.Count > 0) { dgbproductos.DataSource = Tablaproducto; btn_editar.Enabled = true; btn_eliminar.Enabled = true; btn_imprimir.Enabled = true; btn_salir.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Llenar_Datos() { tb_60productos BE = new tb_60productos(); tb_60productosBL BL = new tb_60productosBL(); BE.moduloid = modulo.ToString(); Tablaproducto = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablaproducto.Rows.Count > 0) { MDI_dgb_productos.DataSource = Tablaproducto; } else { MDI_dgb_productos.DataSource = Tablaproducto; } }
private void Update() { try { if (productid.Text.Trim().Length != 13) { MessageBox.Show("Código de producto invalido !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_60productosBL(); var BE = new tb_60productos(); BE.moduloid = modulo.ToString(); BE.productidold = cencosid.Text.Trim() + estacion.Text.Trim() + item.Text.Trim(); BE.productid = productid.Text.ToString(); BE.status = cbo_estado.SelectedValue.ToString(); BE.usuar = VariablesPublicas.Usuar.Trim(); BE.fepialmac = DateTime.Now.Date; BE.feuialmac = DateTime.Now.Date; if (BL.Update_CodigoOLD(EmpresaID, BE)) { SEGURIDAD_LOG("M"); MessageBox.Show("Datos modificado correctamente !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Update_Foto() { try { tb_60productosBL BL = new tb_60productosBL(); tb_60productos BE = new tb_60productos(); BE.moduloid = modulo.Trim(); BE.local = local.Trim(); BE.productid = productid.Text.Trim(); BE.docname = _nombreFoto.ToString(); System.IO.MemoryStream ms = new System.IO.MemoryStream(); // Se guarda la imagen en el buffer if (modulo == "0500") { if (go_foto.Image != null) { go_foto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); } } // Se extraen los bytes del buffer para asignarlos como valor para el // parámetro. BE.Foto = ms.GetBuffer(); BL.Update_Foto(EmpresaID, BE); } catch (Exception) { throw; } }
public DataSet GetAll_paginacion(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTb60Productos_SEARCH_paginacion", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; cmd.Parameters.Add("@posicion", SqlDbType.VarChar, 10).Value = BE.posicion; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void form_cargar_datos(String posicion) { try { tb_60productosBL BL = new tb_60productosBL(); tb_60productos BE = new tb_60productos(); DataTable dt = new DataTable(); BE.moduloid = modulo; if (productid.Text.Trim().Length > 0) { BE.productid = productid.Text.Trim(); } BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { limpiar_documento(); ssModo = "EDIT"; lineaid.Text = dt.Rows[0]["lineaid"].ToString().Trim(); lineaname.Text = dt.Rows[0]["lineaname"].ToString().Trim(); grupoid.Text = dt.Rows[0]["grupoid"].ToString().Trim(); gruponame.Text = dt.Rows[0]["gruponame"].ToString().Trim(); subgrupoid.Text = dt.Rows[0]["subgrupoid"].ToString().Trim(); subgruponame.Text = dt.Rows[0]["subgruponame"].ToString().Trim(); item.Text = dt.Rows[0]["item"].ToString().Trim(); productid.Text = dt.Rows[0]["productid"].ToString().Trim(); productname.Text = dt.Rows[0]["productname"].ToString().Trim(); nom_producto = dt.Rows[0]["productname"].ToString().Trim(); productidold.Text = dt.Rows[0]["productidold"].ToString().Trim(); titulo.Text = dt.Rows[0]["titulo"].ToString().Trim(); compo.Text = dt.Rows[0]["compo"].ToString().Trim(); colorid.Text = dt.Rows[0]["colorid"].ToString().Trim(); colorname.Text = dt.Rows[0]["colorname"].ToString().Trim(); marcaid.Text = dt.Rows[0]["marcaid"].ToString().Trim(); marcaname.Text = dt.Rows[0]["marcaname"].ToString().Trim(); if (dt.Rows[0]["coleccionid"].ToString().Trim().Length > 0) coleccionid.SelectedValue = dt.Rows[0]["coleccionid"].ToString().Trim(); if (dt.Rows[0]["generoid"].ToString().Trim().Length > 0) generoid.SelectedValue = dt.Rows[0]["generoid"].ToString().Trim(); if (dt.Rows[0]["temporadaid"].ToString().Trim().Length > 0) temporadaid.SelectedValue = dt.Rows[0]["temporadaid"].ToString().Trim(); // Agregado procedenciaid.SelectedIndex = Convert.ToInt32(dt.Rows[0]["paisid"]); txt_paisname.Text = dt.Rows[0]["paisname"].ToString().Trim(); nserie.Text = dt.Rows[0]["nserie"].ToString().Trim(); estado.SelectedIndex = Convert.ToInt32(dt.Rows[0]["status"]); if (dt.Rows[0]["unmed"].ToString().Trim().Length > 0) unmed.SelectedValue = dt.Rows[0]["unmed"].ToString().Trim(); if (dt.Rows[0]["unmedenvase"].ToString().Trim().Length > 0) unmedenvase.SelectedValue = dt.Rows[0]["unmedenvase"].ToString().Trim(); else unmedenvase.SelectedIndex = -1; unidenvase.Text = dt.Rows[0]["unidenvase"].ToString().Trim(); unmedpeso.Text = dt.Rows[0]["unmedpeso"].ToString().Trim(); peso.Text = dt.Rows[0]["peso"].ToString().Trim().PadLeft(1, '0'); _nombreFoto = dt.Rows[0]["docname"].ToString().ToString(); String foto = dt.Rows[0]["foto"].ToString(); if (dt.Rows[0]["foto"].ToString() != "") { byte[] MyData1 = null; MyData1 = (byte[])(dt.Rows[0]["foto"]); if (MyData1 != null && MyData1.Length != 0) { vmContenidoFile = MyData1; go_foto.Visible = true; go_foto.Image = null; System.IO.MemoryStream ms = new System.IO.MemoryStream(); // Se utiliza el MemoryStream para extraer la imagen ms.Write(MyData1, 0, MyData1.Length); go_foto.Image = Image.FromStream(ms); } else { go_foto.Visible = false; go_foto.ImageLocation = ""; } } else { go_foto.Visible = false; go_foto.ImageLocation = ""; } subgrupoid.Enabled = false; productid.Enabled = true; btn_editar.Enabled = true; btn_eliminar.Enabled = true; btn_imprimir.Enabled = true; btn_primero.Enabled = true; btn_anterior.Enabled = true; btn_siguiente.Enabled = true; btn_ultimo.Enabled = true; btn_log.Enabled = true; btn_salir.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataSet GetAll_stockrollo(string empresaid, tb_60productos BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaProdrollo_SEARCH_stockrollo", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid; cmd.Parameters.Add("@grupoid", SqlDbType.Char, 4).Value = BE.grupoid; cmd.Parameters.Add("@subgrupoid", SqlDbType.Char, 10).Value = BE.subgrupoid; cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid; cmd.Parameters.Add("@productidold", SqlDbType.Char, 13).Value = BE.productidold; cmd.Parameters.Add("@productname", SqlDbType.Char, 13).Value = BE.productname; cmd.Parameters.Add("@colorid", SqlDbType.Char, 3).Value = BE.colorid; cmd.Parameters.Add("@rollo", SqlDbType.Char, 10).Value = BE.rollo; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void _ActualizarEstadoProducto() { if (tipoperacionid.SelectedValue.ToString() == "un parametro") { foreach (DataGridViewRow fila in griddetallemov.Rows) { var BL = new tb_60productosBL(); var BE = new tb_60productos(); BE.moduloid = modulo.Trim(); BE.productid = Convert.ToString(griddetallemov.Rows[fila.Index].Cells["productid"].Value); BE.status = string.Empty; BL.Update(EmpresaID, BE); } } }
public bool Update_CodigoOLD(string empresaid, tb_60productos BE) { return tablaDA.Update_CodigoOLD(empresaid, BE); }