Exemplo n.º 1
0
 public ActionResult ImportPriceList(FormCollection formCollection)
 {
     if (Request != null)
     {
         DataTable          dt   = new DataTable();
         HttpPostedFileBase file = Request.Files["UploadedFile"];
         if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName))
         {
             string fileName = file.FileName;
             string path     = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["XlsFilePath"] + fileName);
             file.SaveAs(path);
             if (!System.IO.Directory.Exists(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["XlsFilePath"])))
             {
                 System.IO.Directory.CreateDirectory(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["XlsFilePath"]));
             }
             var excelData = new ViewModel.MicrosoftPriceList.ImportPriceList(path);
             var sData     = excelData.getData("USD");
             List <ExcelPriceList> list = new List <ExcelPriceList>();
             dt = sData.CopyToDataTable();
             ViewModel.MicrosoftPriceList.PriceList priceList = new ViewModel.MicrosoftPriceList.PriceList();
             list = excelData.ImportPrice(dt);
             ViewBag.MicrosoftPriceList     = list;
             TempData["MicrosoftPriceList"] = list;
         }
     }
     return(View("ImportPriceList"));
 }
Exemplo n.º 2
0
        public ActionResult SaveMicrosoftPrice()
        {
            List <ExcelPriceList> _m = TempData["MicrosoftPriceList"] as List <ExcelPriceList>;

            ViewModel.MicrosoftPriceList.PriceList pl = new ViewModel.MicrosoftPriceList.PriceList();
            pl.SavePriceList(_m);

            return(View("MicrosoftPriceList", _m));
        }
Exemplo n.º 3
0
 public JsonResult GetMicrosoftOffersPrice(string Id)
 {
     ViewModel.MicrosoftPriceList.PriceList _mopl = new ViewModel.MicrosoftPriceList.PriceList();
     return(Json(_mopl.GetPriceById(Id), JsonRequestBehavior.AllowGet));
 }