예제 #1
0
 public BLLBase()
 {
     dal=new DALBase();
 }
예제 #2
0
        public static void GrabarVentas(DataSet dsVentas)
        {
            MySqlTransaction tr             = null;
            MySqlConnection  SqlConnection1 = DALBase.GetConnection();

            tr = SqlConnection1.BeginTransaction();
            DataTable tblVentas        = dsVentas.Tables[0];
            DataTable tblVentasDetalle = dsVentas.Tables[1];

reintetarVentas:
            try
            {
                GrabarDbVentas(dsVentas, SqlConnection1, tr);
            }
            catch (MySqlException ex)
            {
                if (ex.Number == 1062) // clave principal duplicada
                {
                    Random rand  = new Random();
                    int    clave = rand.Next(-2000000000, 2000000000);
                    tblVentas.Rows[0][0] = clave;
                    foreach (DataRow row in tblVentasDetalle.Rows)
                    {
                        row["IdVentaDVEN"] = clave;
                    }
                    goto reintetarVentas;
                }
                else
                {
                    tr.Rollback();
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                throw new Exception();
            }
reintetarDetalle:
            try
            {
                GrabarDbDetalle(dsVentas, SqlConnection1, tr);
            }
            catch (MySqlException ex)
            {
                if (ex.Number == 1062) // clave principal duplicada
                {
                    Random rand = new Random();
                    int    clave;
                    foreach (DataRow row in tblVentasDetalle.Rows)
                    {
                        clave         = rand.Next(-2000000000, 2000000000);
                        row["IdDVEN"] = clave;
                    }
                    goto reintetarDetalle;
                }
                else
                {
                    tr.Rollback();
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                throw new Exception();
            }
            tr.Commit();
            SqlConnection1.Close();
        }
예제 #3
0
 public DALMonedas(DALBase ObjDALBase, string UsuarioSistema)
 {
     Objbase      = ObjDALBase;
     this.Monedas = UsuarioSistema;
 }
예제 #4
0
 public DALInsumos(DALBase ObjDALBase, string UsuarioSistema)
 {
     Objbase      = ObjDALBase;
     this.Insumos = UsuarioSistema;
 }
예제 #5
0
 public DALFamiliaFormulas(DALBase ObjDALBase, string UsuarioSistema)
 {
     Objbase = ObjDALBase;
     this.FamiliaFormulas = UsuarioSistema;
 }
예제 #6
0
 public BLLBase()
 {
     dal = new DALBase();
 }