Exemplo n.º 1
0
        public ActionResult Edit()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductCategoryViewModel viewModel = new ProductCategoryViewModel();

            PriceDataService dataService = new PriceDataService();

            try
            {
                viewModel.ProductCategoryModel = dataService.GenerateProductCategoryModel();



                return(View(viewModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Exemplo n.º 2
0
        public ActionResult EditPrice(int priceListId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();
            PriceListModel   model       = new PriceListModel();

            try
            {
                model = dataService.GetPriceListById(priceListId);
                return(View(model));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Exemplo n.º 3
0
        public ActionResult DeletePrice(int priceListId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();

            try
            {
                dataService.DeletePriceList(priceListId);
                return(RedirectToAction("Edit", "Price"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Exemplo n.º 4
0
        public ActionResult EditHeader(int productLabelId, string productTableTitleDescription)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService   dataService = new PriceDataService();
            ProductHeaderModel model       = new ProductHeaderModel();

            try
            {
                model.ProductLabelId = productLabelId;
                model.ProductTableTitleDescription = productTableTitleDescription;
                dataService.UpdateHeader(model);
                return(RedirectToAction("Edit", "Price"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Exemplo n.º 5
0
        private void GetPriceData()
        {
            var priceSeries = PriceDataService.GetPriceDataSeries().Take(30).ToList();

            PriceDataSeries = new ObservableCollection <Series>(priceSeries);

            Sensitivity = 95;

            PriceInfo = new PriceInfo()
            {
                granularity     = "daily",
                maxAnomalyRatio = 0.25,
                sensitivity     = Sensitivity,
                series          = priceSeries
            };
        }
Exemplo n.º 6
0
        public ActionResult EditPrice(PriceListModel plm)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"]      = cm.FaceBook;
            Session["Twitter"]       = cm.Twitter;
            Session["Youtube"]       = cm.Youtube;
            Session["Instagram"]     = cm.Instagram;
            Session["PhoneNumber"]   = cm.PhoneNumber;
            Session["Email"]         = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();
            PriceListModel   model       = new PriceListModel();

            try
            {
                if (ModelState.IsValid)
                {
                    model.PriceListId        = plm.PriceListId;
                    model.ProductName        = plm.ProductName;
                    model.ProductDescription = plm.ProductDescription;
                    model.Price = plm.Price;
                    dataService.UpdatePriceList(model);
                    return(RedirectToAction("Edit", "Price"));
                }
                else
                {
                    return(View(plm));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Exemplo n.º 7
0
        // GET: Forms
        public ActionResult Index()
        {
            PriceDataService dataService = new PriceDataService();
            //dataService.CreateOrderForm();
            List <ProductCategoryModel> modelList = new List <ProductCategoryModel>();

            modelList = dataService.GenerateProductCategoryModel();
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment; filename=OrderForm.doc");
            Response.ContentType = "application/vnd.ms-word ";
            Response.Charset     = string.Empty;

            StringWriter  sw = new StringWriter();
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<h1>ORDER FORM</h1>");
            sb.AppendLine("<h2>        FREE DELIVERY 20KG MINIMUM</h2>");
            sb.AppendLine("<h2>NAME :</h2>");
            sb.AppendLine("<h2>COMPANY:</h2>");
            sb.AppendLine("<h2>ADDRESS:</h2>");
            sb.AppendLine("<h2>CONTACT NO.</h2>");
            sb.AppendLine("<style>table, th, td {border: 1px solid black;}</style><div class=row>");
            foreach (var item in modelList)
            {
                sb.AppendLine("<div class=col-lg-12>");
                sb.AppendLine("<h2>" + item.ProductCategory + "</h2>");
                sb.AppendLine("</div>");
                sb.AppendLine("<table  width=100%>");
                sb.AppendLine("<thead>");
                sb.AppendLine("<tr><th>Product Name</th><th>Product Description</th><th>Price</th><th>Quantity</th></tr></thead><tbody>");

                if (item.PriceListModel.Count > 0)
                {
                    foreach (var item3 in item.PriceListModel)
                    {
                        sb.AppendLine("<tr>");
                        sb.AppendLine("<td>" + item3.ProductName + "</td>");
                        sb.AppendLine("<td>" + item3.ProductDescription + "</td>");
                        sb.AppendLine("<td>" + item3.Price + "</td>");
                        sb.AppendLine("<td></td>");
                        sb.AppendLine("</tr>");
                    }
                }

                sb.AppendLine("</tbody>");
                sb.AppendLine("</table>");
            }

            sb.AppendLine("</div>");
            sb.AppendLine("<h2>TOTAL ORDER AMOUNT  =</h2>");

            //HtmlTextWriter htw = new HtmlTextWriter(sw);
            //gv.RenderControl(htw);
            Response.Output.Write(sb.ToString());
            Response.Flush();
            Response.End();

            return(RedirectToAction("Index", "Products"));
            //return new FilePathResult("~/DownloadableForms/OrderForm.docx", System.Net.Mime.MediaTypeNames.Application.Octet);
            //return File("/DownloadableForms/OrderForm.doc", System.Net.Mime.MediaTypeNames.Application.Octet);
        }