public bool Delete(string empresaid, tb_me_cargo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMecargo_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cargoid", SqlDbType.Char, 3).Value = BE.cargoid; } 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_me_cargo BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbMecargo_SEARCH_paginacion", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; cmd.Parameters.Add("@cargoid", SqlDbType.Char, 3).Value = BE.cargoid; 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); } } } }
public bool Update(string empresaid, tb_me_cargo BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_me_cargo BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetReport(string empresaid, tb_me_cargo BE) { return tablaDA.GetReport(empresaid, BE); }
public DataSet GetAll_paginacion(string empresaid, tb_me_cargo BE) { return tablaDA.GetAll_paginacion(empresaid, BE); }
public bool Delete(string empresaid, tb_me_cargo BE) { return tablaDA.Delete(empresaid, BE); }
private void _CargarCargos() { tb_me_cargoBL BL = new tb_me_cargoBL(); tb_me_cargo BE = new tb_me_cargo(); DataTable tbCargos = new DataTable(); tbCargos = BL.GetAll(EmpresaID, BE).Tables[0]; if (tbCargos.Rows.Count > 0) { cmb_cargo.DataSource = tbCargos; cmb_cargo.ValueMember = "cargoid"; cmb_cargo.DisplayMember = "cargoname"; } }
void ValidaCargo(String xcod) { tb_me_cargoBL BL = new tb_me_cargoBL(); tb_me_cargo BE = new tb_me_cargo(); DataTable dt = new DataTable(); BE.cargoid = xcod.ToString(); dt = BL.GetAll(EmpresaID,BE).Tables[0]; if (dt.Rows.Count > 0) { txt_cargoid.Text = dt.Rows[0]["cargoid"].ToString(); txt_cargoname.Text = dt.Rows[0]["cargoname"].ToString(); } else { txt_cargoid.Text = ""; txt_cargoname.Text = ""; } }
private void Update() { try { if (txtcargoid.Text.Trim().Length == 0) { MessageBox.Show("Falta Codigo de Cargo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (txtcargoname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese Nombre de Cargo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_me_cargoBL(); var BE = new tb_me_cargo(); BE.cargoid = txtcargoid.Text.ToString(); BE.cargoname = txtcargoname.Text.ToString(); if (cmb_cateplan.SelectedIndex != -1) BE.cateplanid = Convert.ToInt32(cmb_cateplan.SelectedValue.ToString()); 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 (txtcargoid.Text.Trim().Length == 0) { MessageBox.Show("Falta Codigo Cargo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_me_cargoBL(); var BE = new tb_me_cargo(); BE.cargoid = txtcargoid.Text.ToString(); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos Eliminados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); form_bloqueado(false); limpiar_documento(); data_Tablacargos(); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_Tablacargos() { try { if (Tablacargos.Rows.Count > 0) { Tablacargos.Rows.Clear(); } var BL = new tb_me_cargoBL(); var BE = new tb_me_cargo(); BE.cargoname = txtbusqueda.Text.Trim().ToUpper(); Tablacargos = BL.GetAll(EmpresaID, BE).Tables[0]; if (Tablacargos.Rows.Count > 0) { btn_imprimir.Enabled = true; dgb_cargos.DataSource = Tablacargos; dgb_cargos.Rows[0].Selected = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }