private void Data_Tablafamiliadet() { try { if (Tablafamiliadet.Rows.Count > 0) { Tablafamiliadet.Rows.Clear(); } var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); if (cboModuloID.SelectedIndex != -1) { BE.moduloid = cboModuloID.SelectedValue.ToString(); BE.lineaid = tejidoid.SelectedValue.ToString(); BE.familiaid = familiaid.Text.ToString(); Tablafamiliadet = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablafamiliadet.Rows.Count > 0) { btn_imprimir.Enabled = true; mdi_dgb_familia.DataSource = Tablafamiliadet; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void form_cargar_datos(String posicion) { try { var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); var dt = new DataTable(); BE.moduloid = cboModuloID.SelectedValue.ToString(); if (familiaid.Text.Trim().Length > 0) { BE.familiaid = familiaid.Text.Trim().PadLeft(3, '0'); } BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { limpiar_documento(); ssModo = "EDIT"; familiaid.Text = dt.Rows[0]["familiatelaid"].ToString().Trim(); familianame.Text = dt.Rows[0]["familiatelaname"].ToString().Trim(); tejidoid.SelectedValue = dt.Rows[0]["lineaid"].ToString().Trim(); btn_editar.Enabled = false; 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); } }
private void btn_save_Click(object sender, EventArgs e) { try { var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); BE.lineaid = tejidoid.SelectedValue.ToString(); BE.moduloid = cboModuloID.SelectedValue.ToString(); BE.familiaid = familiaid.Text.Trim().PadLeft(3, '0'); var Detalle = new tb_pt_familiadet.Item(); var ListaItems = new List<tb_pt_familiadet.Item>(); var item = 0; foreach (DataRow fila in Tablafamiliadet.Rows) { Detalle = new tb_pt_familiadet.Item(); item++; Detalle.moduloid = cboModuloID.SelectedValue.ToString(); Detalle.lineaid = tejidoid.SelectedValue.ToString(); Detalle.familiaid = familiaid.Text.Trim().PadLeft(3, '0'); Detalle.productid = fila["productid"].ToString(); Detalle.unmed = fila["unmed"].ToString(); Detalle.status = "0"; Detalle.usuar = VariablesPublicas.Usuar.Trim(); ListaItems.Add(Detalle); } if (ListaItems.Count == 0) { MessageBox.Show("Documento SIN DETALLE Y/O DETALLE INCORRECTO !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BE.ListaItems = ListaItems; if (BL.Insert(EmpresaID, BE)) { MessageBox.Show("Datos Actualizados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; limpiar_documento(); Data_Tablafamiliadet(); btn_save.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void RecibeFamilia(String xlineaid, String xfamiliatelaid, String xfamiliatelaname, String xunmed, String resultado5) { try { if (xlineaid.Trim().Length == 3) { familiaid.Text = xfamiliatelaid; familianame.Text = xfamiliatelaname; tejidoid.SelectedValue = xlineaid; unmed.Text = xunmed; var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); var dt = new DataTable(); BE.moduloid = cboModuloID.SelectedValue.ToString(); BE.familiaid = xfamiliatelaid.ToString(); dt = BL.GetAll2(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { precunit.Text = dt.Rows[0]["precio"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Update() { try { if (familiatelaid.Text.Trim().Length != 3) { MessageBox.Show("Falta Codigo Familia !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (familiatelaname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese Nombre de Familia", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); BE.familiaid = familiatelaid.Text.Trim().PadLeft(3, '0'); if (tejidoid.SelectedValue != null && tejidoid.Text.Trim().Length > 0) { BE.lineaid = tejidoid.SelectedValue.ToString(); } BE.usuar = VariablesPublicas.Usuar.Trim(); if (BL.Update(EmpresaID, BE)) { SEGURIDAD_LOG("M"); MessageBox.Show("Datos Modificado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Delete() { try { if (familiatelaid.Text.Trim().Length != 3) { MessageBox.Show("Falta Codigo Familia !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); BE.familiaid = familiatelaid.Text.Trim().PadLeft(3, '0'); BE.lineaid = tejidoid.SelectedValue.ToString(); BE.productid = productid.Text; if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos eliminados correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); form_bloqueado(false); data_Tablafamiliateladet(); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_Tablafamiliateladet() { try { if (Tablafamiliateladet.Rows.Count > 0) { Tablafamiliateladet.Rows.Clear(); } var BL = new tb_pt_familiadetBL(); var BE = new tb_pt_familiadet(); BE.familianame = txt_criterio.Text.Trim().ToUpper(); Tablafamiliateladet = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablafamiliateladet.Rows.Count > 0) { btn_imprimir.Enabled = true; mdi_dgb_familia.DataSource = Tablafamiliateladet; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }