public DataSet GetAll(string empresaid, tb_me_subgrupo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMeSubgrupo_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; 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("@subgrupoartic", SqlDbType.VarChar, 20).Value = BE.subgrupoartic; cmd.Parameters.Add("@subgruponame", SqlDbType.VarChar, 80).Value = BE.subgruponame; //cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Delete(string empresaid, tb_me_subgrupo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMeSubgrupo_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; 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(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private DataTable Movimiento_subgrupo() { try { var TablaSubgrupo = new DataTable("Subgrupo"); var BL = new tb_me_subgrupoBL(); var BE = new tb_me_subgrupo(); BE.moduloid = moduloid.Trim(); TablaSubgrupo = BL.GetReport(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (TablaSubgrupo != null) { return TablaSubgrupo; } else { return null; } } catch (Exception ex) { return null; } }
private void Insert() { try { if (subgrupoid.Text.Trim().Length != 3) { MessageBox.Show("Falta Codigo subgrupo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (subgruponame.Text.Trim().Length == 0) { MessageBox.Show("Ingrese nombre de subgrupo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_me_subgrupoBL(); var BE = new tb_me_subgrupo(); BE.moduloid = modulo; BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0'); BE.grupoid = grupoid.Text.Trim().PadLeft(4, '0'); BE.subgrupoid = subgrupoid.Text.Trim().PadLeft(3, '0'); BE.subgruponame = subgruponame.Text.ToUpper(); BE.subgrupoartic = subgrupoartic.Text.Trim().ToUpper(); BE.usuar = VariablesPublicas.Usuar.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 form_cargar_datos(String posicion) { try { var BL = new tb_me_subgrupoBL(); var BE = new tb_me_subgrupo(); var dt = new DataTable(); BE.moduloid = modulo; BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0'); BE.grupoid = grupoid.Text.Trim().PadLeft(4, '0'); if (subgrupoid.Text.Trim().Length > 0) { BE.subgrupoid = subgrupoid.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"; 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(); subgrupoartic.Text = dt.Rows[0]["subgrupoartic"].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); } }
private void Delete() { try { if (subgrupoid.Text.Trim().Length != 3) { MessageBox.Show("Falta Codigo subgrupo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_me_subgrupoBL(); var BE = new tb_me_subgrupo(); BE.moduloid = modulo; BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0'); BE.grupoid = grupoid.Text.Trim().PadLeft(4, '0'); BE.subgrupoid = subgrupoid.Text.Trim().PadLeft(3, '0'); BE.subgruponame = subgruponame.Text.ToUpper(); BE.usuar = VariablesPublicas.Usuar.Trim(); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos Eliminado correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); limpiar_documento(); form_bloqueado(false); data_Tablasubgrupo(); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_Tablasubgrupo() { try { if (Tablasubgrupo.Rows.Count > 0) { Tablasubgrupo.Rows.Clear(); } var BL = new tb_me_subgrupoBL(); var BE = new tb_me_subgrupo(); switch (cbo_buscar.SelectedIndex) { case 0: BE.subgruponame = txt_criterio.Text.Trim(); break; case 1: if (txt_criterio.Text.Trim().Length > 0) { BE.subgrupoid = txt_criterio.Text.Trim().ToUpper().PadLeft(3, '0'); } break; case 2: if (txt_criterio.Text.Trim().Length > 0) { BE.grupoid = txt_criterio.Text.Trim().ToUpper().PadLeft(4, '0'); } break; case 3: if (txt_criterio.Text.Trim().Length > 0) { BE.lineaid = txt_criterio.Text.Trim().ToUpper().PadLeft(3, '0'); } break; default: break; } BE.moduloid = modulo; Tablasubgrupo = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablasubgrupo.Rows.Count > 0) { btn_imprimir.Enabled = true; gridsubgrupo.DataSource = Tablasubgrupo; gridsubgrupo.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ValidaSubgrupo() { if (subgrupoid.Text.Trim().Length > 0 && lineaid.Text.Trim().Length == 3 && grupoid.Text.Trim().Length == 4) { var BL = new tb_me_subgrupoBL(); var BE = new tb_me_subgrupo(); var dt = new DataTable(); BE.moduloid = modulo; BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0'); BE.grupoid = grupoid.Text.Trim().PadLeft(4, '0'); BE.subgrupoid = subgrupoid.Text.Trim().PadLeft(3, '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(); } else { subgrupoid.Text = string.Empty; subgruponame.Text = string.Empty; } } else { subgrupoid.Text = string.Empty; subgruponame.Text = string.Empty; } }
public bool Update(string empresaid, tb_me_subgrupo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMeSubgrupo_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; 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("@subgrupoartic", SqlDbType.VarChar, 80).Value = BE.subgrupoartic; cmd.Parameters.Add("@subgruponame", SqlDbType.VarChar, 100).Value = BE.subgruponame; //cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_me_subgrupo BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_me_subgrupo BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetReport(string empresaid, tb_me_subgrupo BE) { return tablaDA.GetReport(empresaid, BE); }
public DataSet GetAll_paginacion(string empresaid, tb_me_subgrupo BE) { return tablaDA.GetAll_paginacion(empresaid, BE); }
public bool Delete(string empresaid, tb_me_subgrupo BE) { return tablaDA.Delete(empresaid, BE); }