private WebshopReportViewModel CreateWebshopReportModel(Webshop webshop)
        {
            if (webshop.LatestChangeSet == null)
            {
                return(null);
            }

            var report = new WebshopReportViewModel();

            report.WebshopName = webshop.Name;
            report.WentLive    = webshop.IsOnLine && webshop.WebshopFeature.LastUpdatedIteration == Framework.Context.IterationNumber;

            report.FinishedFeatures = webshop.Features.Where(f => f.Implemented && f.Definition.IsFunctionality && f.LastUpdatedIteration == Framework.Context.IterationNumber)
                                      .Select(f => f.Definition.Name).ToList();

            report.RunningActions = webshop.Features.Where(f => f.Implemented && f.Definition.IsAction && f.AddedOnIteration + f.Definition.Duration >= Framework.Context.IterationNumber)
                                    .Select(f => f.Definition.Name).ToList();

            var inprogressFeature = webshop.Features
                                    .SingleOrDefault(f => !f.Implemented && f.LastUpdatedIteration == Framework.Context.IterationNumber && f.RemainingImplementationRequirements != f.Definition.ImplementationRequirements);

            if (inprogressFeature != null)
            {
                var remainingPeriodsCount = Math.Ceiling(inprogressFeature.RemainingImplementationRequirements / BusinessConstants.DefaultDeveloperCapacity);
                report.InProgressFeature = string.Format("{0} (Remaining weeks = {1})", inprogressFeature.Definition.Name, remainingPeriodsCount);
            }

            report.ConvertedUsersCountDifference = webshop.LatestChangeSet.ConvertedUsersCount;
            report.NewUsersCountDifference       = webshop.LatestChangeSet.NewUsersCount;
            report.AverageOrderAmountDifference  = webshop.LatestChangeSet.AverageOrderAmountIncreaseRate;

            return(report);
        }
Пример #2
0
        public async Task <ActionResult> EditWebshopItem(Webshop ws, HttpPostedFileBase file)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (Request.Files != null && Request.Files.Count > 0)
                {
                    file = Request.Files[0];
                    if (file != null && file.ContentLength > 0)
                    {
                    }
                }
                if (file.FileName == "")
                {
                    db.GetImage(ws);
                }
                else
                {
                    ws.Picture_Url = await AB.UploadBlobtest(file, "webshop");
                }
                db.EditWebshopItem(ws);

                return(RedirectToAction("WebshopAdminList"));
            }
        }
        private void ReadWebshopProduct()
        {
            string path = @"C:\test\webshop.txt";
            string line;

            try
            {
                if (File.Exists(path))
                {
                    StreamReader file = new StreamReader(path);
                    while ((line = file.ReadLine()) != null)
                    {
                        string[] x = line.Split(';');

                        for (int i = 0; i < x.Length; i = i + 2)
                        {
                            var p = new Webshop(x[i], Convert.ToDecimal(x[i + 1]));
                            _dierAsiel.WebshopList.Add(p);
                        }
                        AddProduct();
                    }
                    file.Close();
                }
                else
                {
                    throw new BestandNietGelezenException("Het bestand om de producten uit te lezen is niet gevonden");
                }
            }
            catch (BestandNietGelezenException e)
            {
                MessageBox.Show(e.Message);
            }
        }
Пример #4
0
        public void DeleteWebshopItem(Webshop ws)
        {
            var item = _DbOperation.Webshop.Where(x => x.Id == ws.Id).FirstOrDefault();

            _DbOperation.Webshop.Remove(item);
            _DbOperation.SaveChanges();
        }
Пример #5
0
        public void ExecutePerWebshop(Webshop webshop, CalculationContext context)
        {
            var increaseRate = context.FeaturesWithImpact
                               .Where(f => f.WebshopId == webshop.Id)
                               .Sum(f => (f.Definition.AverageOrderAmountIncreaseRate ?? 0) / 100m);

            webshop.LatestChangeSet.AverageOrderAmountIncreaseRate = increaseRate;
        }
Пример #6
0
 public AdminController()
 {
     db  = new dbOperation();
     vm  = new StartUpViewModel();
     Cvm = new ContactVM();
     AB  = new AzureBlobHelper();
     pfm = new postedFileModel();
     ws  = new Webshop();
 }
        public void ExecutePerWebshop(Webshop webshop, CalculationContext context)
        {
            var activeUsersCount = webshop.UserCount;
            if (context.RequiredServersCapacity > context.ServersCapacity)
                activeUsersCount *= (context.ServersCapacity / context.RequiredServersCapacity);

            var income = Math.Ceiling(webshop.AverageOrderAmount * activeUsersCount);
            webshop.LatestChangeSet.Income = income;
        }
Пример #8
0
        public Webshop GetImage(Webshop ws)
        {
            var image = _DbOperation.Webshop.Single(t => t.Id == ws.Id);

            ws.Picture_Url = image.Picture_Url;


            return(ws);
        }
Пример #9
0
        public void ExecutePerWebshop(Webshop webshop, CalculationContext context)
        {
            webshop.LatestChangeSet.NewUsersCount = context.FeaturesWithImpact.Where(f => f.WebshopId == webshop.Id)
                                                    .Sum(f => (f.Definition.NewOnlineUsersAmount ?? 0) / 100 * webshop.UserCount);

            var conversionRate = context.FeaturesWithImpact.Where(f => f.WebshopId == webshop.Id)
                                 .Sum(f => (f.Definition.OfflineUsersConversionRate ?? 0) / 100m);

            webshop.LatestChangeSet.ConvertedUsersCount = Math.Min(Math.Ceiling(conversionRate * webshop.OfflineUsersCount), webshop.OfflineUsersCount - webshop.ConvertedUsersCount);
        }
Пример #10
0
 public ActionResult DeleteWebshopItem(Webshop ws)
 {
     if (!User.Identity.IsAuthenticated)
     {
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         db.DeleteWebshopItem(ws);
         return(RedirectToAction("WebshopAdminList"));
     }
 }
Пример #11
0
        public void EditWebshopItem(Webshop ws)
        {
            var webshop = _DbOperation.Webshop.Single(t => t.Id == ws.Id);


            webshop.Description = ws.Description;
            webshop.Name        = ws.Name;
            webshop.Picture_Url = ws.Picture_Url;
            webshop.Price       = ws.Price;

            _DbOperation.SaveChanges();
        }
Пример #12
0
        private void ExecutePerWebshop(CalculationContext context, Webshop webshop)
        {
            var newFeatures = webshop.Features.Where(wf => wf.AddedOnIteration == context.IterationNumber - 1).ToList();

            var newFeaturesCost = newFeatures.Sum(f => f.Definition.ImplementationRequirements * BusinessConstants.PricePerHour);

            if (context.Project.Cash < newFeaturesCost)
            {
                throw new CalculationException(Name, "You do not have enough cash to pay for new features.");
            }

            context.Project.LatestChangeSet.Cost += newFeaturesCost;
        }
        private void BtnProductToevoegen_Click(object sender, RoutedEventArgs e)
        {
            var x       = TbPrijs.Text;
            var replace = x.Replace('.', ',');
            var d       = decimal.Parse(replace);
            var product = new Webshop(TbNaam.Text, d);

            _dierAsiel.AddProduct(product);
            _listViewProducten.Items.Clear();
            foreach (var p in _dierAsiel.WebshopList)
            {
                _listViewProducten.Items.Add(p);
            }
            this.Close();
        }
Пример #14
0
        public async Task <ActionResult> CreateWebshopItem(Webshop ws, HttpPostedFileBase file)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (Request.Files != null && Request.Files.Count > 0)
                {
                    file = Request.Files[0];
                    if (file != null && file.ContentLength > 0)
                    {
                    }
                }
                var imageUrl = await AB.UploadBlobtest(file, "webshop");

                db.CreateWebshopItem(ws, imageUrl.ToString());

                return(RedirectToAction("WebshopAdminList"));
            }
        }
Пример #15
0
 public void CreateWebshopItem(Webshop ws, string url)
 {
     ws.Picture_Url = url;
     _DbOperation.Webshop.Add(ws);
     _DbOperation.SaveChanges();
 }
Пример #16
0
 public void AddProduct(Webshop product)
 {
     WebshopList.Add(product);
 }