Esempio n. 1
0
 // GET: TOD
 public ActionResult Index()
 {
     //get the scheduler execution status message to display in Scheduler notification area in TOD Page
     ViewData["schMessage"] = TodScheduler.GetSchedulerJobMessage();
     tODDataService         = new TODDataService();
     ViewData["fwklist"]    = tODDataService.GetCEWKList();
     ViewData["PRDList"]    = tODDataService.GetProductList();
     return(View());
 }
Esempio n. 2
0
        public JsonResult UploadMultiple(HttpPostedFileBase[] uploadedFiles, string fweek)
        {
            bool          success = true;
            OMNITURE_DATA omData  = new OMNITURE_DATA();

            tODDataService = new TODDataService();
            for (var i = 0; i < uploadedFiles.Length; i++)
            {
                var uploadedFile = uploadedFiles[i];
                if (uploadedFile != null && uploadedFile.ContentLength > 0)
                {
                    byte[] FileByteArray = new byte[uploadedFile.ContentLength];
                    uploadedFile.InputStream.Read(FileByteArray, 0, uploadedFile.ContentLength);

                    //save the file to database

                    omData = tODDataService.AppendFileData(omData, uploadedFile, fweek);
                }
            }

            success = tODDataService.SaveOrUpdateOMRecords(omData, fweek);

            if (success)
            {
                log.Info("Files successfully uploaded to database.");
                ViewData["UploadStatus"] = Json(new
                {
                    statusCode = 200,
                    status     = "Files Uploaded Successfully"
                }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                log.Info("Files uploading to database failed.");
                ViewData["UploadStatus"] = Json(new
                {
                    statusCode = 400,
                    status     = "Bad Request! Upload Failed",
                    file       = string.Empty
                }, JsonRequestBehavior.AllowGet);
            }
            return(Json(ViewData));
        }