private static int InsertSale(
            SQLServer.Data.EntityFramework.SupermarketEntitiesSQLServer spEntSQLServer,
            ExcelData excelRow,
            int dateID,
            int supermarketID)
        {
            SQLServer.Models.EntityFramework.Sale saleToInsert = new SQLServer.Models.EntityFramework.Sale();
            saleToInsert.ProductID     = excelRow.ProductID;
            saleToInsert.SupermarketID = supermarketID;
            saleToInsert.DateID        = dateID;
            saleToInsert.Quantity      = excelRow.Quantity;
            saleToInsert.Sum           = excelRow.Sum;
            saleToInsert.UnitPrice     = excelRow.UnitPrice;
            var a = spEntSQLServer.Sales.Add(saleToInsert);

            spEntSQLServer.SaveChanges();

            return(a.ID);
        }
        private static int InsertDate(
            SQLServer.Data.EntityFramework.SupermarketEntitiesSQLServer spEntSQLServer,
            ExcelData excelRow)
        {
            var existingDate = spEntSQLServer.Dates.FirstOrDefault(d => d.DateAndTime == excelRow.SaleDate);

            if (existingDate == null)
            {
                SQLServer.Models.EntityFramework.Date dateToInsert = new SQLServer.Models.EntityFramework.Date();
                dateToInsert.DateAndTime = excelRow.SaleDate;
                var result = spEntSQLServer.Dates.Add(dateToInsert);

                spEntSQLServer.SaveChanges();

                return(result.ID);
            }
            else
            {
                return(existingDate.ID);
            }
        }
        private static int InsertSupermarket(SQLServer.Data.EntityFramework.SupermarketEntitiesSQLServer spEntSQLServer, ExcelData excelRow)
        {
            var existingSupermarket = spEntSQLServer.Supermarkets.FirstOrDefault(s => s.Name == excelRow.SupermarketName);

            if (existingSupermarket == null)
            {
                SQLServer.Models.EntityFramework.Supermarket supermarketToInsert = new SQLServer.Models.EntityFramework.Supermarket();
                supermarketToInsert.Name = excelRow.SupermarketName;
                var result = spEntSQLServer.Supermarkets.Add(supermarketToInsert);

                spEntSQLServer.SaveChanges();

                return(result.SupermarketId);
            }
            else
            {
                return(existingSupermarket.SupermarketId);
            }
        }