Exemplo n.º 1
0
        public void CallCustomFlowTrigger(T_FLOW_CUSTOMFLOWDEFINE define)
        {
            string strResult = CallWcf(define);//Call 服务
            if (!string.IsNullOrEmpty(strResult))//判断是否返回内容
            {
                try
                {
                    string NewFormID = string.Empty;
                    DataRow DRNewTrigger = null;
                    DataTable sourceTable = new DataTable();
                    if (ApplicationValueToDataTable(strResult, ref sourceTable, ref NewFormID, ref DRNewTrigger))
                    {

                        string strUser = SMT.Workflow.Engine.BLL.Utility.ReceiveUser(define.RECEIVEUSER);
                        TaskCache.TaskCacheReflesh(strUser);
                        EngineServicesDAL dal = new EngineServicesDAL();
                        dal.SendTriggerMsg(sourceTable, NewFormID, define, strUser);//发送消息
                    }
                }
                catch (Exception ex)
                {
                    string cMessage = "CallCustomFlowTrigger:" + strResult;
                    Tracer.Debug(cMessage + ex.Message);
                }
            }
        }
Exemplo n.º 2
0
 public void NotesSend(List<ReceiveUserAndContent> List, string SystemCode, string strFormID)
 {
     if (List != null)
     {
         EngineServicesDAL dal = new EngineServicesDAL();
         foreach (ReceiveUserAndContent entity in List)
         {
             dal.SendTriggerMsg(entity.ReceiveUser, SystemCode, strFormID, entity.Content);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 引擎直接发消息
        /// </summary>
        /// <param name="UserAndForm"></param>
        /// <param name="SystemCode"></param>
        /// <param name="Content"></param>
        public void ApplicationNotesTrigger(List<CustomUserMsg> UserAndForm, string SystemCode, string Content)
        {
            if (UserAndForm.Count > 0)
            {
                try
                {
                    EngineServicesDAL dal = new EngineServicesDAL();
                    foreach (CustomUserMsg custom in UserAndForm)
                    {
                        dal.SendTriggerMsg(custom.UserID, SystemCode, custom.FormID, Content);
                    }

                }
                catch (Exception e)
                {
                    string cMessage = "ApplicationNotesTrigger出现异常" + "\r\n" +
                                      "SystemCode:" + SystemCode + "\r\n" +
                                      "Content:" + Content + "\r\n" +
                                      "异常信息:" + e.Message + "\r\n" +
                                      "异常来源:" + e.Source;
                    Tracer.Debug("ApplicationMsgTrigger" + cMessage);
                }

            }
        }
Exemplo n.º 4
0
        public void AddDoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType)
        {
            try
            {
                Tracer.Debug("传入参数:companyID||" + companyID + "||orderID:" + orderID + "||modelCode:" + modelCode + "||strXML:" + strXML);
                EngineServicesDAL dal = new EngineServicesDAL();
                T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(systemCode, modelCode, companyID, 0).FirstOrDefault();
                if (MsgBodyDefine == null)
                {
                    Tracer.Debug("EngineServicesBLL.AddDoDask()没有查询到默认消息:modelCode||" + modelCode + "||systemCode" + systemCode + "||companyID" + companyID);
                    return;
                }
                DataTable dtValue = Common.EncrytXmlToDataTable(strXML);
                string Content = MsgBodyDefine.MESSAGEBODY;
                string Url = MsgBodyDefine.MESSAGEURL;
                Tracer.Debug("查询到的URL:" + Url);
                Content = Content.Replace("new:", "");
                Common.ReplaceValue(ref Content, ref Url, dtValue);
                Tracer.Debug("替换后的URL:" + Url);
                //T_WF_DOTASK dask = new T_WF_DOTASK();
                if (MsgBodyDefine.RECEIVETYPE == 1 && MsgBodyDefine.RECEIVERUSERID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVERUSERID.Split(',').Length; i++)
                    {

                        if (MsgType.Task == msgType)//代办任务
                        {
                            TaskCache.TaskCacheReflesh(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            dal.ClosedDoTaskStatus(systemCode, orderID, MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            Tracer.Debug("开始进行保存时的URL:" + Url);
                            dal.SendTriggerTaskMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                        }
                        else if (MsgType.Msg == msgType)
                        {
                            dal.SendTriggerMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, orderID, Content);
                        }

                    }
                }
                else if (MsgBodyDefine.RECEIVETYPE == 0 && MsgBodyDefine.RECEIVEPOSTID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVEPOSTID.Split(',').Length; i++)
                    {

                        PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                        Tracer.Debug("岗位:" + MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                        if (!string.IsNullOrEmpty(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]))
                        {
                            string[] Employees = HRClient.GetEmployeeIDsByPostID(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                            Tracer.Debug("岗位人:" + Employees[0]);
                            if (MsgType.Task == msgType)//代办任务
                            {
                                TaskCache.TaskCacheReflesh(Employees[0]);
                                dal.ClosedDoTaskStatus(systemCode, orderID, Employees[0]);
                                Tracer.Debug("开始进行保存时的URL:" + Url);
                                dal.SendTriggerTaskMsg(Employees[0], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                            }
                            else if (MsgType.Msg == msgType)
                            {
                                dal.SendTriggerMsg(Employees[0], systemCode, orderID, Content);
                            }
                        }

                    }
                }

            }
            catch (Exception ex)
            {
                Tracer.Debug("EngineServicesBLL.AddDoDask()" + ex.Message);
            }
        }
Exemplo n.º 5
0
        public void ApplicationMsgTriggerNew(List<CustomUserMsg> UserAndForm, string companyID, string SystemCode, string ModelCode, string strXml, MsgType msgType)
        {
            string strUserAndForm = string.Empty;
            string cMessage = string.Empty;
            if (UserAndForm.Count > 0)
            {

                try
                {
                    EngineServicesDAL dal = new EngineServicesDAL();
                    T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(SystemCode, ModelCode, companyID, 0).FirstOrDefault();
                    if (MsgBodyDefine != null) //在默认消息中有定义消息
                    {
                        DataTable dtValue = Common.EncrytXmlToDataTable(strXml);
                        string Content = MsgBodyDefine.MESSAGEBODY;
                        string Url = MsgBodyDefine.MESSAGEURL;
                        Content = Content.Replace("new:", "");
                        Common.ReplaceValue(ref Content, ref Url, dtValue);
                        foreach (CustomUserMsg custom in UserAndForm)
                        {
                            strUserAndForm += "FormID:" + custom.FormID + " ReceiveUserID:" + custom.UserID + "\r\n";
                            if (MsgType.Task == msgType)//代办任务
                            {
                                TaskCache.TaskCacheReflesh(custom.UserID);
                                dal.ClosedDoTaskStatus(SystemCode, custom.FormID, custom.UserID);

                                dal.SendTriggerTaskMsg(custom.UserID, SystemCode, ModelCode, custom.FormID, Content, Url, Common.BOObjectEscapeString(strXml), strXml);
                            }
                            else if (MsgType.Msg == msgType)
                            {
                                dal.SendTriggerMsg(custom.UserID, SystemCode, custom.FormID, Content);
                            }
                        }

                    }
                    else
                    {
                        cMessage = "未在消息定义中定义默认数据:ApplicationMsgTriggerNew" + "\r\n" +
                                         "SystemCode:" + SystemCode + "\r\n" +
                                         "ModelCode:" + ModelCode + "\r\n" +
                                         "执行时间:" + DateTime.Now.ToString();
                        Tracer.Debug("ApplicationMsgTriggerNew()" + cMessage);
                    }
                }
                catch (Exception e)
                {
                    cMessage = "ApplicationMsgTriggerNew出现异常" + "\r\n" +
                                     "SystemCode:" + SystemCode + "\r\n" +
                                     "ModelCode:" + ModelCode + "\r\n" +
                                     "业务数据XML:" + strXml + "\r\n" +
                                     "异常信息:" + e.Message + "\r\n" +
                                     "异常来源:" + e.Source;
                    Tracer.Debug("ApplicationMsgTriggerNew()" + cMessage);
                }

            }
            cMessage = "ApplicationMsgTriggerNew被执行调用" + "\r\n" +
                                        "SystemCode:" + SystemCode + "\r\n" +
                                        "ModelCode:" + ModelCode + "\r\n" +
                                        "业务数据XML:" + strXml + "\r\n" +
                                         "UserAndForm Count:" + UserAndForm.Count + "\r\n" +
                                         "UserAndForm:" + strUserAndForm;
            Tracer.Debug("ApplicationMsgTriggerNew" + cMessage);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 新增消息(2013-05-06加入新的方法)
 /// </summary>
 /// <param name="list">UserID|FromID XML</param>
 /// <param name="SystemCode">系统代码</param>
 /// <param name="ModelCode">模块代码</param>
 public void SendTaskMessage(List<CustomUserMsg> list, string SystemCode, string ModelCode)
 {
     try
     {
         EngineServicesDAL dal = new EngineServicesDAL();
         T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(SystemCode, ModelCode, string.Empty, 0).FirstOrDefault();
         if (MsgBodyDefine != null) //在默认消息中有定义消息
         {
             //TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks);
             StringReader strRdr = null;
             foreach (CustomUserMsg item in list)
             {
                 strRdr = new StringReader(item.FormID);
                 XDocument xdoc = XDocument.Load(strRdr);
                 string content = MsgBodyDefine.MESSAGEBODY;
                 Regex reg = new Regex("\\{(.*?)\\}", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                 MatchCollection matchs = reg.Matches(content);
                 foreach (var matitem in matchs)
                 {
                     string field = matitem.ToString().Replace("new:", "").Replace("{", "").Replace("}", "").ToUpper();
                     content = content.Replace(matitem.ToString(), (from ent in xdoc.Descendants("Object").Descendants("Attribute")
                                                                    where ent.Attribute("Name").Value.ToUpper() == field
                                                                    select ent).FirstOrDefault().Attribute("DataValue").Value);
                 }
                 dal.SendTriggerMsg(item.UserID.Split('|')[0], SystemCode, item.UserID.Split('|')[1], content);
             }
             //TimeSpan ts2= new TimeSpan(DateTime.Now.Ticks);
             //TimeSpan ts = ts2.Subtract(ts1).Duration();//计算时间差
             strRdr.Dispose();
         }
         else
         {
             throw new Exception("没有定义默认消息");
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Exemplo n.º 7
0
        public List<UserInfo> ReturnUserInfoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType)
        {
            try
            {
                PersonnelWS.PersonnelServiceClient HRClient = new PersonnelWS.PersonnelServiceClient();
                List<UserInfo> list = new List<UserInfo>();
                EngineServicesDAL dal = new EngineServicesDAL();
                T_WF_MESSAGEBODYDEFINE MsgBodyDefine = dal.GetMessageBodyDefine(systemCode, modelCode, companyID, 0).FirstOrDefault();
                if (MsgBodyDefine == null)
                {
                    Tracer.Debug("EngineServicesBLL.ReturnUserInfoDask()没有查询到默认消息:modelCode||" + modelCode + "||systemCode" + systemCode + "||companyID" + companyID);
                    return null;
                }
                DataTable dtValue = Common.EncrytXmlToDataTable(strXML);
                string Content = MsgBodyDefine.MESSAGEBODY;
                string Url = MsgBodyDefine.MESSAGEURL.Replace("Details", "Edit");//MVC 审核通过之后发送指定人的代办
                Content = Content.Replace("new:", "");
                Common.ReplaceValue(ref Content, ref Url, dtValue);
                Tracer.Debug("替换后的URL:" + Url);
                if (MsgBodyDefine.RECEIVETYPE == 1 && MsgBodyDefine.RECEIVERUSERID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVERUSERID.Split(',').Length; i++)
                    {
                        var Users = HRClient.GetFlowUserByUserID(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                        UserInfo info = new UserInfo();
                        info.CompanyID = Users[0].CompayID;
                        info.CompanyName = Users[0].CompayName;
                        info.DepartmentID = Users[0].DepartmentID;
                        info.DepartmentName = Users[0].DepartmentName;
                        info.PostID = Users[0].PostID;
                        info.PostName = Users[0].PostName;
                        info.UserID = Users[0].UserID;
                        info.UserName = Users[0].EmployeeName;
                        list.Add(info);
                        if (MsgType.Task == msgType)//代办任务
                        {
                            TaskCache.TaskCacheReflesh(MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            dal.ClosedDoTaskStatus(systemCode, orderID, MsgBodyDefine.RECEIVERUSERID.Split(',')[i]);
                            Tracer.Debug("开始进行保存时的URL:" + Url);
                            dal.SendTriggerTaskMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                        }
                        else if (MsgType.Msg == msgType)
                        {
                            dal.SendTriggerMsg(MsgBodyDefine.RECEIVERUSERID.Split(',')[i], systemCode, orderID, Content);
                        }

                    }
                }
                else if (MsgBodyDefine.RECEIVETYPE == 0 && MsgBodyDefine.RECEIVEPOSTID != null)
                {
                    for (int i = 0; i < MsgBodyDefine.RECEIVEPOSTID.Split(',').Length; i++)
                    {
                        Tracer.Debug("岗位:" + MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                        if (!string.IsNullOrEmpty(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]))
                        {
                            string[] Employees = HRClient.GetEmployeeIDsByPostID(MsgBodyDefine.RECEIVEPOSTID.Split(',')[i]);
                            var Users = HRClient.GetFlowUserByUserID(Employees[0]);
                            UserInfo info = new UserInfo();
                            info.CompanyID = Users[0].CompayID;
                            info.CompanyName = Users[0].CompayName;
                            info.DepartmentID = Users[0].DepartmentID;
                            info.DepartmentName = Users[0].DepartmentName;
                            info.PostID = Users[0].PostID;
                            info.PostName = Users[0].PostName;
                            info.UserID = Users[0].UserID;
                            info.UserName = Users[0].EmployeeName;
                            list.Add(info);
                            Tracer.Debug("岗位人:" + Employees[0]);
                            if (MsgType.Task == msgType)//代办任务
                            {
                                TaskCache.TaskCacheReflesh(Employees[0]);
                                dal.ClosedDoTaskStatus(systemCode, orderID, Employees[0]);
                                Tracer.Debug("开始进行保存时的URL:" + Url);
                                dal.SendTriggerTaskMsg(Employees[0], systemCode, modelCode, orderID, Content, Url, Common.BOObjectEscapeString(strXML), strXML);
                            }
                            else if (MsgType.Msg == msgType)
                            {
                                dal.SendTriggerMsg(Employees[0], systemCode, orderID, Content);
                            }
                        }

                    }
                }
                return list;
            }
            catch (Exception ex)
            {
                Tracer.Debug("EngineServicesBLL.ReturnUserInfoDask()" + ex.Message);
                return null;
            }
        }