public DataSet GetAll(string empresaid, tb_co_tabla04_tipomoneda BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTabla04Tipomoneda_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@codigoid", SqlDbType.Char, 1).Value = BE.codigoid; cmd.Parameters.Add("@descripcion", SqlDbType.VarChar, 100).Value = BE.descripcion; cmd.Parameters.Add("@sigla", SqlDbType.Char, 3).Value = BE.sigla; 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_tabla04_tipomoneda BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTabla04Tipomoneda_DELETE", cnx)) { { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@codigoid", SqlDbType.Char, 1).Value = BE.codigoid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void data_cbo_moneda() { try { var BL = new tb_co_tabla04_tipomonedaBL(); var BE = new tb_co_tabla04_tipomoneda(); var dt = new DataTable(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; moneda.DataSource = dt; moneda.ValueMember = "monedaid"; moneda.DisplayMember = "sigla"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private BindingSource NewMethodMoneda() { tb_co_tabla04_tipomonedaBL BL = new tb_co_tabla04_tipomonedaBL(); tb_co_tabla04_tipomoneda BE = new tb_co_tabla04_tipomoneda(); DataTable table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; DataRowCollection rows = table.Rows; object[] cell; Dictionary<string, string> dic = new Dictionary<string, string>(); BindingSource binding = new BindingSource(); foreach (DataRow item in rows) { cell = item.ItemArray; dic.Add(cell[0].ToString(), cell[0].ToString() + " - " + cell[2].ToString()); cell = null; } binding.DataSource = dic; return binding; }
public bool Insert(string empresaid, tb_co_tabla04_tipomoneda BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTabla04Tipomoneda_INSERT", cnx)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@codigoid", SqlDbType.Char, 1).Value = BE.codigoid; cmd.Parameters.Add("@descripcion", SqlDbType.VarChar, 100).Value = BE.descripcion; cmd.Parameters.Add("@sigla", SqlDbType.Char, 3).Value = BE.sigla; 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_co_tabla04_tipomoneda BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_co_tabla04_tipomoneda BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll(string empresaid, tb_co_tabla04_tipomoneda BE) { return tablaDA.GetAll(empresaid, BE); }