public bool Delete(string empresaid, tb_pt_familia BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaFamilia_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@familiaid", SqlDbType.Char, 3).Value = BE.familiaid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GetAll_paginacion(string empresaid, tb_pt_familia BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaFamilia_SEARCH_paginacion", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@familiaid", SqlDbType.Char, 2).Value = BE.familiaid; cmd.Parameters.Add("@posicion", SqlDbType.Char, 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 Valida_Familia(String xcod) { var BE = new tb_pt_familia(); var BL = new tb_pt_familiaBL(); var dt = new DataTable(); BE.moduloid = "0320".ToString(); BE.familiaid = xcod.Trim(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { familiatelaid.Text = dt.Rows[0]["familiaid"].ToString(); familiatelaname.Text = dt.Rows[0]["familianame"].ToString(); _estructuraid = dt.Rows[0]["estructuraid"].ToString(); _tejidoid = dt.Rows[0]["lineaid"].ToString(); } else { familiatelaid.Text = string.Empty; familiatelaname.Text = string.Empty; _estructuraid = string.Empty; _tejidoid = string.Empty; } }
private void Insert() { try { if (cboModuloID.SelectedIndex == -1) { MessageBox.Show("Falta Escoger el Modulo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (familianame.Text.Trim().Length == 0) { MessageBox.Show("Ingrese Nombre de Familia", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (unmed.Text.Trim().Length == 0) { MessageBox.Show("Ingrese Unidad de Medida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pt_familiaBL(); var BE = new tb_pt_familia(); BE.moduloid = cboModuloID.SelectedValue.ToString(); BE.familiaid = familiaid.Text.Trim().PadLeft(3, '0'); BE.familianame = familianame.Text.ToUpper().ToUpper(); if (tejidoid.SelectedValue != null && tejidoid.Text.Trim().Length > 0) { BE.lineaid = tejidoid.SelectedValue.ToString(); } BE.usuar = VariablesPublicas.Usuar.Trim(); BE.unmed = unmed.Text.Trim(); if (BL.Insert(EmpresaID, BE)) { MessageBox.Show("Datos Grabados 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 (familiaid.Text.Trim().Length != 3) { MessageBox.Show("Falta Codigo Familia !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pt_familiaBL(); var BE = new tb_pt_familia(); BE.moduloid = cboModuloID.SelectedValue.ToString(); BE.familiaid = familiaid.Text.Trim().PadLeft(3, '0'); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos eliminados correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); Data_Tablafamilia(); form_bloqueado(false); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Data_Tablafamilia() { try { if (Tablafamilia.Rows.Count > 0) { Tablafamilia.Rows.Clear(); } var BL = new tb_pt_familiaBL(); var BE = new tb_pt_familia(); if (cboModuloID2.SelectedIndex != -1) { BE.moduloid = cboModuloID2.SelectedValue.ToString(); BE.familianame = txt_criterio.Text.Trim().ToUpper(); Tablafamilia = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablafamilia.Rows.Count > 0) { btn_imprimir.Enabled = true; MDI_dgb_familia1.DataSource = Tablafamilia; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Update() { try { if (familiatelasid.Text.Trim().Length != 3) { MessageBox.Show("Falta Codigo Familia !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (familiatelasname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese Nombre de Familia", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pt_familiaBL(); var BE = new tb_pt_familia(); BE.moduloid = cboModuloID.SelectedValue.ToString(); BE.familiaid = familiatelasid.Text.Trim().PadLeft(3, '0'); BE.familianame = familiatelasname.Text.ToUpper(); 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); } }
public bool Insert(string empresaid, tb_pt_familia BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbTaFamilia_INSERT", cnx)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@familiaid", SqlDbType.Char, 3).Value = BE.familiaid; cmd.Parameters.Add("@familianame", SqlDbType.VarChar, 30).Value = BE.familianame; cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; cmd.Parameters.Add("@unmed", SqlDbType.Char, 3).Value = BE.unmed; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void form_cargar_datos(String posicion) { try { var BL = new tb_pt_familiaBL(); var BE = new tb_pt_familia(); var dt = new DataTable(); BE.moduloid = cboModuloID.SelectedValue.ToString(); if (familiatelasid.Text.Trim().Length > 0) { BE.familiaid = familiatelasid.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"; familiatelasid.Text = dt.Rows[0]["familiatelaid"].ToString().Trim(); familiatelasname.Text = dt.Rows[0]["familiatelaname"].ToString().Trim(); estructuraid.SelectedValue = dt.Rows[0]["estructuraid"].ToString().Trim(); data_cbo_tejidoid(); tejidoid.SelectedValue = dt.Rows[0]["lineaid"].ToString().Trim(); 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(string empresaid, tb_pt_familia BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_pt_familia BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll_paginacion(string empresaid, tb_pt_familia BE) { return tablaDA.GetAll_paginacion(empresaid, BE); }
public bool Delete(string empresaid, tb_pt_familia BE) { return tablaDA.Delete(empresaid, BE); }