Esempio n. 1
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);
        }
Esempio n. 2
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 Data.Model.UsersRole()
                    {
                        IsDefault = true,
                        MemberID  = userID,
                        RoleID    = role.ID
                    });
                }
            }
            ClearCache();
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个人员的分管领导
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public string GetChargeLeader(Guid userID)
        {
            var mainStation = GetMainStation(userID);

            if (mainStation == null)
            {
                return("");
            }
            Business.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("");
        }
Esempio n. 4
0
        /// <summary>
        /// 将json字符串转换为执行实体
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        private Data.Model.WorkFlowExecute.Execute GetExecuteModel(string jsonString)
        {
            Data.Model.WorkFlowExecute.Execute execute   = new Data.Model.WorkFlowExecute.Execute();
            Business.Platform.Organize         borganize = new Organize();

            LitJson.JsonData jsondata = LitJson.JsonMapper.ToObject(jsonString);
            if (jsondata == null)
            {
                return(execute);
            }

            execute.Comment = jsondata["comment"].ToString();
            string op = jsondata["type"].ToString().ToLower();

            switch (op)
            {
            case "submit":
                execute.ExecuteType = Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
                break;

            case "save":
                execute.ExecuteType = Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
                break;

            case "back":
                execute.ExecuteType = Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
                break;
            }
            execute.FlowID     = jsondata["flowid"].ToString().ToGuid();
            execute.GroupID    = jsondata["groupid"].ToString().ToGuid();
            execute.InstanceID = jsondata["instanceid"].ToString();
            execute.IsSign     = jsondata["issign"].ToString().ToInt() == 1;
            execute.StepID     = jsondata["stepid"].ToString().ToGuid();
            execute.TaskID     = jsondata["taskid"].ToString().ToGuid();

            var stepsjson = jsondata["steps"];
            Dictionary <Guid, List <Data.Model.Users> > steps = new Dictionary <Guid, List <Data.Model.Users> >();

            if (stepsjson.IsArray)
            {
                foreach (LitJson.JsonData step in stepsjson)
                {
                    var id     = step["id"].ToString().ToGuid();
                    var member = step["member"].ToString();
                    if (id == Guid.Empty || member.IsNullOrEmpty())
                    {
                        continue;
                    }
                    steps.Add(id, borganize.GetAllUsers(member));
                }
            }
            execute.Steps = steps;
            return(execute);
        }