public bool Insert(string empresaid, tb_pp_bloqhojacosto BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("", cnx)) { cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; //cmd.Parameters.Add("@tiendaname", SqlDbType.Char, 100).Value = BE.tiendaname; //cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; //cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; //cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local; 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_bloqhojacosto BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPpBloqhojacosto_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@bloqcostid", SqlDbType.Char, 4).Value = BE.bloqcostoid; cmd.Parameters.Add("@bloqcostname", SqlDbType.VarChar, 50).Value = BE.bloqcostoname; } 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_pp_bloqhojacosto BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid; //cmd.Parameters.Add("@tiendalist", SqlDbType.Int).Value = BE.tiendalist; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
void CargarBloqueHoja() { tb_pp_bloqhojacosto BE = new tb_pp_bloqhojacosto(); tb_pp_bloqhojacostoBL BL = new tb_pp_bloqhojacostoBL(); DataTable dt = new DataTable(); dt = BL.GetAll("02", BE).Tables[0]; if (dt.Rows.Count > 0) { cmb_bloquehoja.DataSource = dt; cmb_bloquehoja.ValueMember = "bloqcostid"; cmb_bloquehoja.DisplayMember = "bloqcostname"; } txt_busqueda.Focus(); }
void CargarBloqueHoja2() { tb_pp_bloqhojacosto BE = new tb_pp_bloqhojacosto(); tb_pp_bloqhojacostoBL BL = new tb_pp_bloqhojacostoBL(); DataTable dt = new DataTable(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { cmb_bloquehoja2.DataSource = dt; cmb_bloquehoja2.ValueMember = "bloqcostid"; cmb_bloquehoja2.DisplayMember = "bloqcostname"; cmb_bloquehoja2.SelectedIndex = -1; } }