public bool Insert(string empresaid, tb_pp_parteprenda BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPpPartePrenda_INSERT", cnx)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@partepdaname", SqlDbType.VarChar, 30).Value = BE.partepdaname; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GetAll(string empresaid, tb_pp_parteprenda BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPpPartePrenda_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@partepdaid", SqlDbType.Int).Value = BE.partepdaid; cmd.Parameters.Add("@partepdaname", SqlDbType.VarChar, 30).Value = BE.partepdaname; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
// Combo Parte Prenda void CargaPartePrenda() { tb_pp_parteprendaBL BL = new tb_pp_parteprendaBL(); tb_pp_parteprenda BE = new tb_pp_parteprenda(); DataTable dt = new DataTable(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { cmb_partepda.DataSource = dt; cmb_partepda.ValueMember = "partepdaid"; cmb_partepda.DisplayMember = "partepdaname"; cmb_partepda.SelectedIndex = 0; } }
private void Update() { try { if (txt_partepdaid.Text.Trim().Length == 0) { MessageBox.Show("Falta Codigo de Parte !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (txt_partepdaname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese una Descripcion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pp_parteprendaBL(); var BE = new tb_pp_parteprenda(); BE.partepdaid = Convert.ToInt32(txt_partepdaid.Text); BE.partepdaname = txt_partepdaname.Text.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 Insert() { try { if (txt_partepdaname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese una Descripción", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pp_parteprendaBL(); var BE = new tb_pp_parteprenda(); BE.partepdaname = txt_partepdaname.Text.ToString(); 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 (txt_partepdaid.Text.Trim().Length == 0) { MessageBox.Show("Falta Codigo Parte !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_pp_parteprendaBL(); var BE = new tb_pp_parteprenda(); BE.partepdaid = Convert.ToInt32(txt_partepdaid.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); limpiar_documento(); data_TablaPartePrenda(); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_TablaPartePrenda() { try { if (TablaPartePrenda.Rows.Count > 0) { TablaPartePrenda.Rows.Clear(); } var BL = new tb_pp_parteprendaBL(); var BE = new tb_pp_parteprenda(); BE.partepdaname = txtbusqueda.Text.ToString(); TablaPartePrenda = BL.GetAll(EmpresaID, BE).Tables[0]; if (TablaPartePrenda.Rows.Count > 0) { btn_imprimir.Enabled = true; dgv_parteprenda.DataSource = TablaPartePrenda; dgv_parteprenda.Rows[0].Selected = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool Update(string empresaid, tb_pp_parteprenda BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_pp_parteprenda BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll(string empresaid, tb_pp_parteprenda BE) { return tablaDA.GetAll(empresaid, BE); }