public DataSet GetAll2(string empresaid, tb_cp_canalventa BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCpCanalventa_SEARCH2", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; //cmd.Parameters.Add("@canalventaname", SqlDbType.VarChar, 50).Value = BE.canalventaname; //cmd.Parameters.Add("@digitos", SqlDbType.Int).Value = BE.digitos; cmd.Parameters.Add("@parameters", SqlDbType.VarChar).Value = BE.parameters; } 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_cp_canalventa BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCpCanalventa_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
void CargarCmbCanalVta() { tb_cp_canalventaBL BL = new tb_cp_canalventaBL(); tb_cp_canalventa BE = new tb_cp_canalventa(); DataTable dt = new DataTable(); BE.digitos = 3; dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { cmb_canalvta.DataSource = dt; cmb_canalvta.ValueMember = "canalventaid"; cmb_canalvta.DisplayMember = "canalventaname"; cmb_canalvta.SelectedIndex = -1; } }
public bool Insert(string empresaid, tb_cp_canalventa BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCpCanalventa_INSERT", cnx)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; cmd.Parameters.Add("@canalventaname", SqlDbType.VarChar, 50).Value = BE.canalventaname; cmd.Parameters.Add("@digitos", SqlDbType.Int).Value = BE.digitos; cmd.Parameters.Add("@chk_apt", SqlDbType.Bit).Value = BE.chk_apt; 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_cp_canalventa BE) { return tablaDA.Update(empresaid, BE); }
private void Cargar_cmbCanalventa() { tb_cp_canalventa BE = new tb_cp_canalventa(); tb_cp_canalventaBL BL = new tb_cp_canalventaBL(); DataTable dt = new DataTable(); BE.digitos = 3; dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { cboCanalventaid.DataSource = dt; cboCanalventaid.ValueMember = "canalventaid"; cboCanalventaid.DisplayMember = "canalventaname"; } }
public DataSet GetOne(string empresaid, tb_cp_canalventa BE) { return tablaDA.GetOne(empresaid, BE); }
public bool Insert(string empresaid, tb_cp_canalventa BE) { return tablaDA.Insert(empresaid, BE); }
void ValidaCanalVta(String xcanal) { tb_cp_canalventaBL BL = new tb_cp_canalventaBL(); tb_cp_canalventa BE = new tb_cp_canalventa(); DataTable dt = new DataTable(); BE.canalventaid = xcanal; dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { txtcanalvtaname.Text = dt.Rows[0]["canalventaname"].ToString(); } }
private void Update() { try { if (txtcanalvtaid.Text.Trim().Length == 0) { MessageBox.Show("Falta Codigo de Canal !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (txtcanalvtaname.Text.Trim().Length == 0) { MessageBox.Show("Ingrese Nombre de Canal", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_cp_canalventaBL(); var BE = new tb_cp_canalventa(); BE.canalventaid = txtcanalvtaid.Text.ToString(); BE.canalventaname = txtcanalvtaname.Text.ToString(); BE.digitos = Convert.ToInt32(dtpdigitos.Text); BE.chk_apt = chkapto.Checked; if (BL.Update(EmpresaID, BE)) { SEGURIDAD_LOG("M"); MessageBox.Show("Datos Modificado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); procesado = true; } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Delete() { try { if (txtcanalvtaid.Text.Trim().Length == 0) { MessageBox.Show("Falta Codigo Canal !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { var BL = new tb_cp_canalventaBL(); var BE = new tb_cp_canalventa(); BE.canalventaid = txtcanalvtaid.Text.ToString(); if (BL.Delete(EmpresaID, BE)) { SEGURIDAD_LOG("E"); MessageBox.Show("Datos Eliminados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information); NIVEL_FORMS(); form_bloqueado(false); limpiar_documento(); data_TablaCanalVta(); btn_nuevo.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_TablaCanalVta() { try { if (TablaCanalVta.Rows.Count > 0) { TablaCanalVta.Rows.Clear(); } var BL = new tb_cp_canalventaBL(); var BE = new tb_cp_canalventa(); BE.parameters = txtbusqueda.Text.Trim().ToUpper(); TablaCanalVta = BL.GetAll2(EmpresaID, BE).Tables[0]; if (TablaCanalVta.Rows.Count > 0) { btn_imprimir.Enabled = true; dgb_canalvta.DataSource = TablaCanalVta; dgb_canalvta.Rows[0].Selected = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void ValidaCanal(String xcod) { var BL = new tb_cp_canalventaBL(); var BE = new tb_cp_canalventa(); DataTable dt = new DataTable(); BE.parameters = xcod; dt = BL.GetAll2(VariablesPublicas.EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { txtcanalvtaname.Text = dt.Rows[0]["canalventaname"].ToString(); } }