public bool Delete(string empresaid, tb_pt_grupo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPtGrupo_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@grupoid", SqlDbType.Char, 4).Value = BE.grupoid; } 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_grupo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPtGrupo_SEARCH_paginacion", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@grupoid", SqlDbType.Char, 4).Value = BE.grupoid; 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_Grupo(String xcod) { var BE3 = new tb_pt_grupo(); var BL3 = new tb_pt_grupoBL(); var dt3 = new DataTable(); BE3.grupoid = xcod.Trim(); dt3 = BL3.GetAll(EmpresaID, BE3).Tables[0]; if (dt3.Rows.Count > 0) { grupoid.Text = dt3.Rows[0]["grupoid"].ToString(); gruponame.Text = dt3.Rows[0]["gruponame"].ToString(); } else { grupoid.Text = string.Empty; gruponame.Text = string.Empty; } }
public bool Update(string empresaid, tb_pt_grupo BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_pt_grupo BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll_paginacion(string empresaid, tb_pt_grupo BE) { return tablaDA.GetAll_paginacion(empresaid, BE); }
public bool Delete(string empresaid, tb_pt_grupo BE) { return tablaDA.Delete(empresaid, BE); }
public bool Insert(string empresaid, tb_pt_grupo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPtGrupo_INSERT", cnx)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@grupoid", SqlDbType.Char, 4).Value = BE.grupoid; cmd.Parameters.Add("@gruponame", SqlDbType.VarChar, 30).Value = BE.gruponame; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; 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); } } } }
private void form_cargar_datos(String posicion) { try { var BL = new tb_pt_grupoBL(); var BE = new tb_pt_grupo(); var dt = new DataTable(); if (grupopromoid.Text.Trim().Length > 0) { BE.grupoid = grupopromoid.Text.Trim().PadLeft(4, '0'); } BE.posicion = posicion.Trim(); dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { limpiar_documento(); ssModo = "EDIT"; grupopromoid.Text = dt.Rows[0]["grupoid"].ToString().Trim(); grupopromoname.Text = dt.Rows[0]["gruponame"].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 Update() { try { if (grupoid.Text.Trim().Length != 4) { MessageBox.Show("Falta Codigo grupo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (gruponame.Text.Trim().Length == 0) { MessageBox.Show("Ingrese nombre de Grupo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { tb_pt_grupoBL BL = new tb_pt_grupoBL(); tb_pt_grupo BE = new tb_pt_grupo(); BE.grupoid = grupoid.Text.Trim().PadLeft(4, '0'); BE.gruponame = gruponame.Text.ToUpper(); BE.ctacte = ctacte.Text.Trim().ToUpper(); 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 (grupoid.Text.Trim().Length != 4) { MessageBox.Show("Falta Codigo grupo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { tb_pt_grupoBL BL = new tb_pt_grupoBL(); tb_pt_grupo BE = new tb_pt_grupo(); BE.grupoid = grupoid.Text.Trim().PadLeft(4, '0'); BE.gruponame = gruponame.Text.ToUpper(); BE.ctacte = ctacte.Text.Trim().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(); form_bloqueado(false); data_Tablagrupo(); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_Tablagrupo() { try { if (Tablagrupo.Rows.Count > 0) Tablagrupo.Rows.Clear(); tb_pt_grupoBL BL = new tb_pt_grupoBL(); tb_pt_grupo BE = new tb_pt_grupo(); BE.gruponame = txt_criterio.Text.Trim().ToUpper(); Tablagrupo = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablagrupo.Rows.Count > 0) { btn_imprimir.Enabled = true; gridgrupo.DataSource = Tablagrupo; gridgrupo.Rows[0].Selected = false; gridgrupo.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }