public JsonResult CheckExistTD(int ideaId)
        {
            var userId       = ((UserLogin)Session[ModelPr.CommonClass.CommonCls.User_session]).UserID;
            var rs_exEmotion = new IdeaDao().GetExistTD(ideaId, userId);

            return(Json(rs_exEmotion, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
 public ActionResult DownloadZipFile(int ideaCateId)
 {
     if (new IdeaCategoryDao().ChkFinaGtThanNow(ideaCateId / 777) == false)
     {
         List <Idea> files    = new IdeaDao().GetLFSPOverDateByCateId(ideaCateId / 777);
         string      basePath = AppDomain.CurrentDomain.BaseDirectory;
         //string fileName = path.Substring(path.LastIndexOf('/') + 1);
         if (files.Count > 0)
         {
             using (ZipFile zip = new ZipFile())
             {
                 zip.AlternateEncodingUsage = ZipOption.AsNecessary;
                 zip.AddDirectoryByName("Files");
                 foreach (var item in files)
                 {
                     zip.AddFile(basePath + item.FileSP.Replace("~", ""), "Files");
                 }
                 string zipName = String.Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MM-dd"));
                 using (MemoryStream memoryStream = new MemoryStream())
                 {
                     zip.Save(memoryStream);
                     return(File(memoryStream.ToArray(), "application/zip", zipName));
                 }
             }
         }
         else
         {
             return(RedirectToAction("Index/" + (int)TempData["grID"]));
         }
     }
     else
     {
         return(null);
     }
 }
        // GET: QAManager/Idea
        public ActionResult Index(int idCateId)
        {
            var listIdea = new IdeaDao().GetAllIdeaByCateId(idCateId);

            Session["ideaCateId"] = idCateId;
            return(View(listIdea));
        }
        public ActionResult UpdateIdeaById(int ideaId)
        {
            var cateGrId = TempData["grID"];

            ViewBag.GroupCateIdea = new SelectList(new CateGrIdeaDao().GetAllGrCateIdea(), "CategoryGroupIdeaID", "CategoryGroupName", cateGrId);
            Idea idea = new IdeaDao().GetIdeaById(ideaId);

            return(View(idea));
        }
        public void ThumbsUp(int ideaId)
        {
            var userId = ((UserLogin)Session[ModelPr.CommonClass.CommonCls.User_session]).UserID;

            new IdeaDao().CheckExistTD(ideaId, userId);
            var rs_exEmotion = new IdeaDao().CheckExistTU(ideaId, userId);

            if (rs_exEmotion == 0)
            {
                new IdeaDao().ThumbsUp(ideaId, userId);
            }
        }
        // GET: Student/Idea
        public ActionResult Index(int ideaCateId)
        {
            var result = new IdeaDao().GetAllIdeaByCateIdSt(ideaCateId).Select(x => new IdeaView
            {
                IdeaID        = x.IdeaID,
                IdeaTitle     = x.IdeaTitle,
                IdeaViewCount = x.IdeaViewCount,
                CommentCount  = (int)GetCountComment(x.IdeaID)
            });

            GetNameIdeaCate(ideaCateId);
            return(View(result));
        }
        public ActionResult GetDtIdById(int id)
        {
            InsertViewCount(id);
            GetUserByideaId(id);
            string path = new IdeaDao().GetFileSP(id);

            if (path != null)
            {
                string fileName = path.Substring(path.LastIndexOf('/') + 1);
                ViewBag.FileNameSP = fileName;
            }
            ViewBag.ViewIdea = new IdeaDao().GetIdeaByIdSt(id);
            return(View());
        }
        public FileContentResult DownloadFile(int ideaId)
        {
            string path     = new IdeaDao().GetFileSP(ideaId / 777);
            string fileName = path.Substring(path.LastIndexOf('/') + 1);

            if (((UserLogin)(Session[ModelPr.CommonClass.CommonCls.User_session])).UserID != 0)
            {
                string basePath  = AppDomain.CurrentDomain.BaseDirectory + "Data/StudentData/";
                byte[] fileBytes = System.IO.File.ReadAllBytes(basePath + fileName);
                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
            }
            else
            {
                return(null);
            }
        }
        public JsonResult GetThumbsUpCountUC(int ideaId)
        {
            int ThumbsCount = new IdeaDao().GetThumbsUp(ideaId).Count();

            return(Json(ThumbsCount, JsonRequestBehavior.AllowGet));
        }