コード例 #1
0
        //[OutputCache(Duration = 600)]
        public ActionResult Index()
        {
            int TeamId = 1;

            Session["TeamId"] = TeamId;
            UIAutomationAggregate model = new UIAutomationAggregate(TeamId);

            return(View("~/Views/Report/Index.cshtml", model));
        }
コード例 #2
0
        //[OutputCache(Duration = 600, VaryByParam = "TeamId")]
        public ActionResult GetDataForTeam(int id = 1)
        {
            UIAutomationAggregate model = null;

            try
            {
                model = new UIAutomationAggregate(id);
            }
            catch (Exception e)
            {
                var path = Server.MapPath("~/Excel/ErrorLog.txt");
                System.IO.File.AppendAllText(path, e.ToString() + Environment.NewLine + Environment.NewLine);
                return(RedirectToAction("Error"));
            }
            return(View("~/Views/Report/Index.cshtml", model));
        }
コード例 #3
0
        public ActionResult UpdateTeamAutomationStatus(HttpPostedFileBase AutomationStatusExcelFile, int TeamId = 1)
        {
            if (AutomationStatusExcelFile != null)
            {
                string ExcelPath;
                if (TeamId == 1)
                {
                    ExcelPath = Server.MapPath("~/Excel/Team" + TeamId + ".xlsx");
                }
                else
                {
                    ExcelPath = Server.MapPath("~/Excel/Team2.xlsx");
                }

                if (System.IO.File.Exists(ExcelPath))
                {
                    try
                    {
                        System.IO.File.Delete(ExcelPath);
                    }
                    catch
                    {
                        Debug.WriteLine("ExcelFile is in use... Cannot Delete it");
                    }
                }

                AutomationStatusExcelFile.SaveAs(ExcelPath);

                UpdateWeeklyAutomationStatus(ExcelPath, TeamId);
            }
            Session["TeamId"] = TeamId;
            UIAutomationAggregate model = new UIAutomationAggregate(TeamId);

            //clear the cache
            ClearApplicationCache();

            return(View("~/Views/Report/Index.cshtml", model));
        }