public DataSet GetAll(string empresaid, tb_co_motivodeltraslado BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoMotivodeltraslado_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@motivotrasladoid", SqlDbType.Char, 2).Value = BE.motivotrasladoid; cmd.Parameters.Add("@motivotrasladoname", SqlDbType.VarChar, 50).Value = BE.motivotrasladoname; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } 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_co_motivodeltraslado BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoMotivodeltraslado_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@motivotrasladoid", SqlDbType.Char, 2).Value = BE.motivotrasladoid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void data_cbo_motivotrasladoid() { try { var BL = new tb_co_motivodeltrasladoBL(); var BE = new tb_co_motivodeltraslado(); motivotrasladoid.DataSource = BL.GetAll(EmpresaID, BE).Tables[0]; motivotrasladoid.ValueMember = "motivotrasladoid"; motivotrasladoid.DisplayMember = "motivotrasladoname"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool Update(string empresaid, tb_co_motivodeltraslado BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_co_motivodeltraslado BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll(string empresaid, tb_co_motivodeltraslado BE) { return tablaDA.GetAll(empresaid, BE); }