public DataSet GetAll(string empresaid, tb_docuident BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbDocuident_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@docuidentid", SqlDbType.Char, 1).Value = BE.docuidentid; cmd.Parameters.Add("@docuidentname", SqlDbType.VarChar, 40).Value = BE.docuidentname; } 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_docuident BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbDocuident_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@docuidentid", SqlDbType.Char, 1).Value = BE.docuidentid; } 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_docuident BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_docuident BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll(string empresaid, tb_docuident BE) { return tablaDA.GetAll(empresaid, BE); }
public bool Delete(string empresaid, tb_docuident BE) { return tablaDA.Delete(empresaid, BE); }
private BindingSource NewMethodob() { var BL = new docuidentBL(); var BE = new tb_docuident(); var table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; var rows = table.Rows; object[] cell; var dic = new Dictionary<string, string>(); var binding = new BindingSource(); foreach (DataRow item in rows) { cell = item.ItemArray; dic.Add(cell[0].ToString(), cell[0].ToString() + " - " + cell[1].ToString()); cell = null; } binding.DataSource = dic; return binding; }