public DataSet GetAll_paginacion(string empresaid, tb_cxc_tipventa BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipventaid", SqlDbType.Char, 2).Value = BE.tipventaid; cmd.Parameters.Add("@tipventaname", SqlDbType.VarChar, 20).Value = BE.tipventaname; } 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_cxc_tipventa BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipventaid", SqlDbType.Char, 2).Value = BE.tipventaid; cmd.Parameters.Add("@tipventaname", SqlDbType.VarChar, 20).Value = BE.tipventaname; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void CargarComboTipVenta() { tb_cxc_tipventaBL BL = new tb_cxc_tipventaBL(); tb_cxc_tipventa BE = new tb_cxc_tipventa(); DataTable dt = new DataTable(); dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0]; if (dt.Rows.Count > 0) { cmb_tipventa.DataSource = dt; cmb_tipventa.ValueField = "tipventaid"; cmb_tipventa.TextField = "tpventaname"; //cmb_tipventa.SelectedIndexChanged += new EventHandler(cmb_tipventa_SelectedIndexChanged); cmb_tipventa.DataBind(); } }