コード例 #1
0
        public JsonResult InsertPrjComment(PRJ_REPLY reply)
        {
            ProjectReplyManager repMng = ProjectReplyManager.GetInstance();
            int result = repMng.InsertReply(reply);

            return(Json(result));
        }
コード例 #2
0
 public JsonResult GetRepDetail(string IDEA_ID, int table)
 {
     if (table == 0)
     {
         IdeaReplyManager manager = IdeaReplyManager.GetInstance();
         return(Json(manager.GetReplyDetail(IDEA_ID)));
     }
     else
     {
         ProjectReplyManager rep = ProjectReplyManager.GetInstance();
         List <PRJ_REPLY>    lst = rep.GetReplyName(IDEA_ID);
         return(Json(lst));
     }
 }
コード例 #3
0
        public JsonResult GetProgressReply(string ID)
        {
            ProjectReplyManager reply = ProjectReplyManager.GetInstance();
            var           reps        = reply.GetReply(ID);
            List <string> html        = new List <string>();
            var           i           = 1;

            foreach (var rep in reps)
            {
                var tr = "<tr><td>" + i.ToString() + "</td><td>" + rep.DEPARTMENT.Trim() + "</td><td>" + rep.EMP_NAME.Trim() +
                         "</td><td>" + rep.COMMENTS.Trim() + "</td><td>" + rep.INS_DATE.ToString() + "</td></tr>";
                html.Add(tr);
                i++;
            }
            return(Json(html));
        }
コード例 #4
0
        public ActionResult ExportProject(string from = "", string to = "")
        {
            ProjectReplyManager ir = ProjectReplyManager.GetInstance();

            var       fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            var       list     = ir.GetReplySummaryExport(from, to);
            DataTable dtb      = new DataTable();

            dtb.Clear();

            dtb.Columns.Add("IDEA_TITLE");
            dtb.Columns.Add("EMP_NAME");
            dtb.Columns.Add("DEPARTMENT");
            dtb.Columns.Add("DIVISION");
            dtb.Columns.Add("REP_EMP_NAME");
            dtb.Columns.Add("LIKE");
            dtb.Columns.Add("COMMENTS");
            foreach (var item in list)
            {
                DataRow r = dtb.NewRow();
                r["IDEA_TITLE"]   = item.IDEA_TITLE;
                r["EMP_NAME"]     = item.EMP_NAME;
                r["DEPARTMENT"]   = item.DEPARTMENT;
                r["DIVISION"]     = item.DIVISION;
                r["REP_EMP_NAME"] = item.REP_EMP_NAME;
                r["COMMENTS"]     = item.COMMENTS;
                r["LIKE"]         = item.numLike;
                dtb.Rows.Add(r);
            }
            // Gọi lại hàm để tạo file excel
            var stream = CreateExcelFile(dtb);
            // Tạo buffer memory strean để hứng file excel
            var buffer = stream as MemoryStream;

            // Đây là content Type dành cho file excel, còn rất nhiều content-type khác nhưng cái này mình thấy okay nhất
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            // Dòng này rất quan trọng, vì chạy trên firefox hay IE thì dòng này sẽ hiện Save As dialog cho người dùng chọn thư mục để lưu
            // File name của Excel này là ExcelDemo
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".xlsx");
            // Lưu file excel của chúng ta như 1 mảng byte để trả về response
            Response.BinaryWrite(buffer.ToArray());
            // Send tất cả ouput bytes về phía clients
            Response.Flush();
            Response.End();
            return(RedirectToAction("Summary"));
        }
コード例 #5
0
        public JsonResult GetProjectSum(DataTableParameters dataTableParameters, string from = "", string to = "")
        {
            ProjectReplyManager prj = ProjectReplyManager.GetInstance();
            var resultSet           = new DataTableResultSet();

            resultSet.draw = dataTableParameters.Draw;
            var lst = prj.GetReplySummary(from, to, dataTableParameters.Start + 1, dataTableParameters.Start + dataTableParameters.Length + 1);

            resultSet.recordsTotal = resultSet.recordsFiltered = prj.GetReplySumCount(from, to);

            foreach (var i in lst)
            {
                var columns = new List <string>();
                columns.Add((i.DIVISION == null) ? "" : i.DIVISION.Trim());
                columns.Add((i.DEPARTMENT == null) ? "" : i.DEPARTMENT.Trim());
                columns.Add(i.IDEA_TITLE.Trim());
                columns.Add((i.EMP_NAME == null) ? "" : i.EMP_NAME.Trim());
                columns.Add((i.numLike == null) ? "" : i.numLike.ToString());
                columns.Add((i.REP_EMP_NAME == null) ? "" : i.REP_EMP_NAME.ToString());
                columns.Add((i.COMMENTS == null) ? "" : i.COMMENTS.ToString());
                resultSet.data.Add(columns);
            }
            return(Json(resultSet));
        }