public object GetData(string userid, string caseId)
        {
            try
            {
                GetDataModel dataModel = new GetDataModel();
                B_OA_Notice en = new B_OA_Notice();
                en.Condition.Add("caseid=" + caseId);
                dataModel.baseInfor_Notice = Utility.Database.QueryObject<B_OA_Notice>(en);
                if (dataModel.baseInfor_Notice == null)
                {
                    //初始化数据
                    IDbTransaction tran = Utility.Database.BeginDbTransaction();
                    var baseInfor_Notice = new B_OA_Notice();
                    baseInfor_Notice.status = "checkUnthrough";
                    baseInfor_Notice.CreaterId = userid;
                    var userInfor = ComClass.GetUserInfo(userid);
                    baseInfor_Notice.CreateMan = userInfor.CnName;
                    baseInfor_Notice.CreateTime = DateTime.Now.ToString();
                    baseInfor_Notice.NewsId = ComClass.GetGuid();
                    baseInfor_Notice.Chk = "0";
                    dataModel.baseInfor_Notice = baseInfor_Notice;

                    Utility.Database.Commit(tran);
                }
                return Utility.JsonResult(true, null, dataModel);
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex);
                throw (new Exception("获取数据失败!", ex));
            }
        }
Пример #2
0
        public string DeleteAticle(string NewsId, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            StringBuilder strSql = new StringBuilder();
            try
            {
                B_OA_Notice notice = new B_OA_Notice();
                notice.Condition.Add("NewsId=" + NewsId);
                notice = Utility.Database.QueryObject<B_OA_Notice>(notice, tran);

                strSql.AppendFormat("delete B_OA_Notice where NewsId in('{0}')", NewsId);
                Utility.Database.ExecuteNonQuery(strSql.ToString(), tran);
                if (!string.IsNullOrEmpty(notice.caseid))
                {
                    //删除相关业务,业务办结不可删除
                    CommonFunctional.DeleteWorkFlowCase(notice.caseid, userid, tran);
                }
                Utility.Database.Commit(tran);
                return Utility.JsonMsg(true, "删除数据成功");
            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex); //写异常日志到本地文件夹
                return Utility.JsonMsg(false, ex.Message); //将对象转为json字符串并返回到客户端
            }
        }
Пример #3
0
        public object GetData(string userid, string caseId)
        {
            try
            {
                GetDataModel dataModel = new GetDataModel();
                B_OA_Notice en = new B_OA_Notice();
                en.Condition.Add("caseid=" + caseId);
                dataModel.baseInfor_Notice = Utility.Database.QueryObject<B_OA_Notice>(en);
                if (dataModel.baseInfor_Notice == null)
                {
                    //初始化数据
                    IDbTransaction tran = Utility.Database.BeginDbTransaction();
                    var baseInfor_Notice = new B_OA_Notice();
                    baseInfor_Notice.status = "0";
                    baseInfor_Notice.CreaterId = userid;
                    var userInfor = ComClass.GetUserInfo(userid);
                    baseInfor_Notice.CreateMan = userInfor.CnName;
                    baseInfor_Notice.CreateTime = DateTime.Now.ToString();
                    baseInfor_Notice.NewsId = ComClass.GetGuid();
                    baseInfor_Notice.Chk = "0";
                    B_OA_FileType fileType = ComDocumentCenterOperate.GetFileTypeByFlayType("4", tran);
                    baseInfor_Notice.documentTypeId = fileType.FileTypeId;
                    baseInfor_Notice.documentTypeName = ComDocumentCenterOperate.getFileTypeNameByFileTypeId(fileType.FileTypeId, tran);
                    dataModel.baseInfor_Notice = baseInfor_Notice;

                    Utility.Database.Commit(tran);
                }
                return  dataModel;
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex);
                throw (new Exception("获取数据失败!", ex));
            }
        }
        //将指定人员查看存入关系表中
        public void InserAppointManSee(B_OA_Notice baseInfor_Notice, IDbTransaction tran)
        {
            string rangeCheckManId = baseInfor_Notice.rangeCheckManId;
            string[] manIdArray = rangeCheckManId.Split(';');
            //删除原数据
            B_OA_Notice_AppointManSee manSee_Delete = new B_OA_Notice_AppointManSee();
            manSee_Delete.Condition.Add("noticeid =" + baseInfor_Notice.NewsId);
            Utility.Database.Delete(manSee_Delete, tran);

            for (var range = 0; range < manIdArray.Length - 1; range++)
            {
                B_OA_Notice_AppointManSee manSee = new B_OA_Notice_AppointManSee();
                manSee.noticeid = baseInfor_Notice.NewsId;
                manSee.userid = manIdArray[range];
                Utility.Database.Insert(manSee, tran);
            }
        }
Пример #5
0
 public string DeleteData(string userid, string id)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();//开始事务并返回一个事务对象
     try
     {
         B_OA_Notice OA_Notice = new B_OA_Notice();
         OA_Notice.Condition.Add("NewsId = " + id);//设置查询条件,条件为当前用户ID
         Utility.Database.Delete(OA_Notice, tran);
         Utility.Database.Commit(tran);
         return Utility.JsonResult(true, "删除成功!");
     }
     catch (Exception ex)
     {
         Utility.Database.Rollback(tran);
         ComBase.Logger(ex);//写日专到本地文件
         return Utility.JsonResult(false, "删除失败:" + ex.Message);
     }
 }
Пример #6
0
 public string GetAddNoticeModel(string userid)
 {
     B_OA_Notice notice = new B_OA_Notice();
     notice.CreaterId = userid;
     var userInfo = ComClass.GetUserInfo(userid);
     notice.CreateMan = userInfo.CnName;
     return Utility.JsonResult(true, "加载成功!", notice); //将对象转为json字符串并返回到客户端
 }
Пример #7
0
 public string GetAddNoticeModel(string userid)
 {
     B_OA_Notice notice = new B_OA_Notice();
     notice.CreaterId = userid;
     var userInfo = ComClass.GetUserInfo(userid);
     notice.CreateMan = userInfo.CnName;
     return JsonConvert.SerializeObject( notice); //将对象转为json字符串并返回到客户端
 }
Пример #8
0
        public string GetPubliceModel(string getTypeName, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            B_OA_Notice noticeModel = new B_OA_Notice();
            noticeModel.CreaterId = userid;
            var userInfo = ComClass.GetUserInfo(userid);
            noticeModel.CreateMan = userInfo.CnName;
            string strSql = "";
            try
            {
                if (getTypeName == "publishNotice")
                {
                    noticeModel.documentTypeName = "全局信息;通知公告;";
                    strSql = "select FileTypeId from B_OA_FileType where FileTypeName='通知公告'";

                }
                else if (getTypeName == "addpublish")
                {
                    noticeModel.documentTypeName = "全局信息;信息发布;";
                    strSql = "select FileTypeId from B_OA_FileType where FileTypeName='信息发布'";
                }
                else if (getTypeName == "bigEvents")
                {
                    noticeModel.documentTypeName = "全局信息;环保大事记;";
                    strSql = "select FileTypeId from B_OA_FileType where FileTypeName='环保大事记'";
                }
                DataSet dataSet = Utility.Database.ExcuteDataSet(strSql, tran);
                DataTable dataTable = dataSet.Tables[0];
                noticeModel.documentTypeId = dataTable.Rows[0][0].ToString();
                Utility.Database.Commit(tran);
                return JsonConvert.SerializeObject( noticeModel);
            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex); //写异常日志到本地文件夹
                return Utility.JsonMsg(false, ex.Message); //将对象转为json字符串并返回到客户端
            }
        }
Пример #9
0
 public object GetNoticeByNoticeId(string noticeId)
 {
     var tran = Utility.Database.BeginDbTransaction();
     B_OA_Notice notice = new B_OA_Notice();
     try
     {
         notice.Condition.Add("NewsId =" + noticeId);
         notice = Utility.Database.QueryObject<B_OA_Notice>(notice, tran);
         Utility.Database.Commit(tran);
         return new
         {
             notice = notice
         };
     }
     catch (Exception ex)
     {
         Utility.Database.Rollback(tran);
         ComBase.Logger(ex); //写异常日志到本地文件夹
         throw (new Exception("获取数据失败!", ex));
     }
 }
Пример #10
0
 /// <summary>
 /// 查找未查看人员
 /// </summary>
 /// <param name="id"></param>
 /// <param name="tran"></param>
 /// <param name="userid"></param>
 /// <param name="listRecord">已查看人员</param>
 /// <returns></returns>
 public DataTable GetHaveUnSeeMan(string id, IDbTransaction tran, string userid,
     List<B_OA_Notice_ReadRecord> listRecord)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Clear();
     B_OA_Notice notice = new B_OA_Notice();
     notice.Condition.Add("NewsId =" + id);
     notice = Utility.Database.QueryObject<B_OA_Notice>(notice, tran);
     DataSet dataSet_UnRead;
     //判断文章的公开类型
     if (notice.publicRange == 1)
     {
         //指定人员查看时,未读部分应该查找指定人员查看表
         strSql.AppendFormat(@"select b.CnName,b.DPID,c.DPName from B_OA_Notice_AppointManSee AS a
                                     LEFT JOIN FX_UserInfo as b ON b.UserID = a.userid
                                     LEFT JOIN FX_Department AS c on b.DPID = c.DPID
                                        where
                                           a.noticeid = '{0}'", id);
         for (var recordCount = 0; recordCount < listRecord.Count; recordCount++)
         {
             string uid = listRecord[recordCount].readId;
             strSql.AppendFormat(@" and a.userid !='{0}'", uid);
         }
         dataSet_UnRead = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
     }
     else
     {
         strSql.AppendFormat(@"select  a.CnName,b.DPName  from FX_UserInfo as a
                                     LEFT JOIN FX_Department AS b on a.DPID = b.DPID
                                     where 1=1");
         for (var recordCount = 0; recordCount < listRecord.Count; recordCount++)
         {
             string uid = listRecord[recordCount].readId;
             strSql.AppendFormat(@" and a.userid !='{0}'", uid);
         }
         dataSet_UnRead = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
     }
     return dataSet_UnRead.Tables[0];
 }
Пример #11
0
        /// <summary>
        /// 保存到文档中心和文档中心审核意见表和文章关系表中
        /// </summary>
        /// <param name="tran"></param>
        /// <param name="caseid"></param>
        /// <param name="userid"></param>
        public void SaveToNotice(IDbTransaction tran, string caseid, string userid)
        {
            StringBuilder strSql = new StringBuilder();
            string DPName = "";//部门名称
            string DPID = "";//部门ID
            string CnName = "";//归档人姓名
            string saveFileName = "";//需要存档的文件夹名称
            string dir = "";
            string UserID = "";
            dir = AppDomain.CurrentDomain.BaseDirectory;//获取应用程序跟目录
            dir = dir.Replace("\\", "/");
            strSql.Clear();
            strSql.AppendFormat(@"select * from FX_AttachMent where CaseID='{0}'", caseid);
            DataSet ds = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
            if (ds.Tables[0].Rows.Count > 0)
            {
                string jsonData = JsonConvert.SerializeObject(ds.Tables[0]);
                List<FX_AttachMent> list_fx = (List<FX_AttachMent>)JsonConvert.DeserializeObject(jsonData, typeof(List<FX_AttachMent>));
                //将文件复制文档中心下的相应目录
                string path = dir + "attachment/documentCenter/";
                if (Directory.Exists(path) == false)//如果不存在就创建文件夹
                {
                    Directory.CreateDirectory(path);
                }

                for (int f = 0; f < list_fx.Count(); f++)
                {
                    string path1 = "";
                    string path2 = "";
                    path1 = dir + "附件目录/" + list_fx[f].FilePath;
                    string fileName = DateTime.Now.ToString("yyyy年MM月dd日HH时mm分ss秒") + "_" + list_fx[f].FileName;
                    path2 = path + fileName;
                    //取出文件并保存到相应目录中
                    File.Copy(path1, path2, true);
                    saveFileName += "attachment/documentCenter/" + fileName;
                    if (f != (list_fx.Count() - 1))
                    {
                        saveFileName += "|";
                    }
                }
            }

            //取出用户相关信息
            var userInfo = ComClass.GetUserInfo(userid);
            DPID = userInfo.DPID;
            CnName = userInfo.CnName;
            UserID = userInfo.UserID;
            //查找部门ID
            FX_Department department = new FX_Department();
            department.Condition.Add("DPID=" + userInfo.DPID);
            FX_Department department_ad = Utility.Database.QueryList<FX_Department>(department, tran)[0];
            DPName = department_ad.DPName;
            //放入的文件类型ID
            B_OA_SendDoc sendDoc = new B_OA_SendDoc();
            sendDoc.Condition.Add("caseid=" + caseid);
            sendDoc = Utility.Database.QueryObject<B_OA_SendDoc>(sendDoc);

            //保存文档
            B_OA_Notice newNotice = new B_OA_Notice();
            //newNotice.NewsTitle = sendDoc.;//文档标题
            newNotice.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//现在时间
            newNotice.NewsTitle = sendDoc.wjbt;
            newNotice.documentTypeId = sendDoc.fwlxId;//文档类型id
            string documentTypeName = getFileTypeNameByFileTypeId(sendDoc.fwlxId, tran);
            newNotice.documentTypeName = documentTypeName;//所选树状图名称,从根节点到子节点
            newNotice.CreateMan = CnName;//创建人
            newNotice.CreaterId = userid;//创建人
            newNotice.AttachmentName = saveFileName;//保存文件路径
            newNotice.ShareAttachment = "0";//是否共享文件
            newNotice.isSeeInDoor = false;//是否在门户中查看
            newNotice.status = "checkThrough";//审核状态
            newNotice.caseid = sendDoc.caseid;
            newNotice.publicRange = 0;//非指定人查看
            newNotice.NewsId = ComClass.GetGuid();
            newNotice.publicRange = 0;//所有人查看
            newNotice.isReadRecord = true;//查看记录
            newNotice.isTextSuggetion = true;//可以发表意见
            newNotice.ChkMId = UserID + ";";
            newNotice.ChkM = CnName + ";";
            newNotice.Chkdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//审核时间

            Utility.Database.Insert<B_OA_Notice>(newNotice, tran);

            //插入审核记录
            //取出审核人ID数组
            string[] checkManId = newNotice.ChkMId.Split(';');
            //插入审核表,用于文章修改后,或者新生成的文章审核
            for (int i = 0; i < checkManId.Length - 1; i++)
            {
                B_OA_Notice_Addvice addvice = new B_OA_Notice_Addvice();
                var user_check = ComClass.GetUserInfo(checkManId[i]);
                //审核人ID
                addvice.chkId = checkManId[i];
                //审核人姓名
                addvice.chkName = user_check.CnName;
                //审核状态为未审核
                addvice.statuType = "checkThrough";
                //审核状态名称
                addvice.statusName = "审核通过";
                //文章表外键
                addvice.noticeId = newNotice.NewsId;
                Utility.Database.Insert(addvice, tran);
            }

            //插入文章关系表
            B_OA_Notice_FileType_R fileType_r = new B_OA_Notice_FileType_R();
            fileType_r.noticeId = newNotice.NewsId;
            fileType_r.fileTypeId = sendDoc.fwlxId;
            Utility.Database.Insert(fileType_r, tran);
            //sendDoc.fwlxId;
        }
Пример #12
0
        public string FilePlaceS(string caseid, string title, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            string DPName = "";//部门名称
            string DPID = "";//部门ID
            string CnName = "";//归档人姓名
            string AttachmentType = "";//归档文件夹ID
            string saveFileName = "";//需要存档的文件夹名称
            string dir = "";
            string UserID = "";
            try
            {
                dir = AppDomain.CurrentDomain.BaseDirectory;//获取应用程序跟目录
                StringBuilder strSql = new StringBuilder();
                strSql.AppendFormat("select * from FX_AttachMent where CaseID='{0}' and FileName like '归档_%'", caseid);
                DataSet ds = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
                string jsonData = JsonConvert.SerializeObject(ds.Tables[0]);
                List<FX_AttachMent> list_fx = (List<FX_AttachMent>)JsonConvert.DeserializeObject(jsonData, typeof(List<FX_AttachMent>));
                if (list_fx.Count == 0)
                {
                    return Utility.JsonResult(false, "没有归档文件,请上传归档文件");
                }
                if (list_fx.Count > 1)
                {
                    return Utility.JsonResult(false, "该文有两份归档文件,无法归档");
                }
                saveFileName = DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒") + list_fx[0].FileName;
                //取出部门id
                var userInfo = ComClass.GetUserInfo(userid);
                DPID = userInfo.DPID;
                CnName = userInfo.CnName;
                UserID = userInfo.UserID;
                //查找部门ID
                FX_Department department = new FX_Department();
                department.Condition.Add("DPID=" + userInfo.DPID);
                FX_Department department_ad = Utility.Database.QueryList<FX_Department>(department, tran)[0];
                DPName = department_ad.DPName;

                //归档文件夹ID
                B_OA_FileType fileType = new B_OA_FileType();
                fileType.Condition.Add("FileTypeName=" + "发文归档");
                List<B_OA_FileType> listFileType = Utility.Database.QueryList<B_OA_FileType>(fileType, tran);
                if (listFileType.Count <= 0)
                {
                    return Utility.JsonResult(false, "文档中心分类中未有“发文归档”文档,请联系管理员添加");
                }
                B_OA_FileType fileType_ad = listFileType[0];
                AttachmentType = fileType_ad.FileTypeId;

                //保存文档
                B_OA_Notice newNotice = new B_OA_Notice();
                newNotice.NewsTitle = title;//文档标题
                newNotice.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//现在时间
                newNotice.documentTypeId = AttachmentType;//文档类型id
                newNotice.CreateMan = CnName; //创建人
                newNotice.CreaterId = userid;//创建人ID
                newNotice.AttachmentName = "attachment/documentCenter/" + saveFileName;//保存文件路径
                newNotice.ShareAttachment = "0";//是否共享文件
                newNotice.Chk = "0";//是否已经审核
                newNotice.ChkM = CnName + ";";//审核人
                newNotice.Chkdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//审核时间
                newNotice.documentTypeName = "办公室;收发文归档;发文归档;";//文件文档分类名
                newNotice.NewsId = ComClass.GetGuid();
                newNotice.publicRange = 0;//所有人查看
                newNotice.isReadRecord = true;//查看记录
                newNotice.isTextSuggetion = true;//可以发表意见
                newNotice.status = "waitCheck";//审核状态待审核
                newNotice.ChkMId = UserID + ";";

                string path = dir + "attachment\\documentCenter\\";
                if (Directory.Exists(path) == false)//如果不存在就创建文件夹
                {
                    Directory.CreateDirectory(path);
                }
                //取出文件并保存到相应目录中
                File.Copy(dir + "附件目录\\" + list_fx[0].FilePath, path + saveFileName, true);

                Utility.Database.Insert<B_OA_Notice>(newNotice, tran);

                //插入审核记录
                //取出审核人ID数组
                string[] checkManId = newNotice.ChkMId.Split(';');
                //插入审核表,用于文章修改后,或者新生成的文章审核
                for (int i = 0; i < checkManId.Length - 1; i++)
                {
                    B_OA_Notice_Addvice addvice = new B_OA_Notice_Addvice();
                    var user_check = ComClass.GetUserInfo(checkManId[i]);
                    //审核人ID
                    addvice.chkId = checkManId[i];
                    //审核人姓名
                    addvice.chkName = user_check.CnName;
                    //审核状态为未审核
                    addvice.statuType = "waitcheck";
                    //审核状态名称
                    addvice.statusName = "待审核";
                    //文章表外键
                    addvice.noticeId = newNotice.NewsId;
                    Utility.Database.Insert(addvice, tran);
                }

                //插入文件夹附件表
                //B_OA_FileList newFileList = new B_OA_FileList();
                //newFileList.NewsId = ComClass.GetGuid();
                //newFileList.FileName = saveFileName;
                //newFileList.RelativePath = "attachment/fileDocument/" + saveFileName;
                //string a = dir.Replace("\\", "/");
                //newFileList.AbsolutePath = a + saveFileName;
                //newFileList.Extension = saveFileName.Split('.')[1];
                //newFileList.FileSize = 0;
                //newFileList.BeforeFileName = list_fx[0].FileName;
                //newFileList.Dept = DPID;
                //Utility.Database.Insert<B_OA_FileList>(newFileList, tran);

                //修改收文的归档状态
                B_OA_SendDoc sendDoc = new B_OA_SendDoc();
                sendDoc.Condition.Add("caseid=" + caseid);
                B_OA_SendDoc sendDoc_ad = Utility.Database.QueryList<B_OA_SendDoc>(sendDoc, tran)[0];
                sendDoc_ad.sfgd = 1;//修改归档状态为已归档
                Utility.Database.Update(sendDoc_ad, tran);

                Utility.Database.Commit(tran);
                return Utility.JsonResult(true, "归档成功,此文档上传的归档附件可在文档中心的“办公室》收发文归档》发文归档”文件夹中看到");
            }
            catch (Exception e)
            {
                Utility.Database.Rollback(tran);
                return Utility.JsonResult(false, "数据加载失败!异常信息: " + e.Message);
            }
        }
        //验证输入的信息
        public string ValiadateInput(B_OA_Notice notice)
        {
            StringBuilder strSql = new StringBuilder();
            if (notice.NewsTitle == "" || notice.NewsTitle == null)
            {
                strSql.Append("\n标题不能为空。");
            }

            if (notice.documentTypeId == "" || notice.documentTypeId == null)
            {
                strSql.Append("\n请选择文件类型,文件类型不能为空。");
            }

            //会议通知
            if (notice.isConferenceInform == true)
            {
                if (notice.conferenceEndDate == "" || notice.conferenceEndDate == null)
                {
                    strSql.Append("\n您勾选了“会议通知”,请选择会议时间。");
                }
            }
            //邮件送达
            if (notice.isSendEmail == true)
            {
                if (notice.sendEmailToManId == "" || notice.sendEmailToManId == null)
                {
                    strSql.Append("\n您勾选了“邮件送达”,请选择收件人。");
                }
            }
            //指定发布范围
            if (notice.publicRange == 1)
            {
                if (notice.rangeCheckManId == "" || notice.rangeCheckManId == null)
                {
                    strSql.Append("\n您选择了指定了发布范围,请选择指定人员。");
                }
            }
            return strSql.ToString();
        }
 //邮件送达
 public void SendEmail(B_OA_Notice notice , IDbTransaction tran,string userid)
 {
     //邮件送达
     if (notice.isSendEmail == true)
     {
         string Mail_Id = ComClass.GetGuid();
         //保存已发送
         B_Email email = new B_Email();
         email.Mail_ID = Mail_Id;
         email.Mail_CreateData = DateTime.Now.ToString();//发送时间
         email.ID = Mail_Id;// +"_" + DateTime.Now.ToLocalTime().ToString();/ID主键
         email.Mail_SendPersonId = userid;//发件人ID
         var userInfor = ComClass.GetUserInfo(userid);
         email.Mail_SendPersonName = userInfor.CnName;//发件人姓名
         email.Mail_Deleted = "0";//是否已删除
         email.Mail_deletedPerson = "";//删除人
         email.Mail_Type = "1";//类型,0 未发送,草稿,1已发送
         email.MailDocumentType = "fajian";//的文件夹分类 默认是0收件箱
         email.Mail_IsSee = "0";//是否已被查看
         email.markId = "";//标签id
         email.markName = "";//标签名称
         email.markColor = "";//标签颜色
         email.whosEmailId = userid;//邮件拥有者
         email.Mail_SendDate = DateTime.Now.ToString();//发送时间
         email.emailRecieveDate = DateTime.Now.ToString();//接收事件
         email.isSaveSendBox = true;//保存发件
         email.Mail_ReceivePersonId = notice.sendEmailToManId;//接收人ID
         email.Mail_ReceivePersonName = notice.sendEmailToManName;//接收人名称
         email.isImportant = true;//重要邮件
         email.Mail_Title = "(来自文档中心)" + notice.NewsTitle;//标题
         email.Mail_SendAttachment = notice.ShareAttachment;//附件
         email.Mail_SendText = notice.NewsText;//内容
         Utility.Database.Insert<B_Email>(email, tran);
         //保存给发送方
         string[] sendIdArray = email.Mail_ReceivePersonId.Split(';');
         for (int i = 0; i < sendIdArray.Length - 1; i++)
         {
             B_Email sendEmail = new B_Email();
             sendEmail.ID = email.ID + sendIdArray[i];//主键
             sendEmail.Mail_ID = email.Mail_ID;//关联ID
             sendEmail.Mail_Title = email.Mail_Title;//主题
             sendEmail.Mail_SendText = email.Mail_SendText;//发送内容
             sendEmail.Mail_SendPersonId = email.Mail_SendPersonId;//发件人ID
             var sendUserInfor = ComClass.GetUserInfo(sendEmail.Mail_SendPersonId);
             sendEmail.Mail_SendPersonName = sendUserInfor.CnName;//发件人姓名
             sendEmail.Mail_SendDate = email.Mail_SendDate;//发送时间
             sendEmail.Mail_ReceivePersonId = sendIdArray[i];//接收人ID
             sendEmail.Mail_ReceivePersonName = email.Mail_ReceivePersonName;
             sendEmail.Mail_SendAttachment = email.Mail_SendAttachment;//附件
             sendEmail.Mail_Deleted = "0";//是否删除0为未删除
             sendEmail.Mail_Type = "1";//邮件类别(1已发送0草稿)
             sendEmail.Mail_CreateData = DateTime.Now.ToString();//创建时间
             sendEmail.Mail_IsSee = "0";//是否已读0未读1已读
             sendEmail.MailDocumentType = "shoujian";//电子邮件文件夹类型
             // sendEmail.isSaveSendBox = email.isSaveSendBox;//是否保存到发件箱
             sendEmail.isImportant = email.isImportant;//是否是重要的邮件
             sendEmail.isReadReceipt = email.isReadReceipt;//是否发送查看回执1发送回执0不回执
             sendEmail.haveAttachment = email.haveAttachment;//是否有附件
             sendEmail.CCId = email.CCId;//抄送人
             sendEmail.CCName = email.CCName;//抄送人姓名
             sendEmail.emailRecieveDate = DateTime.Now.ToString();//收件时间
             sendEmail.markId = "";//标记ID
             sendEmail.markName = "";//标记名称
             sendEmail.markColor = "";//标记颜色
             sendEmail.whosEmailId = sendIdArray[i]; //邮件拥有者
             Utility.Database.Insert<B_Email>(sendEmail, tran);
         }
     }
 }
        //保存到关系表中
        public void SaveFileType_R(B_OA_Notice notice, IDbTransaction tran)
        {
            //删除文章与目录关系表
            B_OA_Notice_FileType_R del_nf_R = new B_OA_Notice_FileType_R();
            del_nf_R.Condition.Add("noticeId = " + notice.NewsId);
            Utility.Database.Delete(del_nf_R, tran);
            //保存关系表
            string[] documenTypeArray = notice.documentTypeId.Split('/');
            for (int k = 0; k < documenTypeArray.Length; k++)
            {
                B_OA_Notice_FileType_R nf_R = new B_OA_Notice_FileType_R();
                nf_R.noticeId = notice.NewsId;
                nf_R.fileTypeId = documenTypeArray[k];

                Utility.Database.Insert(nf_R, tran);
            }
        }
Пример #16
0
        public bool DeleteCase(string caseid, string userid, Object obj)
        {
            IDbTransaction tran = (IDbTransaction)obj;
            //加入针对不同的业务的删除前处理
            FX_WorkFlowCase workFlow = new FX_WorkFlowCase();
            workFlow.Condition.Add("ID =" + caseid);
            workFlow = Utility.Database.QueryObject<FX_WorkFlowCase>(workFlow, tran);
            if (workFlow != null)
            {
                string flowId = workFlow.FlowID;
                switch (flowId)
                {
                    case "W000098": //发文
                        B_OA_SendDoc_QuZhan sendDoc = new B_OA_SendDoc_QuZhan();
                        sendDoc.Condition.Add("caseid=" + caseid);
                        Utility.Database.Delete(sendDoc, tran);
                        break;
                    case "W000099": //收文
                        B_OA_ReceiveDoc_QuZhan receiveDoc = new B_OA_ReceiveDoc_QuZhan();
                        receiveDoc.Condition.Add("caseid=" + caseid);
                        Utility.Database.Delete(receiveDoc, tran);
                        break;
                    case "W000100": //内部事项
                        B_OA_SendDoc_Inner_QuZhan innderDoc = new B_OA_SendDoc_Inner_QuZhan();
                        innderDoc.Condition.Add("caseId=" + caseid);
                        Utility.Database.Delete(innderDoc, tran);
                        break;
                    case "W000070": //车辆申请
                        B_OA_Car car = new B_OA_Car();
                        car.Condition.Add("workflowcaseid=" + caseid);
                        Utility.Database.Delete(car, tran);
                        break;
                    case "W000071": //会议申请
                        B_OA_Meeting data = new B_OA_Meeting();
                        data.Condition.Add("CaseID=" + caseid);
                        Utility.Database.Delete(data, tran);
                        break;
                    case "W000079": //请假申请
                        B_OA_LeaveList leave = new B_OA_LeaveList();
                        leave.Condition.Add("caseId=" + caseid);
                        Utility.Database.Delete(leave, tran);
                        break;
                    case "W000080": //出差申请
                        B_OA_TravelList travel = new B_OA_TravelList();
                        travel.Condition.Add("caseId=" + caseid);
                        Utility.Database.Delete(travel, tran);
                        break;
                    case "W000089": //通知公告
                        B_OA_Notice notice = new B_OA_Notice();
                        notice.Condition.Add("caseid=" + caseid);
                        Utility.Database.Delete(notice, tran);
                        break;
                }
                if (!string.IsNullOrEmpty(caseid))
                {
                    //删除正文路径
                    B_Common_CreateDoc createDoc = new B_Common_CreateDoc();
                    createDoc.Condition.Add("caseid=" + caseid);
                    Utility.Database.Delete(createDoc, tran);
                    //删除附件
                    FX_AttachMent attach  = new FX_AttachMent();
                    attach.Condition.Add("CaseID="+caseid);
                    Utility.Database.Delete(attach, tran);

                }
            }
            return true;
        }
Пример #17
0
 /// <summary>
 /// 查找未查看人员
 /// </summary>
 /// <param name="id"></param>
 /// <param name="tran"></param>
 /// <param name="userid"></param>
 /// <param name="listRecord">已查看人员</param>
 /// <returns></returns>
 public DataTable GetHaveUnSeeMan(string id, IDbTransaction tran, string userid,
     List<B_OA_Notice_ReadRecord> listRecord)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Clear();
     B_OA_Notice notice = new B_OA_Notice();
     notice.Condition.Add("NewsId =" + id);
     notice = Utility.Database.QueryObject<B_OA_Notice>(notice, tran);
     DataSet dataSet_UnRead;
     //            //判断文章的公开类型
     //            if (notice.publicRange == 1)
     //            {
     //                //指定人员查看时,未读部分应该查找指定人员查看表
     //                strSql.AppendFormat(@"select b.CnName,b.DPID,c.DPName from B_OA_Notice_AppointManSee AS a
     //								            LEFT JOIN FX_UserInfo as b ON b.UserID = a.userid
     //                                            LEFT JOIN FX_Department AS c on b.DPID = c.DPID
     //                                               where
     //                                                  a.noticeid = '{0}'", id);
     //                for (var recordCount = 0; recordCount < listRecord.Count; recordCount++)
     //                {
     //                    string uid = listRecord[recordCount].readId;
     //                    strSql.AppendFormat(@" and a.userid !='{0}'", uid);
     //                }
     //                dataSet_UnRead = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
     //            }
     //            else
     //            {
     var rangeCheckManId = new List<string>();
     if (!string.IsNullOrEmpty(notice.rangeCheckManId))
     {
         rangeCheckManId = notice.rangeCheckManId.Split(';').ToList();
     }
     strSql.AppendFormat(@"select  a.CnName,b.DPName  from FX_UserInfo as a
                                     LEFT JOIN FX_Department AS b on a.DPID = b.DPID
                                     where 1=1 and a.EnName is not null");
     //for (var recordCount = 0; recordCount < listRecord.Count; recordCount++)
     //{
     //    string uid = listRecord[recordCount].readId;
     //    strSql.AppendFormat(@" and a.userid !='{0}'", uid);
     //}
     if (rangeCheckManId.Any())
     {
         strSql.AppendFormat(string.Format(@" and a.userid in ('{0}')", string.Join("','", rangeCheckManId)));
     }
     else
     {
         var readUserIdList = listRecord.Where(i => i.readId != null).Select(i => i.readId).ToList();
         if (readUserIdList.Any())
         {
             strSql.AppendFormat(string.Format(@" and a.userid not in ('{0}')",
                 string.Join("','", readUserIdList)));
         }
     }
     dataSet_UnRead = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
     //}
     return dataSet_UnRead.Tables[0];
 }
Пример #18
0
        public string GetData(string NewsTypeId,string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            try
            {
                //只有待办箱才有设置为已读
               // if (!String.IsNullOrEmpty(baid)) engineAPI.SetIsReaded(caseId, baid, userid);

                var user = ComClass.GetUserInfo(userid);//获取当前用户信息
                GetDataModel data = new GetDataModel();//获取数据模型
                data.baseInfo = new B_OA_Notice();
                data.baseInfo.NewsFromDept = user.DPID;
                B_OA_Notice en = new B_OA_Notice();//声名一个对象
                en.Condition.Add("NewsTypeId = " + NewsTypeId);//设置查询条件
                en.Condition.Add("Creater =" + user.CnName);//设置查询条件
                data.noticeList = Utility.Database.QueryList<B_OA_Notice>(en, tran);//查询,并返回结果。注:该方法已在框架内定义,直接调用即可
                return Utility.JsonResult(true, null, data);//将对象转为json字符串并返回到客户端
            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex);//写异常日志到本地文件夹
                return Utility.JsonResult(false, ex.Message);//将对象转为json字符串并返回到客户端
            }
        }