示例#1
0
        // GET: Package/Edit/5
        public ActionResult Edit(string id)
        {
            PackagesModel value = new PackagesModel();

            value = PackagesModel.GetPackageDetail(id);
            short d = 1;

            Int16.TryParse(SystemGeneralModel.GetConfigure(SystemGeneralModel.ConfigureClassEnum.OpenDays.ToString()).ConfigureContent, out d);
            PackageViewModel model = new PackageViewModel()
            {
                PG_No       = value.PackagesNo,
                PG_Name     = value.PackagesName,
                CreateDate  = value.CreateDate,
                EndDate     = value.EndDate ?? DateTime.Now.AddDays(d),
                Url         = this.Url.Action("Detail_Works", "Package", new { id = id }, this.Request.Url.Scheme),
                QRImg       = PackagesModel.DrawQRcodeToImgBase64sting(this.Url.Action("Detail_Works", "Package", new { id = id }, this.Request.Url.Scheme)),
                Remark      = value.PackagesMemo,
                WorksAmount = value.ItemAmount,
                Budget      = value.Budget,
                SumCost     = value.SumCost,
                SumPrice    = value.SumPrice,
            };

            model.WorksList = new List <WorksInfoViewModel>();
            var valueistem = PackagesModel.ReturnPackageItemList(id, true);

            for (int i = 0; i < valueistem.Count; i++)
            {
                model.WorksList.Add(new WorksInfoViewModel()
                {
                    //No = valueistem[i].WorksNo,
                    Author = valueistem[i].AuthorsName,
                    //MiniImgBase64 = valueistem[i].WorksImgBase64,
                    //MedImg = valueistem[i].WorksImg_m,
                    //MiniImgID = valueistem[i].WorksImgID,
                    Name  = valueistem[i].WorksName,
                    Price = valueistem[i].Price.ToString("#,#"),
                    Years = valueistem[i].Year,
                    Cost  = valueistem[i].Cost.ToString("#,#")
                });
                model.Summary += valueistem[i].Price;
            }
            return(View(model));
        }
示例#2
0
        public ActionResult Edit(string id, PackageViewModel collection)
        {
            //try
            //{
            PackagesModel value = new PackagesModel();

            value = PackagesModel.GetPackageDetail(collection.PG_No);
            value.PackagesName = collection.PG_Name;
            value.EndDate      = collection.EndDate;
            value.PackagesMemo = collection.Remark ?? "";
            value.Budget       = collection.Budget;
            value.Update();
            ViewData["Message"] = "儲存成功";

            collection.Url       = this.Url.Action("Detail_Works", "Package", new { id = id }, this.Request.Url.Scheme);
            collection.QRImg     = PackagesModel.DrawQRcodeToImgBase64sting(this.Url.Action("Detail_Works", "Package", new { id = id }, this.Request.Url.Scheme));
            collection.WorksList = new List <WorksInfoViewModel>();
            var valueistem = PackagesModel.ReturnPackageItemList(id, true);

            for (int i = 0; i < valueistem.Count; i++)
            {
                collection.WorksList.Add(new WorksInfoViewModel()
                {
                    //No = valueistem[i].WorksNo,
                    Author = valueistem[i].AuthorsName,
                    //MiniImgBase64 = valueistem[i].WorksImgBase64,
                    //MedImg = valueistem[i].WorksImg_m,
                    //MiniImgID = valueistem[i].WorksImgID,
                    Name  = valueistem[i].WorksName,
                    Price = valueistem[i].Price.ToString("#,#"),
                    Years = valueistem[i].Year,
                    Cost  = valueistem[i].Cost.ToString("#,#")
                });
                collection.Summary += valueistem[i].Price;
            }
            return(View(collection));
            //}
            //catch
            //{
            //    return Json("儲存失敗");
            //}
        }
示例#3
0
        // GET: Package/Details/5
        public ActionResult Detail_Works(string id = "")
        {
            PackageViewModel model = new PackageViewModel();

            if (!string.IsNullOrEmpty(id))
            {
                var value = PackagesModel.GetPackageDetail(id);
                model.PG_No       = value.PackagesNo;
                model.PG_Name     = value.PackagesName;
                model.Budget      = value.Budget;
                model.WorksAmount = value.ItemAmount.Substring(0, value.ItemAmount.IndexOf('('));
                model.EndDate     = value.EndDate.HasValue ? value.EndDate.Value : DateTime.Now.AddDays(-1);
                model.SumPrice    = value.SumPrice;
                model.SumCost     = value.SumCost;
                model.WorksList   = new List <WorksInfoViewModel>();
                var valueistem = PackagesModel.ReturnPackageItemList(id, true);
                for (int i = 0; i < valueistem.Count; i++)
                {
                    model.WorksList.Add(new WorksInfoViewModel()
                    {
                        No            = valueistem[i].WorksNo,
                        Author        = valueistem[i].AuthorsName,
                        MiniImgBase64 = valueistem[i].WorksImgBase64,
                        MedImg        = valueistem[i].WorksImg_m,
                        //MiniImgID = valueistem[i].WorksImgID,
                        Name  = valueistem[i].WorksName,
                        Price = valueistem[i].Price.ToString("#,#"),
                        Years = valueistem[i].Year,
                        Cost  = valueistem[i].Cost.ToString("#,#")
                    });
                    model.Summary += valueistem[i].Price;
                }
            }
            //if (model.EndDate < DateTime.Now)
            //{
            //    return RedirectToAction("Expired");
            //}
            return(View(model));
        }