Beispiel #1
0
        public ActionResult Index()
        {
            RoadFlow.Data.Model.Users currentUser = MyController.CurrentUser;
            base.ViewBag.UserName = ((currentUser == null) ? "" : currentUser.Name);
            base.ViewBag.DateTime = MyController.CurrentDateTime.ToDateWeekString();
            List <RoadFlow.Data.Model.ShortMessage> allNoReadByUserID = new RoadFlow.Platform.ShortMessage().GetAllNoReadByUserID(currentUser.ID);

            if (allNoReadByUserID.Count > 0)
            {
                JsonData jsonData = new JsonData();
                string   empty    = string.Empty;
                RoadFlow.Data.Model.ShortMessage shortMessage = (from p in allNoReadByUserID
                                                                 orderby p.SendTime descending
                                                                 select p).FirstOrDefault();
                empty                      = (shortMessage.LinkUrl.IsNullOrEmpty() ? shortMessage.Contents.RemoveHTML() : ("<a class=\"blue1\" href=\"" + shortMessage.LinkUrl + "\">" + shortMessage.Contents.RemoveHTML() + "</a>"));
                jsonData["title"]          = shortMessage.Title;
                jsonData["contents"]       = empty;
                jsonData["count"]          = allNoReadByUserID.Count;
                base.ViewBag.NoReadMsgJson = jsonData.ToJson();
            }
            string text = base.Url.Content("~/Content/UserHeads/default.jpg");

            if (!currentUser.HeadImg.IsNullOrEmpty() && System.IO.File.Exists(base.Server.MapPath(base.Url.Content("~" + currentUser.HeadImg))))
            {
                text = base.Url.Content("~" + currentUser.HeadImg);
            }
            base.ViewBag.HeadImg = text;
            return(View());
        }
Beispiel #2
0
 public ActionResult Send(FormCollection collection)
 {
     if (collection != null)
     {
         string text  = base.Request.Form["Title1"];
         string text2 = base.Request.Form["Contents"];
         string text3 = base.Request.Form["ReceiveUserID"];
         string files = base.Request.Form["Files"];
         string b     = base.Request.Form["sendtoseixin"];
         if (text.IsNullOrEmpty() || text2.IsNullOrEmpty() || text3.IsNullOrEmpty())
         {
             base.ViewBag.script = "alert('数据验证错误!')";
             return(View());
         }
         List <RoadFlow.Data.Model.Users> allUsers = new RoadFlow.Platform.Organize().GetAllUsers(text3);
         StringBuilder stringBuilder  = new StringBuilder();
         StringBuilder stringBuilder2 = new StringBuilder();
         RoadFlow.Data.Model.ShortMessage shortMessage  = null;
         RoadFlow.Platform.ShortMessage   shortMessage2 = new RoadFlow.Platform.ShortMessage();
         foreach (RoadFlow.Data.Model.Users item in allUsers)
         {
             RoadFlow.Data.Model.ShortMessage shortMessage3 = new RoadFlow.Data.Model.ShortMessage();
             shortMessage3.Contents        = text2;
             shortMessage3.ID              = Guid.NewGuid();
             shortMessage3.ReceiveUserID   = item.ID;
             shortMessage3.ReceiveUserName = item.Name;
             shortMessage3.SendTime        = DateTimeNew.Now;
             shortMessage3.SendUserID      = RoadFlow.Platform.Users.CurrentUserID;
             shortMessage3.SendUserName    = RoadFlow.Platform.Users.CurrentUserName;
             shortMessage3.Status          = 0;
             shortMessage3.Title           = text;
             shortMessage3.Type            = 0;
             shortMessage3.Files           = files;
             shortMessage2.Add(shortMessage3);
             RoadFlow.Platform.ShortMessage.SiganalR(item.ID, shortMessage3.ID.ToString(), text, text2.RemoveHTML());
             stringBuilder.Append(item.Name);
             stringBuilder.Append(",");
             stringBuilder2.Append(item.Account);
             stringBuilder2.Append('|');
             if (shortMessage == null)
             {
                 shortMessage = shortMessage3;
             }
         }
         if ("1" == b && shortMessage != null && stringBuilder2.Length > 0)
         {
             shortMessage2.SendToWeiXin(shortMessage, stringBuilder2.ToString().TrimEnd('|'));
         }
         base.ViewBag.script = string.Format("alert('成功将消息发送给了:{0}!');window.location=window.location;", stringBuilder.ToString());
     }
     return(View());
 }
Beispiel #3
0
        public string QueryNoRead()
        {
            string title     = base.Request.Form["Title1"];
            string contents  = base.Request.Form["Contents"];
            string text      = base.Request.Form["SenderID"];
            string date      = base.Request.Form["Date1"];
            string date2     = base.Request.Form["Date2"];
            string text2     = base.Request.Form["sidx"];
            string text3     = base.Request.Form["sord"];
            int    num       = base.Request.Form["status"].ToInt(0);
            string receiveID = RoadFlow.Platform.Users.CurrentUserID.ToString();

            int[] status = new int[1];
            if (2 == num)
            {
                status = new int[2]
                {
                    0,
                    1
                };
                text      = "'" + MyController.CurrentUserID.ToString() + "'";
                receiveID = "";
            }
            else if (1 == num)
            {
                status = new int[1]
                {
                    1
                };
                text = Tools.GetSqlInString(new RoadFlow.Platform.Organize().GetAllUsersIdList(text).ToArray());
            }
            new List <RoadFlow.Data.Model.ShortMessage>();
            int    pageSize   = Tools.GetPageSize();
            int    pageNumber = Tools.GetPageNumber();
            string order      = (text2.IsNullOrEmpty() ? "SenderTime" : text2) + " " + (text3.IsNullOrEmpty() ? "asc" : text3);
            long   count;
            List <RoadFlow.Data.Model.ShortMessage> list = new RoadFlow.Platform.ShortMessage().GetList(out count, status, pageSize, pageNumber, title, contents, text, date, date2, receiveID, order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.ShortMessage item in list)
            {
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]           = item.ID.ToString();
                jsonData2["Title"]        = "<a href=\"javascript:show('" + item.ID + "');\" class=\"blue1\">" + item.Title + "</a><input type=\"hidden\" id=\"status_" + item.ID.ToString() + "\" value=\"" + item.Status + "\"/>";
                jsonData2["Contents"]     = Tools.RemoveHTML(item.Contents).CutString(100);
                jsonData2["SendUserName"] = item.SendUserName;
                jsonData2["SendTime"]     = item.SendTime.ToDateTimeStringS();
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
Beispiel #4
0
        public string NoReadToRead()
        {
            string obj = base.Request.Form["ids"] ?? "";

            RoadFlow.Platform.ShortMessage shortMessage = new RoadFlow.Platform.ShortMessage();
            string[] array = obj.Split(',');
            foreach (string str in array)
            {
                if (str.IsGuid())
                {
                    shortMessage.UpdateStatus(str.ToGuid());
                }
            }
            return("操作成功!");
        }
Beispiel #5
0
        public static Guid Send(Guid userID, string userName, string title, string contents, int msgType = 0, string linkUrl = "", string linkID = "", string msgID = "")
        {
            if (userID.IsEmptyGuid() || title.IsNullOrEmpty() || contents.IsNullOrEmpty())
            {
                return(Guid.Empty);
            }
            if (userName.IsNullOrEmpty())
            {
                userName = new Users().GetName(userID);
            }
            RoadFlow.Data.Model.ShortMessage model = new RoadFlow.Data.Model.ShortMessage();
            model.Contents        = contents;
            model.ID              = msgID.IsGuid() ? msgID.ToGuid() : Guid.NewGuid();
            model.LinkID          = linkID;
            model.LinkUrl         = linkUrl;
            model.ReceiveUserID   = userID;
            model.ReceiveUserName = userName;
            model.SendTime        = DateTimeNew.Now;
            model.SendUserID      = Users.CurrentUserID;
            model.SendUserName    = Users.CurrentUserName;
            model.Status          = 0;
            model.Title           = title;
            model.Type            = msgType;
            new ShortMessage().Add(model);
            string empty = string.Empty;
            string contents1;

            if (!linkUrl.IsNullOrEmpty())
            {
                contents1 = "<a class=\"blue1\" href=\"" + linkUrl + "\">" + model.Contents + "</a>";
            }
            else
            {
                contents1 = model.Contents;
            }
            ShortMessage.SiganalR(userID, model.ID.ToString(), title, contents1);
            return(model.ID);
        }
Beispiel #6
0
        public string Delete()
        {
            string text = base.Request.Form["ids"] ?? "";

            RoadFlow.Platform.ShortMessage shortMessage = new RoadFlow.Platform.ShortMessage();
            if (text.IsNullOrEmpty())
            {
                return("没有选择要删除的消息!");
            }
            string[] array = text.Split(',');
            foreach (string str in array)
            {
                if (str.IsGuid())
                {
                    RoadFlow.Data.Model.ShortMessage shortMessage2 = shortMessage.Get(str.ToGuid());
                    if (shortMessage2 != null)
                    {
                        shortMessage.Delete(shortMessage2.ID);
                        RoadFlow.Platform.Log.Add("删除了站内消息", shortMessage2.Serialize(), RoadFlow.Platform.Log.Types.信息管理);
                    }
                }
            }
            return("操作成功!");
        }
Beispiel #7
0
        public static void Hasten(string types, string users, string contents, RoadFlow.Data.Model.WorkFlowTask task, string othersParams = "")
        {
            if (!users.IsNullOrEmpty() && !types.IsNullOrEmpty() && task != null)
            {
                string[] array = users.Split(',');
                Guid     guid  = Guid.NewGuid();
                List <RoadFlow.Data.Model.WorkFlowTask> list = new WorkFlowTask().GetNextTaskList(task.ID).FindAll((RoadFlow.Data.Model.WorkFlowTask p) => p.Status.In(0, 1));
                string text = "";
                text = ((!(HttpContext.Current.Request.Url != null) || !HttpContext.Current.Request.Url.AbsolutePath.EndsWith(".aspx", StringComparison.CurrentCultureIgnoreCase)) ? "/WorkFlowRun/Index" : "/Platform/WorkFlowRun/Default.aspx");
                string[] array2 = types.Split(',');
                for (int i = 0; i < array2.Length; i++)
                {
                    int test;
                    if (array2[i].IsInt(out test))
                    {
                        string[] array3 = array;
                        foreach (string id in array3)
                        {
                            Guid userGuid;
                            if (Users.RemovePrefix(id).IsGuid(out userGuid))
                            {
                                RoadFlow.Data.Model.WorkFlowTask workFlowTask = list.Find((RoadFlow.Data.Model.WorkFlowTask p) => p.ReceiveID == userGuid);
                                string linkUrl = (workFlowTask == null) ? "" : ("javascript:openApp('" + text + "?flowid=" + workFlowTask.FlowID + "&stepid=" + workFlowTask.StepID + "&instanceid=" + workFlowTask.InstanceID + "&taskid=" + workFlowTask.ID + "&groupid=" + workFlowTask.GroupID + "',0,'" + workFlowTask.Title.Replace1(",", "") + "','tab_" + workFlowTask.ID + "');closeMessage('" + guid + "');");
                                switch (test)
                                {
                                case 1:
                                    SMSLog.SendSMS(new Users().GetMobileNumber(userGuid), contents);
                                    break;

                                case 2:
                                    Email.Send(userGuid, "任务催办", contents);
                                    break;

                                case 3:
                                {
                                    RoadFlow.Data.Model.Users users3 = new Users().Get(userGuid);
                                    if (users3 != null)
                                    {
                                        ShortMessage.Send(users3.ID, users3.Name, "任务催办", contents, 0, linkUrl, task.ID.ToString(), guid.ToString());
                                    }
                                    break;
                                }

                                case 4:
                                {
                                    RoadFlow.Data.Model.Users users2 = new Users().Get(userGuid);
                                    if (users2 != null)
                                    {
                                        new Message().SendText(contents, users2.Account, "", "", 0, new Agents().GetAgentIDByCode("weixinagents_waittasks"), true);
                                    }
                                    break;
                                }
                                }
                            }
                        }
                    }
                }
                RoadFlow.Data.Model.HastenLog hastenLog = new RoadFlow.Data.Model.HastenLog();
                hastenLog.Contents     = contents;
                hastenLog.ID           = Guid.NewGuid();
                hastenLog.SendTime     = DateTimeNew.Now;
                hastenLog.SendUser     = Users.CurrentUserID;
                hastenLog.SendUserName = Users.CurrentUserName;
                hastenLog.OthersParams = (othersParams.IsNullOrEmpty() ? task.ID.ToString() : othersParams);
                hastenLog.Types        = types;
                hastenLog.Users        = users;
                new HastenLog().Add(hastenLog);
            }
        }
Beispiel #8
0
        public static void Hasten(string types, string users, string contents, RoadFlow.Data.Model.WorkFlowTask task, string othersParams = "")
        {
            if (users.IsNullOrEmpty() || types.IsNullOrEmpty() || task == null)
            {
                return;
            }
            string[] strArray = users.Split(',');
            Guid     guid     = Guid.NewGuid();
            List <RoadFlow.Data.Model.WorkFlowTask> all = new WorkFlowTask().GetNextTaskList(task.ID).FindAll((Predicate <RoadFlow.Data.Model.WorkFlowTask>)(p => p.Status.In(0, 1)));
            string str1 = !(HttpContext.Current.Request.Url != (Uri)null) || !HttpContext.Current.Request.Url.AbsolutePath.EndsWith(".aspx", StringComparison.CurrentCultureIgnoreCase) ? "/WorkFlowRun/Index" : "/Platform/WorkFlowRun/Default.aspx";
            string str2 = types;

            char[] chArray = new char[1] {
                ','
            };
            foreach (string str3 in str2.Split(chArray))
            {
                int test;
                if (str3.IsInt(out test))
                {
                    foreach (string id in strArray)
                    {
                        Guid userGuid;
                        if (Users.RemovePrefix(id).IsGuid(out userGuid))
                        {
                            RoadFlow.Data.Model.WorkFlowTask workFlowTask = all.Find((Predicate <RoadFlow.Data.Model.WorkFlowTask>)(p => p.ReceiveID == userGuid));
                            string str4;
                            if (workFlowTask != null)
                            {
                                str4 = "javascript:openApp('" + str1 + "?flowid=" + (object)workFlowTask.FlowID + "&stepid=" + (object)workFlowTask.StepID + "&instanceid=" + workFlowTask.InstanceID + "&taskid=" + (object)workFlowTask.ID + "&groupid=" + (object)workFlowTask.GroupID + "',0,'" + workFlowTask.Title.Replace1(",", "") + "','tab_" + (object)workFlowTask.ID + "');closeMessage('" + (object)guid + "');";
                            }
                            else
                            {
                                str4 = "";
                            }
                            string linkUrl = str4;
                            switch (test)
                            {
                            case 1:
                                SMSLog.SendSMS(new Users().GetMobileNumber(userGuid), contents);
                                continue;

                            case 2:
                                Email.Send(userGuid, "任务催办", contents, "");
                                continue;

                            case 3:
                                RoadFlow.Data.Model.Users users1 = new Users().Get(userGuid);
                                if (users1 != null)
                                {
                                    ShortMessage.Send(users1.ID, users1.Name, "任务催办", contents, 0, linkUrl, task.ID.ToString(), guid.ToString());
                                    continue;
                                }
                                continue;

                            case 4:
                                RoadFlow.Data.Model.Users users2 = new Users().Get(userGuid);
                                if (users2 != null)
                                {
                                    new Message().SendText(contents, users2.Account, "", "", 0, new Agents().GetAgentIDByCode("weixinagents_waittasks"), true);
                                    continue;
                                }
                                continue;

                            default:
                                continue;
                            }
                        }
                    }
                }
            }
            new HastenLog().Add(new RoadFlow.Data.Model.HastenLog()
            {
                Contents     = contents,
                ID           = Guid.NewGuid(),
                SendTime     = DateTimeNew.Now,
                SendUser     = Users.CurrentUserID,
                SendUserName = Users.CurrentUserName,
                OthersParams = othersParams.IsNullOrEmpty() ? task.ID.ToString() : othersParams,
                Types        = types,
                Users        = users
            });
        }