public bool Delete(string empresaid, tb_co_tipoventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTipoventas_DELETE", cnx)) { { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipoid", SqlDbType.Char, 3).Value = BE.tipoid; } 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_co_tipoventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTipoventas_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipoid", SqlDbType.Char, 2).Value = BE.tipoid; cmd.Parameters.Add("@tiponame", SqlDbType.VarChar, 100).Value = BE.tiponame; cmd.Parameters.Add("@cuenta1id", SqlDbType.Char, 10).Value = BE.cuenta1id; cmd.Parameters.Add("@cuenta1name", SqlDbType.VarChar, 100).Value = BE.cuenta1name; cmd.Parameters.Add("@cuenta2id", SqlDbType.Char, 10).Value = BE.cuenta2id; cmd.Parameters.Add("@cuenta2name", SqlDbType.VarChar, 100).Value = BE.cuenta2name; cmd.Parameters.Add("@moneda", SqlDbType.VarChar, 1).Value = BE.moneda; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GetAll_IR(string empresaid, tb_co_tipoventas BE) { //return tablaDA.GetAll_IR(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_IR(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public void validaTipoVenta() { txtTipoventa.Text = txtTipoventa.Text.PadLeft(2, '0'); if (txtTipoventa.Text.Trim().Length > 0) { tb_co_tipoventasBL BL = new tb_co_tipoventasBL(); tb_co_tipoventas BE = new tb_co_tipoventas(); BE.tipoid = txtTipoventa.Text.Trim(); DataTable tventa = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tventa.Rows.Count == 0) { txtTipoventa.Text = j_String; } else { txtTipoventa.Text = tventa.Rows[0]["tipoid"].ToString().Trim(); lblTipoventa.Text = tventa.Rows[0]["tiponame"].ToString().Trim(); cboMoneda.SelectedValue = tventa.Rows[0]["moneda"].ToString().Trim(); } } else { txtTipoventa.Text = j_String; } // txtTipoventa.Text = VariablesPublicas.PADL(txtTipoventa.Text.Trim(), txtTipoventa.MaxLength, "0"); // tmptabla = ocapa.KAG0600_CONSULTA((txtTipoventa.Text.Trim().Length == 0 ? ".." : txtTipoventa.Text.Trim()), "", GlobalVars.GetInstance.TipoConceptoVentas, 1, GlobalVars.GetInstance.Company, 0); //if (ocapa.sql_error.Length == 0) //{ //if (tmptabla.Rows.Count > 0) //{ // txtTipoventa.Text = tmptabla.Rows[0]["tipoc_6k"].ToString(); // lblTipoventa.Text = tmptabla.Rows[0]["nomb_6k"].ToString(); //} //else //{ // txtTipoventa.Text = j_TipoVenta; //} //} }
private BindingSource NewMethodTV() { tb_co_tipoventasBL BL = new tb_co_tipoventasBL(); tb_co_tipoventas BE = new tb_co_tipoventas(); DataTable tcompra = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; DataRowCollection rows = tcompra.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[1].ToString()); cell = null; } binding.DataSource = dic; return binding; }
private void llenar_Tipocompra() { try { var BL = new tb_co_tipoventasBL(); var BE = new tb_co_tipoventas(); switch (cboCriterioBusqueda.SelectedItem.ToString()) { case "Código": BE.tipoid = txtCadenaBuscar.Text.Trim().ToUpper(); break; case "Descripción": BE.tiponame = txtCadenaBuscar.Text.Trim().ToUpper(); break; default: BE.tipoid = txtCadenaBuscar.Text.Trim().ToUpper(); break; } Sw_LOad = false; if (GridExaminar.RowCount > 0) { GridExaminar.Focus(); GridExaminar.BeginEdit(true); } GridExaminar.AutoGenerateColumns = false; GridExaminar.DataSource = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataSet GetAll_IR(string empresaid, tb_co_tipoventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTipoventas_SEARCH_IR", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio; cmd.Parameters.Add("@tipoid", SqlDbType.Char, 2).Value = BE.tipoid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public bool Insert(string empresaid, tb_co_tipoventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTipoventas_INSERT", cnx)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipoid", SqlDbType.Char, 2).Value = BE.tipoid; cmd.Parameters.Add("@tiponame", SqlDbType.VarChar, 100).Value = BE.tiponame; cmd.Parameters.Add("@cuenta1id", SqlDbType.Char, 10).Value = BE.cuenta1id; cmd.Parameters.Add("@cuenta1name", SqlDbType.VarChar, 100).Value = BE.cuenta1name; cmd.Parameters.Add("@cuenta2id", SqlDbType.Char, 10).Value = BE.cuenta2id; cmd.Parameters.Add("@cuenta2name", SqlDbType.VarChar, 100).Value = BE.cuenta2name; cmd.Parameters.Add("@moneda", SqlDbType.VarChar, 1).Value = BE.moneda; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public String GetNextCod(string empresaid, tb_co_tipoventas BE) { String newcod = ""; using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoTipoventas_SEARCH_nextcod", cnx)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; try { cnx.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { newcod = Convert.ToString(reader["nextcod"]); } return newcod; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Update(string empresaid, tb_co_tipoventas BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_co_tipoventas BE) { return tablaDA.Insert(empresaid, BE); }
public String GetNextCod(string empresaid, tb_co_tipoventas BE) { return tablaDA.GetNextCod(empresaid, BE); }
public DataSet GetAll(string empresaid, tb_co_tipoventas BE) { return tablaDA.GetAll(empresaid, BE); }