Ejemplo n.º 1
0
        public RoadFlow.Data.Model.Organize GetDeptByUserID(Guid userID)
        {
            string key = 13.ToString();
            object obj = Opation.Get(key);
            Dictionary <Guid, RoadFlow.Data.Model.Organize> dictionary = new Dictionary <Guid, RoadFlow.Data.Model.Organize>();

            if (obj is Dictionary <Guid, RoadFlow.Data.Model.Organize> )
            {
                dictionary = (Dictionary <Guid, RoadFlow.Data.Model.Organize>)obj;
                if (dictionary.ContainsKey(userID))
                {
                    return(dictionary[userID]);
                }
            }
            Guid mainStation = GetMainStation(userID);

            if (mainStation == Guid.Empty)
            {
                return(null);
            }
            List <RoadFlow.Data.Model.Organize> allParent = new Organize().GetAllParent(mainStation);

            allParent.Reverse();
            foreach (RoadFlow.Data.Model.Organize item in allParent)
            {
                if (item.Type == 2)
                {
                    dictionary.Add(userID, item);
                    Opation.Set(key, dictionary);
                    return(item);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        public List <string> GetAllParentsDeptLeader(Guid userID)
        {
            List <string> stringList  = new List <string>();
            Guid          mainStation = this.GetMainStation(userID);

            if (mainStation.IsEmptyGuid())
            {
                return(stringList);
            }
            RoadFlow.Data.Model.Organize organize1 = new Organize().Get(mainStation);
            if (organize1 == null)
            {
                return(stringList);
            }
            if (!organize1.Leader.IsNullOrEmpty())
            {
                stringList.Add(organize1.Leader);
            }
            foreach (RoadFlow.Data.Model.Organize organize2 in new Organize().GetAllParent(mainStation))
            {
                if (!organize2.Leader.IsNullOrEmpty())
                {
                    stringList.Add(organize2.Leader);
                }
            }
            return(stringList);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 从数据库获取所有意见列表
        /// </summary>
        /// <returns></returns>
        private List <Tuple <Guid, string, int, int, List <Guid> > > getAllListByDb()
        {
            var      comments  = GetAll();
            Organize borganize = new Organize();
            List <Tuple <Guid, string, int, int, List <Guid> > > list = new List <Tuple <Guid, string, int, int, List <Guid> > >();

            foreach (var comment in comments)
            {
                List <Guid> userList = new List <Guid>();
                if (!comment.MemberID.IsNullOrEmpty())
                {
                    var users = borganize.GetAllUsers(comment.MemberID);
                    foreach (var user in users)
                    {
                        userList.Add(user.ID);
                    }
                }

                Tuple <Guid, string, int, int, List <Guid> > tuple = new Tuple <Guid, string, int, int, List <Guid> >(
                    comment.ID,
                    comment.Comment,
                    comment.Type,
                    comment.Sort,
                    userList
                    );
                list.Add(tuple);
            }
            return(list);
        }
Ejemplo n.º 4
0
        public List <RoadFlow.Data.Model.Users> GetManageUsers(Guid dirID)
        {
            object obj = Opation.Get(DocumentsDirectoryManageUsers + dirID.ToString("N"));

            if (obj is List <RoadFlow.Data.Model.Users> )
            {
                return((List <RoadFlow.Data.Model.Users>)obj);
            }
            RoadFlow.Data.Model.DocumentDirectory documentDirectory = Get(dirID);
            if (documentDirectory == null)
            {
                return(new List <RoadFlow.Data.Model.Users>());
            }
            if (!documentDirectory.ManageUsers.IsNullOrEmpty())
            {
                List <RoadFlow.Data.Model.Users> allUsers = new Organize().GetAllUsers(documentDirectory.ManageUsers);
                Opation.Set(DocumentsDirectoryManageUsers + dirID.ToString("N"), allUsers);
                return(allUsers);
            }
            foreach (RoadFlow.Data.Model.DocumentDirectory allParent in GetAllParents(dirID))
            {
                if (!allParent.ManageUsers.IsNullOrEmpty())
                {
                    List <RoadFlow.Data.Model.Users> allUsers2 = new Organize().GetAllUsers(allParent.ManageUsers);
                    Opation.Set(DocumentsDirectoryManageUsers + dirID.ToString("N"), allUsers2);
                    return(allUsers2);
                }
            }
            return(new List <RoadFlow.Data.Model.Users>());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个人员的主管。
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public string GetLeader(Guid userId)
        {
            Guid organizeId = this.GetMainStation(userId);

            if (Guid.Empty.Equals(organizeId))
            {
                return(string.Empty);
            }
            Organize organizeBll = new Organize();

            Data.Model.Organize organize = organizeBll.Get(organizeId);
            if (organize == null)
            {
                return(string.Empty);
            }
            if (!string.IsNullOrEmpty(organize.Leader))
            {
                return(organize.Leader);
            }
            List <Data.Model.Organize> list = organizeBll.GetAllParent(organize.Number);

            foreach (Data.Model.Organize current in list)
            {
                if (!string.IsNullOrEmpty(current.Leader))
                {
                    return(current.Leader);
                }
            }
            return(string.Empty);
        }
        public ActionResult Index(FormCollection collection)
        {
            RoadFlow.Platform.WorkFlowComment workFlowComment        = new RoadFlow.Platform.WorkFlowComment();
            RoadFlow.Platform.Organize        organize               = new RoadFlow.Platform.Organize();
            IEnumerable <RoadFlow.Data.Model.WorkFlowComment> source = workFlowComment.GetAll();

            if ("1" == base.Request.QueryString["isoneself"])
            {
                source = from p in source
                         where p.MemberID == "u_" + RoadFlow.Platform.Users.CurrentUserID.ToString()
                         select p;
            }
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlowComment item in from p in source
                     orderby p.Type, p.Sort
                     select p)
            {
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]       = item.ID.ToString();
                jsonData2["Comment"]  = item.Comment;
                jsonData2["MemberID"] = (item.MemberID.IsNullOrEmpty() ? "所有人员" : organize.GetNames(item.MemberID));
                jsonData2["Type"]     = ((item.Type == 0) ? "管理员" : "个人");
                jsonData2["Sort"]     = item.Sort;
                jsonData2["Opation"]  = "<a class=\"editlink\" href=\"javascript:edit('" + item.ID.ToString() + "');\">编辑</a>";
                jsonData.Add(jsonData2);
            }
            base.ViewBag.list = jsonData.ToJson();
            return(View());
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 得到一个人员的分管领导。
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public string GetChargeLeader(Guid userId)
        {
            Guid organizeId = this.GetMainStation(userId);

            if (organizeId == null)
            {
                return(string.Empty);
            }
            Organize organizeBll = new Organize();

            Data.Model.Organize organize = organizeBll.Get(organizeId);
            if (organize == null)
            {
                return(string.Empty);
            }
            if (!string.IsNullOrEmpty(organize.ChargeLeader))
            {
                return(organize.ChargeLeader);
            }
            var parents = organizeBll.GetAllParent(organize.Number);

            foreach (var current in parents)
            {
                if (!string.IsNullOrEmpty(current.ChargeLeader))
                {
                    return(current.ChargeLeader);
                }
            }
            return(string.Empty);
        }
Ejemplo n.º 8
0
        public List <RoadFlow.Data.Model.Users> GetPublishUsers(Guid dirID)
        {
            object obj = Opation.Get(this.DocumentsDirectoryPublishUsers + dirID.ToString("N"));

            if (obj is List <RoadFlow.Data.Model.Users> )
            {
                return((List <RoadFlow.Data.Model.Users>)obj);
            }
            RoadFlow.Data.Model.DocumentDirectory documentDirectory = this.Get(dirID);
            if (documentDirectory == null)
            {
                return(new List <RoadFlow.Data.Model.Users>());
            }
            if (!documentDirectory.PublishUsers.IsNullOrEmpty())
            {
                List <RoadFlow.Data.Model.Users> allUsers = new Organize().GetAllUsers(documentDirectory.PublishUsers);
                Opation.Set(this.DocumentsDirectoryPublishUsers + dirID.ToString("N"), (object)allUsers);
                return(allUsers);
            }
            foreach (RoadFlow.Data.Model.DocumentDirectory allParent in this.GetAllParents(dirID, false))
            {
                if (!allParent.PublishUsers.IsNullOrEmpty())
                {
                    List <RoadFlow.Data.Model.Users> allUsers = new Organize().GetAllUsers(allParent.PublishUsers);
                    Opation.Set(this.DocumentsDirectoryPublishUsers + dirID.ToString("N"), (object)allUsers);
                    return(allUsers);
                }
            }
            return(new List <RoadFlow.Data.Model.Users>());
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 得到一个人员的分管领导
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public string GetChargeLeader(Guid userID)
        {
            var mainStation = GetMainStation(userID);

            if (mainStation == null)
            {
                return("");
            }
            RoadFlow.Platform.Organize borg = new Organize();
            var station = borg.Get(mainStation);

            if (station == null)
            {
                return("");
            }
            if (!station.ChargeLeader.IsNullOrEmpty())
            {
                return(station.ChargeLeader);
            }
            var parents = borg.GetAllParent(station.Number);

            foreach (var parent in parents)
            {
                if (!parent.ChargeLeader.IsNullOrEmpty())
                {
                    return(parent.ChargeLeader);
                }
            }
            return("");
        }
Ejemplo n.º 10
0
        public List <RoadFlow.Data.Model.MenuUser> GetAll(bool cache = true)
        {
            if (!cache)
            {
                Organize organize = new Organize();
                List <RoadFlow.Data.Model.MenuUser> all = this.dataMenuUser.GetAll();
                foreach (RoadFlow.Data.Model.MenuUser menuUser in all)
                {
                    menuUser.Users = organize.GetAllUsersIdString(menuUser.Organizes);
                }
                return(all);
            }
            object obj = Opation.Get(MenuUser.cachekey);

            if (obj != null)
            {
                return((List <RoadFlow.Data.Model.MenuUser>)obj);
            }
            Organize organize1 = new Organize();
            List <RoadFlow.Data.Model.MenuUser> all1 = this.dataMenuUser.GetAll();

            foreach (RoadFlow.Data.Model.MenuUser menuUser in all1)
            {
                menuUser.Users = organize1.GetAllUsersIdString(menuUser.Organizes);
            }
            Opation.Set(MenuUser.cachekey, (object)all1);
            return(all1);
        }
Ejemplo n.º 11
0
        public RoadFlow.Data.Model.Organize GetDeptByUserID(Guid userID)
        {
            string key = Keys.CacheKeys.UserDept.ToString();
            object obj = Opation.Get(key);

            System.Collections.Generic.Dictionary <Guid, RoadFlow.Data.Model.Organize> dictionary = new System.Collections.Generic.Dictionary <Guid, RoadFlow.Data.Model.Organize>();
            if (obj is System.Collections.Generic.Dictionary <Guid, RoadFlow.Data.Model.Organize> )
            {
                dictionary = (System.Collections.Generic.Dictionary <Guid, RoadFlow.Data.Model.Organize>)obj;
                if (dictionary.ContainsKey(userID))
                {
                    return(dictionary[userID]);
                }
            }
            Guid mainStation = this.GetMainStation(userID);

            if (mainStation == Guid.Empty)
            {
                return((RoadFlow.Data.Model.Organize)null);
            }
            List <RoadFlow.Data.Model.Organize> allParent = new Organize().GetAllParent(mainStation);

            allParent.Reverse();
            foreach (RoadFlow.Data.Model.Organize organize in allParent)
            {
                if (organize.Type == 2)
                {
                    dictionary.Add(userID, organize);
                    Opation.Set(key, (object)dictionary);
                    return(organize);
                }
            }
            return((RoadFlow.Data.Model.Organize)null);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 更新一个人员的所属角色
        /// </summary>
        /// <param name="userID"></param>
        public void UpdateByUserID(Guid userID)
        {
            Organize  borg       = new Organize();
            UsersRole busersRole = new UsersRole();
            var       roles      = new Role().GetAll();

            busersRole.DeleteByUserID(userID);
            foreach (var role in roles)
            {
                if (role.UseMember.IsNullOrEmpty())
                {
                    continue;
                }
                var users = borg.GetAllUsers(role.UseMember);
                if (users.Exists(p => p.ID == userID))
                {
                    busersRole.Add(new RoadFlow.Data.Model.UsersRole()
                    {
                        IsDefault = true,
                        MemberID  = userID,
                        RoleID    = role.ID
                    });
                }
            }
            ClearCache();
        }
Ejemplo n.º 13
0
        public List <RoadFlow.Data.Model.MenuUser> GetAll(bool cache = true)
        {
            if (!cache)
            {
                Organize organize = new Organize();
                List <RoadFlow.Data.Model.MenuUser> all = dataMenuUser.GetAll();
                {
                    foreach (RoadFlow.Data.Model.MenuUser item in all)
                    {
                        item.Users = organize.GetAllUsersIdString(item.Organizes);
                    }
                    return(all);
                }
            }
            object obj = Opation.Get(cachekey);

            if (obj == null)
            {
                Organize organize2 = new Organize();
                List <RoadFlow.Data.Model.MenuUser> all2 = dataMenuUser.GetAll();
                foreach (RoadFlow.Data.Model.MenuUser item2 in all2)
                {
                    item2.Users = organize2.GetAllUsersIdString(item2.Organizes);
                }
                Opation.Set(cachekey, all2);
                return(all2);
            }
            return((List <RoadFlow.Data.Model.MenuUser>)obj);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 判断一个人员是否在一个组织机构字符串里
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="memberString"></param>
        /// <returns></returns>
        public bool IsContains(Guid userID, string memberString)
        {
            if (memberString.IsNullOrEmpty())
            {
                return(false);
            }
            var user = new Organize().GetAllUsers(memberString).Find(p => p.ID == userID);

            return(user != null);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 判断一个人员是否在一个组织机构字符串里。
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="memberString"></param>
        /// <returns></returns>
        public bool IsContains(Guid userID, string memberString)
        {
            if (string.IsNullOrEmpty(memberString))
            {
                return(false);
            }
            Organize          organizeBll = new Organize();
            List <UsersModel> users       = organizeBll.GetAllUsers(memberString);

            return(users.Any(u => u.ID.Equals(userID)));
        }
Ejemplo n.º 16
0
        public void RefreshUsers()
        {
            MenuUser menuUser = new MenuUser();
            Organize organize = new Organize();

            foreach (RoadFlow.Data.Model.MenuUser model in menuUser.GetAll(false))
            {
                model.Users = organize.GetAllUsersIdList(model.Organizes).ToArray().Join1 <Guid>(",");
                menuUser.Update(model);
            }
            this.ClearCache();
        }
Ejemplo n.º 17
0
        public void RefreshUsers()
        {
            MenuUser menuUser = new MenuUser();
            Organize organize = new Organize();

            foreach (RoadFlow.Data.Model.MenuUser item in menuUser.GetAll(false))
            {
                item.Users = organize.GetAllUsersIdList(item.Organizes).ToArray().Join1();
                menuUser.Update(item);
            }
            ClearCache();
        }
Ejemplo n.º 18
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());
 }
Ejemplo n.º 19
0
        public List <RoadFlow.Data.Model.WorkGroup> GetAllByUserID(Guid userID)
        {
            List <RoadFlow.Data.Model.WorkGroup> all = GetAll();
            Organize organize = new Organize();
            List <RoadFlow.Data.Model.WorkGroup> list = new List <RoadFlow.Data.Model.WorkGroup>();

            foreach (RoadFlow.Data.Model.WorkGroup item in all)
            {
                if (organize.GetAllUsers(item.Members).Find((RoadFlow.Data.Model.Users p) => p.ID == userID) != null)
                {
                    list.Add(item);
                }
            }
            return(list);
        }
Ejemplo n.º 20
0
        public List <RoadFlow.Data.Model.WorkGroup> GetAllByUserID(Guid userID)
        {
            List <RoadFlow.Data.Model.WorkGroup> all = this.GetAll();
            Organize organize = new Organize();
            List <RoadFlow.Data.Model.WorkGroup> workGroupList = new List <RoadFlow.Data.Model.WorkGroup>();

            foreach (RoadFlow.Data.Model.WorkGroup workGroup in all)
            {
                if (organize.GetAllUsers(workGroup.Members).Find((Predicate <RoadFlow.Data.Model.Users>)(p => p.ID == userID)) != null)
                {
                    workGroupList.Add(workGroup);
                }
            }
            return(workGroupList);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 更新应用程序库使用人员缓存
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="userIdString"></param>
        public List <Guid> UpdateUseMemberCache(Guid appid)
        {
            string key = RoadFlow.Utility.Keys.CacheKeys.AppLibraryUseMember.ToString();
            //var obj = RoadFlow.Cache.IO.Opation.Get(key);
            Dictionary <Guid, List <Guid> > dict = new Dictionary <Guid, List <Guid> >();
            //if (obj != null && obj is Dictionary<Guid, List<Guid>>)
            //{
            //    dict = obj as Dictionary<Guid, List<Guid>>;
            //}
            //else
            //{
            //    dict = new Dictionary<Guid, List<Guid>>();
            //}
            var app = Get(appid);

            if (app == null)
            {
                return(new List <Guid>());
            }
            if (!app.UseMember.IsNullOrEmpty())
            {
                var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
                dict.Add(appid, userIDs);
                return(userIDs);
            }
            //if (dict.ContainsKey(appid))
            //{
            //    if (app.UseMember.IsNullOrEmpty())
            //    {
            //        dict.Remove(appid);
            //        return new List<Guid>();
            //    }
            //    else
            //    {
            //        var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
            //        dict[appid] = userIDs;
            //        return userIDs;
            //    }
            //}
            //else if(!app.UseMember.IsNullOrEmpty())
            //{
            //    var userIDs = new Organize().GetAllUsersIdList(app.UseMember);
            //    dict.Add(appid, userIDs);
            //    return userIDs;
            //}
            return(new List <Guid>());
        }
Ejemplo n.º 22
0
        public string Query()
        {
            RoadFlow.Platform.HomeItems homeItems = new RoadFlow.Platform.HomeItems();
            RoadFlow.Platform.Organize  organize  = new RoadFlow.Platform.Organize();
            new List <RoadFlow.Data.Model.HomeItems>();
            string name       = base.Request.Form["Name1"];
            string title      = base.Request.Form["Title1"];
            string type       = base.Request.Form["Type"];
            string text       = base.Request.Form["sidx"];
            string text2      = base.Request.Form["sord"];
            int    pageSize   = Tools.GetPageSize();
            int    pageNumber = Tools.GetPageNumber();
            string order      = (text.IsNullOrEmpty() ? "Type" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2);
            long   count;
            List <RoadFlow.Data.Model.HomeItems> list = homeItems.GetList(out count, pageSize, pageNumber, name, title, type, order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.HomeItems item in list)
            {
                StringBuilder stringBuilder = new StringBuilder();
                if (!item.Ico.IsNullOrEmpty())
                {
                    if (item.Ico.IsFontIco())
                    {
                        stringBuilder.Append("<i class='fa " + item.Ico + "' style='font-size:14px;vertical-align:middle;margin-right:3px;'></i>");
                    }
                    else
                    {
                        stringBuilder.Append("<img src='" + base.Url.Content("~" + item.Ico) + "' style='vertical-align:middle;margin-right:3px;'/>");
                    }
                }
                stringBuilder.Append(item.Title);
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]             = item.ID.ToString();
                jsonData2["Name"]           = item.Name;
                jsonData2["Title"]          = stringBuilder.ToString();
                jsonData2["Type"]           = homeItems.GetTypeTitle(item.Type);
                jsonData2["DataSourceType"] = homeItems.GetDataSourceTitle(item.DataSourceType);
                jsonData2["UseOrganizes"]   = organize.GetNames(item.UseOrganizes);
                jsonData2["Note"]           = item.Note;
                jsonData2["Opation"]        = "<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"edit('" + item.ID + "');return false;\">编辑</a>";
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
Ejemplo n.º 23
0
        public string GetParentDeptLeader(Guid userID)
        {
            Guid     mainStation = this.GetMainStation(userID);
            Organize organize1   = new Organize();

            RoadFlow.Data.Model.Organize organize2 = organize1.Get(mainStation);
            if (organize2 == null)
            {
                return("");
            }
            foreach (RoadFlow.Data.Model.Organize organize3 in organize1.GetAllParent(organize2.Number))
            {
                if (!organize3.Leader.IsNullOrEmpty())
                {
                    return(organize3.Leader);
                }
            }
            return("");
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 获取一个用户所在的部门。
        /// </summary>
        /// <param name="userId">用户ID。</param>
        /// <returns></returns>
        public Data.Model.Organize GetDeptByUserID(Guid userId)
        {
            Guid organizeId = this.GetMainStation(userId);

            if (organizeId.Equals(Guid.Empty))
            {
                return(null);
            }
            Organize organize = new Organize();
            List <Data.Model.Organize> list = organize.GetAllParent(organizeId);

            foreach (Data.Model.Organize current in list)
            {
                if (current.Type.Equals(1) || current.Type.Equals(2))
                {
                    return(current);
                }
            }
            return(null);
        }
Ejemplo n.º 25
0
        private List <Tuple <Guid, string, int, int, List <Guid> > > getAllListByDb()
        {
            List <RoadFlow.Data.Model.WorkFlowComment> all = this.GetAll();
            Organize organize = new Organize();
            List <Tuple <Guid, string, int, int, List <Guid> > > tupleList = new List <Tuple <Guid, string, int, int, List <Guid> > >();

            foreach (RoadFlow.Data.Model.WorkFlowComment workFlowComment in all)
            {
                List <Guid> guidList = new List <Guid>();
                if (!workFlowComment.MemberID.IsNullOrEmpty())
                {
                    foreach (RoadFlow.Data.Model.Users allUser in organize.GetAllUsers(workFlowComment.MemberID))
                    {
                        guidList.Add(allUser.ID);
                    }
                }
                Tuple <Guid, string, int, int, List <Guid> > tuple = new Tuple <Guid, string, int, int, List <Guid> >(workFlowComment.ID, workFlowComment.Comment, workFlowComment.Type, workFlowComment.Sort, guidList);
                tupleList.Add(tuple);
            }
            return(tupleList);
        }
Ejemplo n.º 26
0
        private List <Tuple <Guid, string, int, int, List <Guid> > > getAllListByDb()
        {
            List <RoadFlow.Data.Model.WorkFlowComment> all = GetAll();
            Organize organize = new Organize();
            List <Tuple <Guid, string, int, int, List <Guid> > > list = new List <Tuple <Guid, string, int, int, List <Guid> > >();

            foreach (RoadFlow.Data.Model.WorkFlowComment item2 in all)
            {
                List <Guid> list2 = new List <Guid>();
                if (!item2.MemberID.IsNullOrEmpty())
                {
                    foreach (RoadFlow.Data.Model.Users allUser in organize.GetAllUsers(item2.MemberID))
                    {
                        list2.Add(allUser.ID);
                    }
                }
                Tuple <Guid, string, int, int, List <Guid> > item = new Tuple <Guid, string, int, int, List <Guid> >(item2.ID, item2.Comment, item2.Type, item2.Sort, list2);
                list.Add(item);
            }
            return(list);
        }
Ejemplo n.º 27
0
        public List <RoadFlow.Data.Model.HomeItems> GetAllByUserID(Guid userID)
        {
            object obj = Opation.Get(this.cacheKey);
            List <RoadFlow.Data.Model.HomeItems> homeItemsList1 = new List <RoadFlow.Data.Model.HomeItems>();
            List <RoadFlow.Data.Model.HomeItems> homeItemsList2;

            if (obj != null && obj is List <RoadFlow.Data.Model.HomeItems> )
            {
                homeItemsList2 = (List <RoadFlow.Data.Model.HomeItems>)obj;
            }
            else
            {
                Organize organize = new Organize();
                homeItemsList2 = this.GetAll();
                foreach (RoadFlow.Data.Model.HomeItems homeItems in homeItemsList2)
                {
                    homeItems.UseUsers = organize.GetAllUsersIdString(homeItems.UseOrganizes);
                }
                Opation.Set(this.cacheKey, (object)homeItemsList2);
            }
            return(homeItemsList2.FindAll((Predicate <RoadFlow.Data.Model.HomeItems>)(p => p.UseUsers.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase))).OrderBy <RoadFlow.Data.Model.HomeItems, int>((Func <RoadFlow.Data.Model.HomeItems, int>)(p => p.Type)).ThenBy <RoadFlow.Data.Model.HomeItems, int?>((Func <RoadFlow.Data.Model.HomeItems, int?>)(p => p.Sort)).ToList <RoadFlow.Data.Model.HomeItems>());
        }
Ejemplo n.º 28
0
        public bool HasUse(Guid menuID, Guid userID, List <RoadFlow.Data.Model.MenuUser> menuusers, out string source, out string params1, bool showSource = false)
        {
            source  = string.Empty;
            params1 = string.Empty;
            List <RoadFlow.Data.Model.MenuUser> list = menuusers.FindAll(delegate(RoadFlow.Data.Model.MenuUser p)
            {
                if (p.MenuID == menuID && p.SubPageID == Guid.Empty)
                {
                    return(p.Users.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase));
                }
                return(false);
            });

            if (list.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (RoadFlow.Data.Model.MenuUser item in list)
                {
                    stringBuilder.Append(item.Organizes);
                    stringBuilder.Append(",");
                    if (!item.Params.IsNullOrEmpty())
                    {
                        params1 = item.Params;
                    }
                }
                Organize organize = new Organize();
                source = organize.GetNames(stringBuilder.ToString().TrimEnd(','));
                StringBuilder stringBuilder2 = new StringBuilder();
                foreach (IGrouping <string, RoadFlow.Data.Model.MenuUser> item2 in from p in list.FindAll((RoadFlow.Data.Model.MenuUser p) => !p.Params.IsNullOrEmpty())
                         group p by p.Params)
                {
                    stringBuilder2.Append(item2.Key.Trim1());
                    stringBuilder2.Append("&");
                }
                params1 = stringBuilder2.ToString().TrimEnd('&');
                return(true);
            }
            return(false);
        }
Ejemplo n.º 29
0
        public ActionResult Designate(FormCollection collection)
        {
            Guid test;

            if (base.Request.QueryString["taskid"].IsGuid(out test))
            {
                string idString = base.Request.Form["user"];
                string text     = base.Request.QueryString["openerid"];
                RoadFlow.Platform.WorkFlowTask   workFlowTask = new RoadFlow.Platform.WorkFlowTask();
                List <RoadFlow.Data.Model.Users> allUsers     = new RoadFlow.Platform.Organize().GetAllUsers(idString);
                StringBuilder stringBuilder = new StringBuilder();
                foreach (RoadFlow.Data.Model.Users item in allUsers)
                {
                    workFlowTask.DesignateTask(test, item);
                    RoadFlow.Platform.Log.Add("管理员指派了流程任务", "将任务" + test + "指派给了:" + item.Name + item.ID, RoadFlow.Platform.Log.Types.流程相关);
                    stringBuilder.Append(item.Name);
                    stringBuilder.Append(",");
                }
                string str = stringBuilder.ToString().TrimEnd(',');
                base.ViewBag.Script = "alert('已成功指派给:" + str + "!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
            }
            return(View());
        }
Ejemplo n.º 30
0
        public List <RoadFlow.Data.Model.HomeItems> GetAllByUserID(Guid userID)
        {
            object obj = Opation.Get(cacheKey);
            List <RoadFlow.Data.Model.HomeItems> list = new List <RoadFlow.Data.Model.HomeItems>();

            if (obj != null && obj is List <RoadFlow.Data.Model.HomeItems> )
            {
                list = (List <RoadFlow.Data.Model.HomeItems>)obj;
            }
            else
            {
                Organize organize = new Organize();
                list = GetAll();
                foreach (RoadFlow.Data.Model.HomeItems item in list)
                {
                    item.UseUsers = organize.GetAllUsersIdString(item.UseOrganizes);
                }
                Opation.Set(cacheKey, list);
            }
            return((from p in list.FindAll((RoadFlow.Data.Model.HomeItems p) => p.UseUsers.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    orderby p.Type, p.Sort
                    select p).ToList());
        }