Ejemplo n.º 1
0
        public JsonResult UpdateDetail(int ID, string COLUMN, string VALUE)
        {
            HIS_DETAIL his    = new HIS_DETAIL();
            var        result = his.Update(ID, COLUMN, VALUE);

            return(Json(result));
        }
Ejemplo n.º 2
0
        public JsonResult Assign(string MENTOR, int COURSE_ID, List <EMPLOYEE> IDS)
        {
            var        result = 0;
            HISTORY    his    = new HISTORY();
            HIS_DETAIL detail = new HIS_DETAIL();
            EMPLOYEE   em     = new EMPLOYEE();

            foreach (var id in IDS)
            {
                HISTORY last     = his.GetLastId(COURSE_ID, id.ID, MENTOR);
                int     isMentor = em.IsMentor(COURSE_ID, id.ID);
                if (last == null && isMentor == 0)
                {
                    result = his.Insert(COURSE_ID, id.ID, MENTOR);
                    if (result > 0)
                    {
                        last = his.GetLastId(COURSE_ID, id.ID, MENTOR);
                        if (last != null)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                result = detail.Insert(last.ID, COURSE_ID, id.ID, MENTOR, "Unconfirmed", id.DEPARTMENT);
                            }
                        }
                    }
                }
            }
            return(Json(result));
        }
Ejemplo n.º 3
0
        public ActionResult Upload(HttpPostedFileBase OUTCOME_RESULT, int ID)
        {
            var allowedExtensions = new[] { ".ppt", ".pptx" };
            var ext = Path.GetExtension(OUTCOME_RESULT.FileName).ToLower();

            if (!allowedExtensions.Contains(ext))
            {
                TempData["message"] = "Upload fail. Please select ppt/pptx file";
                return(Redirect(Request.UrlReferrer.ToString()));
            }
            HIS_DETAIL detail = new HIS_DETAIL();
            var        mypath = "~/Upload/File/" + ID.ToString();
            var        path   = Server.MapPath(mypath);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            DirectoryInfo di = new DirectoryInfo(path);

            foreach (FileInfo file in di.GetFiles())
            {
                file.Delete();
            }
            string savedFileName = Path.Combine(path, Path.GetFileName(OUTCOME_RESULT.FileName));

            OUTCOME_RESULT.SaveAs(savedFileName);
            string fileName = Path.GetFileName(OUTCOME_RESULT.FileName);

            var result = detail.Update(ID, "OUTCOME_RESULT", mypath + "/" + fileName);

            if (result > 0)
            {
                TempData["message"] = "Upload success";
            }
            else
            {
                TempData["message"] = "Upload fail";
            }
            return(Redirect(Request.UrlReferrer.ToString()));
        }