public bool Delete(string empresaid, tb_co_tributoafectoventas BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoTributoafectoventas_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@destinoid", SqlDbType.Char, 1).Value = BE.destinoid;
             }
             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_tributoafectoventas BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoTributoafectoventas_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@destinoid", SqlDbType.Char, 1).Value = BE.destinoid;
                 cmd.Parameters.Add("@destinoname", SqlDbType.VarChar, 100).Value = BE.destinoname;
                 cmd.Parameters.Add("@destinoafecto", SqlDbType.Bit).Value = BE.destinoafecto;
                 cmd.Parameters.Add("@destinoafecto1", SqlDbType.Bit).Value = BE.destinoafecto1;
                 cmd.Parameters.Add("@destinodaot", SqlDbType.Bit).Value = BE.destinodaot;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        public void validaTipoIgv()
        {
            string xcodigo = "";
            xcodigo = Equivalencias.Left(cboDestinoigv.Text, 1);
            tb_co_tributoafectoventasBL BL = new tb_co_tributoafectoventasBL();
            tb_co_tributoafectoventas BE = new tb_co_tributoafectoventas();

            BE.destinoid = xcodigo;
            tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            if (tmptabla.Rows.Count > 0)
            {
                xcodigo = tmptabla.Rows[0]["destinoid"].ToString();
                if (!(Equivalencias.Left(cboDestinoigv.Text, 1) == "3"))
                {
                    sw_novaluechange = true;
                    if ((DetFacturacion != null))
                    {
                        if (DetFacturacion.Rows.Count > 0)
                        {
                            DetFacturacion.Rows[lc_contador]["afectoigvid"] = Equivalencias.Left(cboDestinoigv.Text, 1);
                        }
                    }
                    sw_novaluechange = false;
                }
            }
            else
            {
                cboDestinoigv.ValueMember = j_String;
            }
            GridExaminar.Refresh();
            refrescacontroles();
        }
        internal void validaTipoIgvDetalle()
        {
            string xcodigo = "";
            sw_novaluechange = true;
            if (GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["afectoigvid"].Value == DBNull.Value)
            {
                GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["afectoigvid"].Value = "";
            }
            xcodigo = GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["afectoigvid"].Value.ToString();
            if (xcodigo.Trim().Length > 0)
            {
                tb_co_tributoafectoventasBL BL = new tb_co_tributoafectoventasBL();
                tb_co_tributoafectoventas BE = new tb_co_tributoafectoventas();

                BE.destinoid = xcodigo;
                tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];

                if (tmptabla.Rows.Count > 0)
                {
                    GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["afectoigvid"].Value = tmptabla.Rows[0]["destinoid"];
                    // GridExaminar.Rows[ GridExaminar.CurrentRow.Index].Cells["ddestino"].Value = tmptabla.Rows[0]["DESCRIP"];
                    txtDescripcampo.Text = tmptabla.Rows[0]["destinoname"].ToString();
                }
                else
                {
                    GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["afectoigvid"].Value = j_Destino;
                }
            }
            else
            {
                GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["afectoigvid"].Value = j_Destino;
            }
            sw_novaluechange = false;
            totalizarItem();
        }
        private BindingSource NewMethodDestino()
        {
            tb_co_tributoafectoventasBL BL = new tb_co_tributoafectoventasBL();
            tb_co_tributoafectoventas BE = new tb_co_tributoafectoventas();

            DataTable table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            DataRowCollection rows = table.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 POnerDatos()
        {
            var sorted = default(SortOrder);
            var xnomcolumna = string.Empty;

            var BL = new tb_co_tributoafectoventasBL();
            var BE = new tb_co_tributoafectoventas();

            var Tipoigv = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];

            dgAyuda.AutoGenerateColumns = false;
            dgAyuda.DataSource = Tipoigv;
            if (xnomcolumna.Trim().Length > 0)
            {
                if (sorted == SortOrder.Ascending)
                {
                    dgAyuda.Sort(dgAyuda.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Ascending);
                }
                else
                {
                    dgAyuda.Sort(dgAyuda.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Descending);
                }
            }
            else
            {
                dgAyuda.Sort(dgAyuda.Columns["destinoid"], System.ComponentModel.ListSortDirection.Ascending);
            }
        }
 public bool Update(string empresaid, tb_co_tributoafectoventas BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_co_tributoafectoventas BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetAll(string empresaid, tb_co_tributoafectoventas BE)
 {
     return tablaDA.GetAll(empresaid, BE);
 }