Exemple #1
0
        public ShoppingDataViewModel()
        {
            orders = new List <Order>();
            SuperMarketEntities db = new SuperMarketEntities();

            orders = db.Orders.ToList();
        }
Exemple #2
0
 private MainController()
 {
     Database.SetInitializer(new DropCreateDatabaseAlways <SupermarketContext>());
     //Database.SetInitializer(new MigrateDatabaseToLatestVersion<SupermarketContext, Configuration>());
     this.sQLServerContext = new SupermarketContext();
     this.mySqlContext     = new SuperMarketEntitiesModel();
     this.excelConnection  = new OleDbConnection();
     this.sqliteContext    = new SuperMarketEntities();
 }
Exemple #3
0
        public void Export(SuperMarketEntities sqliteContext)
        {
            var query = MongoDbProvider.db.LoadData <MongoDbProductFormat>().AsQueryable();

            foreach (var item in query)
            {
                sqliteContext.Products.Add(new Product()
                {
                    ProductId    = item.ProductId,
                    ProductName  = item.ProductName,
                    VendorName   = item.VendorName,
                    TotalIncomes = item.TotalIncomes
                });
            }
            sqliteContext.SaveChanges();
        }
Exemple #4
0
        public IList <SqliteExcelFormat> GetDataForExcelFile(SuperMarketEntities sqliteContext, SupermarketContext sqlServerContext)
        {
            IList <SqliteExcelFormat> data;

            data = sqliteContext.Products.Include("TaxTables.Tax").Select(x => new SqliteExcelFormat
            {
                Vendor        = x.VendorName,
                Incomes       = x.TotalIncomes,
                TaxPercentage = x.TaxTable.Tax,
                ProductId     = x.ProductId
            }).ToList();

            foreach (var item in data)
            {
                //item.Expenses = sqlServerContext.Expenses.Where(x => x.Vendor.VendorName == item.Vendor).Select(x => x.ExpenseValue).First();
                var vendorId = sqlServerContext.Products.Where(x => item.ProductId == x.Id).Select(x => x.VendorId).First();
                item.Expenses = sqlServerContext.Expenses.Where(x => x.VendorId == vendorId).Select(x => x.ExpenseValue).First();
            }

            return(data);
        }
Exemple #5
0
 public OrderProvider()
 {
     db = new SuperMarketEntities();
 }
Exemple #6
0
 public ProductController()
 {
     ctx = new SuperMarketEntities();
 }
Exemple #7
0
        public void Export(SuperMarketEntities sqliteContext, SupermarketContext sqlServerContext, string fileName)
        {
            IList <SqliteExcelFormat> data = GetDataForExcelFile(sqliteContext, sqlServerContext);

            CreateExcelFile(fileName, data);
        }
Exemple #8
0
 public AccountProvider(string connectionString)
 {
     db = new SuperMarketEntities(connectionString);
 }
Exemple #9
0
 public AccountProvider()
 {
     db = new SuperMarketEntities();
 }
 public ProductTypeProvider(string connectionString)
 {
     db = new SuperMarketEntities(connectionString);
 }
 public ProductTypeProvider()
 {
     db = new SuperMarketEntities();
 }
 public InventoryProvider()
 {
     db = new SuperMarketEntities();
 }