/// <summary>
        /// 获取审核记录
        /// </summary>
        /// <param name="currentFlowId">当前流程主键</param>
        /// <returns>审核记录</returns>
        public string GetAuditRecord(string currentFlowId)
        {
            string retuanValue = string.Empty;
            // 需要审核的人列表
            string auditList = string.Empty;

            if (!string.IsNullOrEmpty(currentFlowId))
            {
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowHistoryEntity.FieldCurrentFlowId, currentFlowId));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowHistoryEntity.FieldDeletionStateCode, 0));

                DataTable dtAuditRecord = this.GetDataTable(parameters, BaseWorkFlowHistoryEntity.FieldSortCode);
                foreach (DataRow dataRow in dtAuditRecord.Rows)
                {
                    auditList += dataRow[BaseWorkFlowHistoryEntity.FieldToDepartmentName].ToString()
                                 + "["
                                 + dataRow[BaseWorkFlowHistoryEntity.FieldAuditUserRealName].ToString() + " "
                                 + BaseBusinessLogic.GetAuditStatus(dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus].ToString())
                                 + dataRow[BaseWorkFlowHistoryEntity.FieldAuditDate].ToString()
                                 + "] → ";
                }
                auditList = auditList.TrimEnd().TrimEnd('→');
            }
            return(auditList);
        }
        /// <summary>
        /// 绑定屏幕数据
        /// </summary>
        private void BindData()
        {
            this.grdAuditDetail.AutoGenerateColumns = false;
            DataTable dataTable = DotNetService.Instance.WorkFlowCurrentService.GetAuditDetailDT(this.UserInfo, this.CategoryId, this.ObjectId);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus] = BaseBusinessLogic.GetAuditStatus(dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus].ToString());
            }
            this.grdAuditDetail.DataSource = dataTable.DefaultView;
            this.grdAuditDetail.Refresh();
        }
Esempio n. 3
0
 /// <summary>
 /// 绑定屏幕数据
 /// </summary>
 private void BindData()
 {
     this.grdWorkFlowCurrent.AutoGenerateColumns = false;
     foreach (DataRow dataRow in DTWorkFlowCurrent.Rows)
     {
         dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus] = BaseBusinessLogic.GetAuditStatus(dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus].ToString());
     }
     this.DTWorkFlowCurrent.DefaultView.Sort = BaseWorkFlowCurrentEntity.FieldSortCode;
     this.grdWorkFlowCurrent.DataSource      = this.DTWorkFlowCurrent.DefaultView;
     this.grdWorkFlowCurrent.Refresh();
     this.SetControlState();
     if (this.grdWorkFlowCurrent.Rows.Count == 0)
     {
         this.ucWorkFlow.WorkFlowIds = null;
     }
     // 初始化控件状态
     this.ucWorkFlow.SetControlState();
 }
        /// <summary>
        /// 发送即时通讯提醒
        /// </summary>
        /// <param name="workFlowCurrentEntity">当前审核流实体信息</param>
        /// <param name="auditStatus">审核状态</param>
        /// <param name="auditIdea">审核意见</param>
        /// <param name="userIds">发送给用户主键</param>
        /// <param name="roleIds">发送给角色主键</param>
        /// <returns>影响行数</returns>
        public virtual int SendRemindMessage(BaseWorkFlowCurrentEntity workFlowCurrentEntity, AuditStatus auditStatus, string[] userIds, string organizeId, string roleId)
        {
            // string currentId, string objectId, string objectFullName
            int returnValue = 0;

            // 不用给自己发消息了,消息多了也烦恼
            userIds = StringUtil.Remove(userIds, this.UserInfo.Id);
            // BaseUserEntity userEntity = userManager.GetEntity(userId);
            // 发送请求审核的信息
            BaseMessageEntity messageEntity = new BaseMessageEntity();

            messageEntity.Id = BaseBusinessLogic.NewGuid();
            // 这里是回调的类,用反射要回调的
            messageEntity.FunctionCode = MessageFunction.Remind.ToString();
            // messageEntity.FunctionCode = this.GetType().ToString();
            messageEntity.ObjectId = workFlowCurrentEntity.ObjectId;
            // 这里是网页上的显示地址
            // messageEntity.Title = this.GetUrl(id);
            string auditIdea = string.Empty;

            if (!string.IsNullOrEmpty(workFlowCurrentEntity.AuditIdea))
            {
                auditIdea = " 批示: " + workFlowCurrentEntity.AuditIdea;
            }
            // messageEntity.Contents = userEntity.DepartmentName + " " + userEntity.RealName
            messageEntity.Contents
                = workFlowCurrentEntity.CreateBy + " 发出审批申请: " + "<a title='点击这里,直接查看单据' target='_blank' href='" + this.GetUrl(workFlowCurrentEntity.Id) + "'>" + workFlowCurrentEntity.ObjectFullName + "</a> "
                  + Environment.NewLine
                  + this.UserInfo.RealName + " " + BaseBusinessLogic.GetAuditStatus(auditStatus) + " "
                  + Environment.NewLine
                  + auditIdea;

            messageEntity.Contents          = "有单据" + BaseBusinessLogic.GetAuditStatus(auditStatus);
            messageEntity.IsNew             = 1;
            messageEntity.ReadCount         = 0;
            messageEntity.Enabled           = 1;
            messageEntity.DeletionStateCode = 0;
            BaseMessageManager messageManager = new BaseMessageManager(this.UserInfo);

            returnValue = messageManager.BatchSend(userIds, organizeId, roleId, messageEntity, false);
            return(returnValue);
        }
        private void GetSearchList(int recordCount)
        {
            // 获取分页数据
            // this.DTWorkFlowCurrent = DotNetService.Instance.WorkFlowCurrentService.GetMonitorPagedDT(this.UserInfo, pager.PageSize, pager.PageIndex, out recordCount, billCategory, searchValue);
            foreach (DataRow dataRow in DTWorkFlowCurrent.Rows)
            {
                dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus] = BaseBusinessLogic.GetAuditStatus(dataRow[BaseWorkFlowHistoryEntity.FieldAuditStatus].ToString());
            }
            pager.RecordCount = recordCount;
            pager.InitPageInfo();

            // 绑定屏幕数据
            this.grdAuditDetail.AutoGenerateColumns = false;
            this.grdAuditDetail.DataSource          = this.DTWorkFlowCurrent.DefaultView;
            this.grdAuditDetail.Refresh();
            if (this.CurrentEntityId.Length > 0)
            {
                this.grdAuditDetail.FirstDisplayedScrollingRowIndex = BaseInterfaceLogic.GetRowIndex(this.DTWorkFlowCurrent, BaseStaffEntity.FieldId, this.CurrentEntityId);
            }
            this.SetControlState();
        }
        /// <summary>
        /// 发送即时通讯提醒
        /// </summary>
        /// <param name="workFlowCurrentEntity">当前审核流实体信息</param>
        /// <param name="auditStatus">审核状态</param>
        /// <param name="auditIdea">审核意见</param>
        /// <param name="userIds">发送给用户主键</param>
        /// <param name="roleIds">发送给角色主键</param>
        /// <returns>影响行数</returns>
        public virtual int SendMessage(BaseWorkFlowCurrentEntity workFlowCurrentEntity, AuditStatus auditStatus, string[] userIds, string organizeId, string roleId)
        {
            // 这里是考虑了,同时发给多个人的情况
            List <string> userList = new List <string>();

            foreach (var userid in userIds)
            {
                if (!string.IsNullOrEmpty(userid))
                {
                    if (userid.IndexOf(',') > 0)
                    {
                        string[] users = userid.Split(',').Distinct <string>().Where(t => !string.IsNullOrEmpty(t)).ToArray();
                        foreach (var id in users)
                        {
                            if (!string.IsNullOrEmpty(id))
                            {
                                userList.Add(id);
                            }
                        }
                    }
                    else
                    {
                        userList.Add(userid);
                    }
                }
            }
            userIds = userList.ToArray();
            // string currentId, string objectId, string objectFullName
            int result = 0;

            // 不用给自己发消息了,消息多了也烦恼
            userIds = StringUtil.Remove(userIds, this.UserInfo.Id);
            // BaseUserEntity userEntity = userManager.GetObject(userId);
            // 发送请求审核的信息
            BaseMessageEntity messageEntity = new BaseMessageEntity();

            //messageEntity.Id = BaseBusinessLogic.NewGuid();
            // 这里是回调的类,用反射要回调的
            messageEntity.FunctionCode = MessageFunction.Remind.ToString();
            // messageEntity.FunctionCode = this.GetType().ToString();
            messageEntity.ObjectId = workFlowCurrentEntity.ObjectId;
            // 这里是网页上的显示地址
            // messageEntity.Title = this.GetUrl(id);
            string auditIdea = string.Empty;

            if (!string.IsNullOrEmpty(workFlowCurrentEntity.AuditIdea))
            {
                auditIdea = " 批示: " + workFlowCurrentEntity.AuditIdea;
            }
            // messageEntity.Contents = userEntity.DepartmentName + " " + userEntity.RealName
            if (!BaseSystemInfo.SimpleReminders)
            {
                messageEntity.Contents
                    = workFlowCurrentEntity.CreateBy + " 发出审批申请: " + "<a title='点击这里,直接查看单据' target='_blank' href='" + this.GetUrl(workFlowCurrentEntity.Id) + "'>" + workFlowCurrentEntity.ObjectFullName + "</a> "
                      + Environment.NewLine
                      + this.UserInfo.RealName + " " + BaseBusinessLogic.GetAuditStatus(auditStatus) + " "
                      + Environment.NewLine
                      + auditIdea;
            }
            else
            {
                messageEntity.Contents = "有单据" + BaseBusinessLogic.GetAuditStatus(auditStatus);
            }
            messageEntity.IsNew             = 1;
            messageEntity.ReadCount         = 0;
            messageEntity.DeletionStateCode = 0;
            BaseMessageManager messageManager = new BaseMessageManager(this.UserInfo);

            messageManager.Identity = true;
            result = messageManager.BatchSend(userIds, organizeId, roleId, messageEntity, false);
            return(result);
        }
Esempio n. 7
0
        /// <summary>
        /// 发送邮件提醒
        /// </summary>
        /// <param name="workFlowCurrentEntity">当前审核流实体信息</param>
        /// <param name="auditStatus">审核状态</param>
        /// <param name="auditIdea">审核意见</param>
        /// <param name="userIds">发送给用户主键</param>
        /// <param name="roleIds">发送给角色主键</param>
        /// <returns>影响行数</returns>
        public virtual int SendMail(BaseWorkFlowCurrentEntity workFlowCurrentEntity, AuditStatus auditStatus, string[] userIds, string organizeId, string roleId)
        {
            int result = 0;

            // 这里是检查邮件服务器是否设置了,若没设置就没必要发送邮件了
            if (string.IsNullOrEmpty(BaseSystemInfo.MailServer) ||
                string.IsNullOrEmpty(BaseSystemInfo.MailUserName) ||
                string.IsNullOrEmpty(BaseSystemInfo.MailPassword))
            {
                return(result);
            }

            // 这里是考虑了,同时发给多个人的情况
            List <string> userList = new List <string>();

            foreach (var userid in userIds)
            {
                if (!string.IsNullOrEmpty(userid))
                {
                    if (userid.IndexOf(',') > 0)
                    {
                        string[] users = userid.Split(',').Distinct <string>().Where(t => !string.IsNullOrEmpty(t)).ToArray();
                        foreach (var id in users)
                        {
                            if (!string.IsNullOrEmpty(id))
                            {
                                userList.Add(id);
                            }
                        }
                    }
                    else
                    {
                        userList.Add(userid);
                    }
                }
            }
            userIds = userList.ToArray();
            // 不用给自己发消息了,消息多了也烦恼
            userIds = StringUtil.Remove(userIds, this.UserInfo.Id);

            string mailTitle = workFlowCurrentEntity.ActivityFullName + " " + workFlowCurrentEntity.ObjectFullName + " " + workFlowCurrentEntity.AuditStatusName;
            // 邮件内容
            SmtpClient smtpClient = new SmtpClient(BaseSystemInfo.MailServer);

            smtpClient.UseDefaultCredentials = false;
            smtpClient.Credentials           = new NetworkCredential(BaseSystemInfo.MailUserName, BaseSystemInfo.MailPassword);
            // 指定如何处理待发的邮件
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

            string mailBody  = string.Empty;
            string auditIdea = string.Empty;

            if (!string.IsNullOrEmpty(workFlowCurrentEntity.AuditIdea))
            {
                auditIdea = " 批示: " + workFlowCurrentEntity.AuditIdea;
            }
            if (BaseSystemInfo.SimpleReminders)
            {
                mailBody = "有单据" + BaseBusinessLogic.GetAuditStatus(auditStatus);
            }
            else
            {
                mailBody = workFlowCurrentEntity.CreateBy + " 发出审批申请: " + "<a title='点击这里,直接查看单据' target='_blank' href='" + this.GetUrl(workFlowCurrentEntity.Id) + "'>" + workFlowCurrentEntity.ObjectFullName + "</a> "
                           + Environment.NewLine
                           + this.UserInfo.RealName + " " + BaseBusinessLogic.GetAuditStatus(auditStatus) + " "
                           + Environment.NewLine
                           + auditIdea;
            }

            for (int i = 0; i < userIds.Length; i++)
            {
                string mailTo = BaseUserContactManager.GetEmailByCache(userIds[i]);
                if (!string.IsNullOrEmpty(mailTo))
                {
                    try
                    {
                        MailMessage mailMessage = new MailMessage(BaseSystemInfo.MailUserName, mailTo, mailTitle, mailBody);
                        mailMessage.BodyEncoding = Encoding.Default;
                        mailMessage.IsBodyHtml   = true;
                        smtpClient.Send(mailMessage);
                        result++;
                    }
                    catch
                    {
                    }
                }
            }

            return(result);
        }