Exemplo n.º 1
0
 private void MergeUser(Dictionary<string, WFUser> dicUsers, WFUser wfUser)
 {
     if (dicUsers.Keys.Contains(wfUser.UserID))
     {
         if (wfUser.IsApprover)
         {
             dicUsers[wfUser.UserID].IsApprover = true;
         }
         if (wfUser.IsKeyUser)
         {
             dicUsers[wfUser.UserID].IsKeyUser = true;
         }
     }
     else
     {
         dicUsers.Add(wfUser.UserID, wfUser);
     }
 }
Exemplo n.º 2
0
 private string GetUserString(WFUser user, string userType)
 {
     string userString = "";
     bool isKeyUser = (user.IsKeyUser || user.IsApprover);
     userString += "<div class='itemdiv memberdiv'><div class='user'><i class='" + (isKeyUser == true ? "blue" : "light-grey") + " icon-user icon-3x'></i></div>";
     userString += "<div class='body'>";
     userString += "<div class='name'>" + user.DisplayName + "</div>";
     userString += "<div><span class='label label-success label-sm'>" + userType + "</span></div>";
     userString += "</div></div>";
     return userString;
 }
Exemplo n.º 3
0
        public List<WFUser> GetExtUsers()
        {
            List<WFUser> listUsers = new List<WFUser>();

            if (this.Template.MasterData != null)
            {
                XmlDocument dom = new XmlDocument();
                dom.Load(System.Web.HttpContext.Current.Server.MapPath("~/Content/Template/User/ExtUser.xml"));
                XmlNode root = dom.SelectSingleNode("Root");
                XmlNodeList nodes = root.ChildNodes;
                foreach (XmlNode node in nodes)
                {
                    bool isMatchAct = false;
                    XmlNodeList nodeActivities = node.SelectSingleNode("Activities").ChildNodes;
                    foreach (XmlNode nodeAct in nodeActivities)
                    {
                        string strActId = nodeAct.InnerText.Trim();
                        if (!string.IsNullOrWhiteSpace(strActId))
                        {
                            int actId = 0;
                            if (int.TryParse(strActId, out actId))
                            {

                                if (actId == this.ID)
                                {
                                    isMatchAct = true;
                                    break;
                                }
                            }
                        }
                    }

                    bool isMatchField = false;
                    if (isMatchAct)
                    {
                        string field = node.SelectSingleNode("Field").InnerText;
                        string entityValue = Convert.ToString(this.Template.MasterData[field]);
                        XmlNodeList nodeValues = node.SelectSingleNode("Values").ChildNodes;
                        foreach (XmlNode nodeValue in nodeValues)
                        {
                            if (entityValue.Equals(nodeValue.InnerText, StringComparison.OrdinalIgnoreCase))
                            {
                                isMatchField = true;
                                break;
                            }
                        }
                    }

                    if (isMatchAct && isMatchField)
                    {
                        XmlNodeList nodeUsers = node.SelectSingleNode("Users").ChildNodes;
                        foreach (XmlNode nodeUser in nodeUsers)
                        {
                            string uid = nodeUser.InnerText.Trim();
                            if (!string.IsNullOrWhiteSpace(uid))
                            {
                                WFUser wfUser = new WFUser(uid);
                                wfUser.IsKeyUser = true;
                                listUsers.Add(wfUser);
                            }
                        }
                    }
                }
            }

            return listUsers;
        }