Esempio n. 1
0
        public JsonResult Edit(FormCollection collection, string[] FOLDER_ID, string[] filename, IEnumerable <HttpPostedFileBase> filebase)
        {
            DM_DANHMUC_DATABusiness = Get <DM_DANHMUC_DATABusiness>();
            var result = new JsonResultBO(true);

            AssignUserInfo();
            try
            {
                var id    = collection["ID"].ToIntOrZero();
                var myobj = DM_DANHMUC_DATABusiness.Find(id);
                myobj.DATA   = collection["DATA"].ToIntOrZero();
                myobj.TEXT   = collection["TEXT"].ToString();
                myobj.CODE   = collection["CODE"];
                myobj.GHICHU = collection["GHICHU"].ToString();
                myobj.COLOR  = collection["COLOR"].ToString();
                myobj.DEPTID = collection["DEPTID"].ToIntOrNULL();
                if (filebase != null && filebase.FirstOrDefault() != null)
                {
                    FileUltilities file = new FileUltilities();
                    TAILIEUDINHKEMBusiness = Get <TAILIEUDINHKEMBusiness>();
                    List <TAILIEUDINHKEM> ListTaiLieu = TAILIEUDINHKEMBusiness.GetDataByItemID(myobj.ID, LOAITAILIEU.MST_DIVISION);
                    foreach (var item in ListTaiLieu)
                    {
                        file.RemoveFile(UPLOADFOLDER + "/" + item.DUONGDAN_FILE);
                        TAILIEUDINHKEMBusiness.repository.Delete(item.TAILIEU_ID);
                    }
                    TAILIEUDINHKEMBusiness.Save();
                    if (filename == null)
                    {
                        filename = new string[filebase.Count()];
                    }
                    UploadFileTool tool     = new UploadFileTool();
                    List <string>  FileName = new List <string>();
                    List <string>  FilePath = new List <string>();
                    List <long>    FileId   = new List <long>();
                    tool.UploadCustomFileAndOutPath(filebase, false, MstDivisionExtension, UPLOADFOLDER,
                                                    int.Parse(MstDivisionSize), FOLDER_ID, filename, myobj.ID,
                                                    out FilePath, out FileName, out FileName, out FileId, LOAITAILIEU.MST_DIVISION,
                                                    "Danh mục dùng chung");
                    if (FilePath.Any())
                    {
                        myobj.ICON = FilePath[0];
                    }
                }
                DM_DANHMUC_DATABusiness.Save(myobj);
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = "Không cập nhật được";
            }
            return(Json(result));
        }
Esempio n. 2
0
        public JsonResult SaveVanBan(FormCollection form, List <HttpPostedFileBase> filebase, string[] FOLDER_ID, string[] filename)
        {
            QuanLyVanBanBusiness   = Get <QuanLyVanBanBusiness>();
            TaiLieuDinhKemBusiness = Get <TAILIEUDINHKEMBusiness>();

            var    SaveVanBan = new QUANLY_VANBAN();
            string title      = "Thêm mới văn bản thành công";

            if (!string.IsNullOrEmpty(form["ID"]) && Convert.ToInt32(form["ID"]) > 0)
            {
                SaveVanBan = QuanLyVanBanBusiness.Find(Convert.ToInt32(form["ID"]));
                title      = "Cập nhật văn bản thành công";
            }
            SaveVanBan.COQUAN_BANHANH_ID = form["COQUAN_BANHANH_ID"].ToIntOrNULL();
            SaveVanBan.DOMAT_ID          = form["DOMAT_ID"].ToIntOrNULL();
            SaveVanBan.GHICHU            = form["GHICHU"];
            SaveVanBan.HOSO_ID           = form["HOSO_ID"].ToIntOrNULL();
            SaveVanBan.LINHVUC_ID        = form["LINHVUC_ID"].ToIntOrNULL();
            SaveVanBan.LOAI_VANBAN_ID    = form["LOAI_VANBAN_ID"].ToIntOrNULL();
            SaveVanBan.MUCDO_TRUYCAP     = form["MUCDO_TRUYCAP"].ToIntOrNULL();
            SaveVanBan.NGAYBANHANH       = form["NGAYBANHANH"].ToDateTime();
            SaveVanBan.NGONNGU_ID        = form["NGONNGU_ID"].ToIntOrNULL();
            SaveVanBan.SO_KYHIEU         = form["SO_KYHIEU"];
            SaveVanBan.TIEUDE            = form["TIEUDE"];
            SaveVanBan.TINHTRANG_VATLY   = form["TINHTRANG_VATLY"].ToIntOrNULL();
            SaveVanBan.TOSO            = form["TOSO"].ToIntOrNULL();
            SaveVanBan.TRICHYEU_VANBAN = form["TRICHYEU_VANBAN"];
            QuanLyVanBanBusiness.Save(SaveVanBan);
            //Lưu file đính kèm
            if (filebase != null && filebase.Count() > 0)
            {
                if (!string.IsNullOrEmpty(form["ID"]) && Convert.ToInt32(form["ID"]) > 0 && filebase[0] != null)
                {
                    #region Xóa tài liệu đi kèm

                    List <TAILIEUDINHKEM> ListTaiLieu = TaiLieuDinhKemBusiness.GetDataByItemID(SaveVanBan.ID, LOAITAILIEU.VANBAN);
                    FileUltilities        file        = new FileUltilities();
                    foreach (var item in ListTaiLieu)
                    {
                        file.RemoveFile(URLPath + "\\" + item.DUONGDAN_FILE);
                        TaiLieuDinhKemBusiness.Delete(item.TAILIEU_ID);
                    }
                    TaiLieuDinhKemBusiness.Save();

                    #endregion Xóa tài liệu đi kèm
                }
                UploadFileTool tool   = new UploadFileTool();
                var            exited = tool.UploadCustomFile(filebase, true, FileAllowUpload, URLPath, MaxFileSizeUpload.ToIntOrZero(), FOLDER_ID, filename, SaveVanBan.ID, LOAITAILIEU.VANBAN, "Văn Bản");
            }
            return(Json(new { VanBan = QuanLyVanBanBusiness.GetByHoSo(SaveVanBan.HOSO_ID), message = title }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public JsonResult DeleteHoSo(long id)
        {
            QuanLyHoSoBusiness     = Get <QuanLyHoSoBusiness>();
            QuanLyVanBanBusiness   = Get <QuanLyVanBanBusiness>();
            TaiLieuDinhKemBusiness = Get <TAILIEUDINHKEMBusiness>();
            QUANLY_HOSO HoSo = QuanLyHoSoBusiness.Find(id);

            if (HoSo == null)
            {
                return(Json(new { Type = "ERROR", Message = "Không tìm thấy hồ sơ cần xóa" }));
            }

            #region Xóa các văn bản đi kèm

            List <QUANLY_VANBAN> ListVanBan = QuanLyVanBanBusiness.GetData(id);
            foreach (var item in ListVanBan)
            {
                QuanLyVanBanBusiness.Delete(item.ID);
            }
            QuanLyVanBanBusiness.Save();

            #endregion Xóa các văn bản đi kèm

            #region Xóa tài liệu đi kèm

            List <TAILIEUDINHKEM> ListTaiLieu = TaiLieuDinhKemBusiness.GetDataByItemID(id, LOAITAILIEU.QUANLY_HOSO);
            ListTaiLieu.AddRange(TaiLieuDinhKemBusiness.GetDataByItemID(ListVanBan.Select(x => x.ID).ToList(), LOAITAILIEU.QUANLY_VANBAN));
            FileUltilities file = new FileUltilities();
            foreach (var item in ListTaiLieu)
            {
                file.RemoveFile(UrlPath + "\\" + item.DUONGDAN_FILE);
                TaiLieuDinhKemBusiness.Delete(item.TAILIEU_ID);
            }
            TaiLieuDinhKemBusiness.Save();

            #endregion Xóa tài liệu đi kèm

            #region Xóa người nhận

            QuanLyHoSoNguoiNhapBusiness = Get <QuanLyHoSoNguoiNhapBusiness>();
            QuanLyHoSoNguoiNhapBusiness.DeleteByHoSo(id);
            QuanLyHoSoNguoiNhapBusiness.Save();

            #endregion Xóa người nhận

            QuanLyHoSoBusiness.Delete(id);
            QuanLyHoSoBusiness.Save();
            return(Json(new { Status = true, Message = "Xóa hồ sơ thành công" }));
        }
Esempio n. 4
0
        public JsonResult Delete(long id)
        {
            HSCV_VANBANDENBusiness = Get <HSCV_VANBANDENBusiness>();
            HSCV_VANBANDEN VanBan = HSCV_VANBANDENBusiness.Find(id);

            AssignUserInfo();
            if (VanBan == null || currentUser.ID != VanBan.NGUOITAO)
            {
                return(Json(new { Type = "ERROR", Message = "Không tìm thấy văn bản phát hành cần xóa" }));
            }
            TAILIEUDINHKEMBusiness = Get <TAILIEUDINHKEMBusiness>();
            FileUltilities        file        = new FileUltilities();
            List <TAILIEUDINHKEM> ListTaiLieu = TAILIEUDINHKEMBusiness.GetDataByItemID(id, LOAITAILIEU.VANBANDEN);

            foreach (var item in ListTaiLieu)
            {
                TAILIEUDINHKEMBusiness.repository.Delete(item.TAILIEU_ID);
                file.RemoveFile(URL_FOLDER + item.DUONGDAN_FILE);
                if (!string.IsNullOrEmpty(item.PDF_VERSION))
                {
                    file.RemoveFile(URL_FOLDER + item.PDF_VERSION);
                }
            }
            THUMUC_LUUTRUBusiness = Get <THUMUC_LUUTRUBusiness>();
            THUMUC_LUUTRU ThuMuc = THUMUC_LUUTRUBusiness.GetDataByNam(id.ToString(), ThuMucLuuTruConstant.DefaultVbDen);

            if (ThuMuc != null)
            {
                ThuMuc.IS_DELETE = true;
                THUMUC_LUUTRUBusiness.Save(ThuMuc);
            }
            TAILIEUDINHKEMBusiness.Save();
            HSCV_VANBANDENBusiness.repository.Delete(id);
            HSCV_VANBANDENBusiness.Save();
            #region Xóa đơn vị nhận văn bản
            HSCV_VANBANDEN_DONVINHANBusiness = Get <HSCV_VANBANDEN_DONVINHANBusiness>();
            var ListDonVi = HSCV_VANBANDEN_DONVINHANBusiness.GetData(id);
            if (ListDonVi.Any())
            {
                foreach (var item in ListDonVi)
                {
                    HSCV_VANBANDEN_DONVINHANBusiness.repository.Delete(item.ID);
                }
                HSCV_VANBANDEN_DONVINHANBusiness.Save();
            }
            #endregion
            return(Json(new { Type = "SUCCESS", Message = "Xóa văn bản phát hành thành công" }));
        }
 public JsonResult DeleteVanBan(long?id = 0)
 {
     QuanLyVanBanBusiness   = Get <QuanLyVanBanBusiness>();
     TaiLieuDinhKemBusiness = Get <TAILIEUDINHKEMBusiness>();
     QuanLyVanBanBusiness.Delete(id);
     QuanLyVanBanBusiness.Save();
     #region Xóa tài liệu đi kèm
     List <TAILIEUDINHKEM> ListTaiLieu = TaiLieuDinhKemBusiness.GetDataByItemID(id.Value, LOAITAILIEU.VANBAN);
     FileUltilities        file        = new FileUltilities();
     foreach (var item in ListTaiLieu)
     {
         file.RemoveFile(URLPath + "\\" + item.DUONGDAN_FILE);
         TaiLieuDinhKemBusiness.Delete(item.TAILIEU_ID);
     }
     TaiLieuDinhKemBusiness.Save();
     #endregion
     return(Json(new { message = "Xóa văn bản thành công" }, JsonRequestBehavior.AllowGet));
 }
        public JsonResult Delete(long id)
        {
            hscvVanBanDenBusiness = Get <HSCV_VANBANDENBusiness>();
            HSCV_VANBANDEN entityVanBanDen = hscvVanBanDenBusiness.Find(id);

            AssignUserInfo();
            if (entityVanBanDen == null || currentUser.ID != entityVanBanDen.NGUOITAO)
            {
                return(Json(new { Type = "ERROR", Message = "Bạn không có quyền xóa văn bản trình ký này" }));
            }
            attachmentBusiness = Get <TAILIEUDINHKEMBusiness>();
            FileUltilities        file        = new FileUltilities();
            List <TAILIEUDINHKEM> ListTaiLieu = attachmentBusiness.GetDataByItemID(id, LOAITAILIEU.VANBANDEN);

            foreach (var item in ListTaiLieu)
            {
                attachmentBusiness.repository.Delete(item.TAILIEU_ID);
                file.RemoveFile(uploadFolder + item.DUONGDAN_FILE);
                if (!string.IsNullOrEmpty(item.PDF_VERSION))
                {
                    file.RemoveFile(uploadFolder + item.PDF_VERSION);
                }
            }
            storeFolderBusiness = Get <THUMUC_LUUTRUBusiness>();
            THUMUC_LUUTRU ThuMuc = storeFolderBusiness.GetDataByNam(id.ToString(), ThuMucLuuTruConstant.DefaultVanban);

            if (ThuMuc != null)
            {
                ThuMuc.IS_DELETE = true;
                storeFolderBusiness.Save(ThuMuc);
            }
            attachmentBusiness.Save();
            hscvVanBanDenBusiness.repository.Delete(id);
            #region xóa văn bản đến trong elastic

            ElasticSearch.deleteDocument(id.ToString(), ElasticType.VanBanDen);
            #endregion
            return(Json(new { Type = "SUCCESS", Message = "Xóa văn bản đến thành công" }));
        }
Esempio n. 7
0
        public JsonResult SaveKyDuyetVanBan(long id)
        {
            AssignUserInfo();
            HSCV_VANBANDIBusiness = Get <HSCV_VANBANDIBusiness>();
            HSCV_VANBANDI VanBan = HSCV_VANBANDIBusiness.Find(id);

            if (VanBan == null)
            {
                return(Json(new { Type = "ERROR", Message = "Không tìm thấy văn bản trình ký cần ký duyệt" }));
            }
            //Nếu như văn bản cần ký duyệt
            if (true == VanBan.HAS_SIGNED)
            {
                try
                {
                    UploadFileTool tool                   = new UploadFileTool();
                    FileUltilities file                   = new FileUltilities();
                    List <string>  ListExtension          = tool.GetWordExtension();
                    List <string>  ListPdfExtension       = tool.GetPdfExtension();
                    var            TAILIEUDINHKEMBusiness = Get <TAILIEUDINHKEMBusiness>();
                    var            ListTaiLieu            = TAILIEUDINHKEMBusiness.GetDataByItemID(id, LOAITAILIEU.VANBAN);
                    var            ListPdf                = ListTaiLieu.Where(x => !string.IsNullOrEmpty(x.DINHDANG_FILE) && ListPdfExtension.Contains(x.DINHDANG_FILE.ToLower())).ToList();
                    var            ListWord               = ListTaiLieu.Where(x => !string.IsNullOrEmpty(x.DINHDANG_FILE) && ListExtension.Contains(x.DINHDANG_FILE.ToLower())).ToList();
                    var            personalSign           = "";
                    if (currentUser.signpath != null && currentUser.signpath != "")
                    {
                        personalSign = Server.MapPath("~/" + currentUser.signpath);
                    }

                    if (ListWord.Count > 0)
                    {
                        FileUltilities.CreateListWatermark("APPROVED", ListWord, "", personalSign);
                    }

                    if (ListPdf.Count > 0)
                    {
                        FileUltilities.CreateWaterMarkPdf(ListPdf, "APPROVED");
                    }
                }
                catch (Exception ex)
                {
                }
            }
            #region cập nhật wf function done
            var WF_PROCESSBusiness        = Get <WF_PROCESSBusiness>();
            var process                   = WF_PROCESSBusiness.GetProcess(VanBan.ID, MODULE_CONSTANT.VANBANTRINHKY);
            var WF_STATE_FUNCTIONBusiness = Get <WF_STATE_FUNCTIONBusiness>();
            var function                  = WF_STATE_FUNCTIONBusiness.GetStateFunction((int)process.CURRENT_STATE);
            var WF_FUNCTION_DONEBusiness  = Get <WF_FUNCTION_DONEBusiness>();
            var WF_LOGBusiness            = Get <WF_LOGBusiness>();
            var functionDone              = new WF_FUNCTION_DONE();
            functionDone.ITEM_TYPE      = MODULE_CONSTANT.VANBANTRINHKY;
            functionDone.ITEM_ID        = VanBan.ID;
            functionDone.STATE          = process.CURRENT_STATE;
            functionDone.FUNCTION_STATE = function.ID;
            functionDone.create_at      = DateTime.Now;
            AssignUserInfo();
            functionDone.create_by = currentUser.ID;
            WF_FUNCTION_DONEBusiness.Save(functionDone);
            var log = new WF_LOG();
            log.ITEM_ID      = VanBan.ID;
            log.ITEM_TYPE    = MODULE_CONSTANT.VANBANTRINHKY;
            log.MESSAGE      = "<div class='label label-info'>Đã phát hành</div>";
            log.WF_ID        = process.WF_ID;
            log.create_at    = DateTime.Now;
            log.create_by    = currentUser.ID;
            log.NGUOIXULY_ID = currentUser.ID;
            WF_LOGBusiness.Save(log);
            //Ghi nhận luồng đã xử lý xong
            var WF_STATEBusiness = Get <WF_STATEBusiness>();
            var state            = WF_STATEBusiness.Find(process.CURRENT_STATE);
            if (state != null && state.IS_KETTHUC == true)
            {
                process.IS_END = true;
                WF_PROCESSBusiness.Save(process);
            }
            #endregion
            return(Json(new { Type = "SUCCESS", Message = "Ký duyệt văn bản thành công" }));
        }