private bool InitGroupInfo(MessageCenterChatInfo info)
        {
            bool result;

            if (info.Type == MessageCenterType.EntGroup)
            {
                EntGroup group = this.dataService.GetEntGroup(info.Id);
                if (group != null)
                {
                    this.tbkID.Text     = info.Id.ToString();
                    this.tbkName.Text   = group.Name;
                    this.tbkDate.Text   = info.LastTime;
                    this.imgHead.Source = group.AdminIcon;
                    this.gp             = group;
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
        private bool InitStaffInfo(MessageCenterChatInfo info)
        {
            bool result;

            if (info.Type == MessageCenterType.EntStaff)
            {
                Staff staf = this.dataService.GetStaff(info.Id);
                if (staf != null && staf.HeaderImage != null)
                {
                    this.tbkID.Text     = info.Id.ToString();
                    this.tbkName.Text   = staf.Name;
                    this.tbkDate.Text   = info.LastTime;
                    this.imgHead.Source = staf.HeaderImageOnline;
                    this.staff          = staf;
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
Exemplo n.º 3
0
 public void AddChatInfo(MessageCenterChatInfo messageCenterInfo)
 {
     if (messageCenterInfo != null)
     {
         ChatInfo chatInfo = new ChatInfo();
         chatInfo.name     = messageCenterInfo.Name;
         chatInfo.lasttime = messageCenterInfo.LastTime;
         chatInfo.id       = messageCenterInfo.Id;
         chatInfo.type     = (int)messageCenterInfo.Type;
         ChatInfoList list = this.GetLocalChatInfoList();
         if (list != null && list.chatinfo != null)
         {
             ChatInfo info = this.FindChatInfoItem(list, chatInfo.id, chatInfo.type);
             if (info == null)
             {
                 list.chatinfo.Add(chatInfo);
             }
             else
             {
                 info.lasttime = chatInfo.lasttime;
                 info.name     = chatInfo.name;
             }
         }
         else
         {
             list = new ChatInfoList();
             list.chatinfo.Add(chatInfo);
         }
         this.SaveLocalChatInfoList(list);
     }
 }
Exemplo n.º 4
0
        private Staff IsDepartStaff(MessageCenterChatInfo infom, long Departid)
        {
            Staff      staff         = null;
            Department Currentdepart = this.dataService.GetDepartment(Departid);
            Staff      result;

            foreach (Staff st in this.listsatff)
            {
                if (infom.Id == st.Uid && st.DepartmentId == Currentdepart.Id)
                {
                    staff = (result = st);
                    return(result);
                }
            }
            System.Collections.Generic.ICollection <Department> departList = this.dataService.GetDepartmentList();
            System.Collections.Generic.IList <long>             id         = new System.Collections.Generic.List <long>();
            this.GetClickdepart.Clear();
            id.Add(Departid);
            System.Collections.Generic.IList <Department> depart = this.GetDepart(id, departList);
            foreach (Department dep in depart)
            {
                foreach (Staff st in this.listsatff)
                {
                    if (infom.Id == st.Uid && st.DepartmentId == dep.Id)
                    {
                        staff = (result = st);
                        return(result);
                    }
                }
            }
            result = staff;
            return(result);
        }
        public bool InitData(MessageCenterChatInfo info)
        {
            bool result;

            if (info.Type == MessageCenterType.EntStaff)
            {
                result = this.StaffHeadInfo(info);
            }
            else
            {
                result = this.GroupHeadInfo(info);
            }
            return(result);
        }
 //internal Image imgHead;
 //internal TextBlock tbkName;
 //internal TextBlock tbkID;
 //internal TextBlock tbkDate;
 ////private bool _contentLoaded;
 public RecentContactsItem(MessageCenterChatInfo info, bool InitGroup, bool All)
 {
     if (info != null)
     {
         this.InitializeComponent();
         this.InitServer();
         if (All)
         {
             if (this.InitData(info))
             {
                 this.IsValue = true;
             }
             else
             {
                 this.IsValue = false;
             }
         }
         else
         {
             if (InitGroup)
             {
                 if (this.InitGroupInfo(info))
                 {
                     this.IsValue = true;
                 }
                 else
                 {
                     this.IsValue = false;
                 }
             }
             else
             {
                 if (this.InitStaffInfo(info))
                 {
                     this.IsValue = true;
                 }
                 else
                 {
                     this.IsValue = false;
                 }
             }
         }
         this.AddEventListener();
     }
 }
Exemplo n.º 7
0
        private int CompareChatInfoValue(MessageCenterChatInfo infoX, MessageCenterChatInfo infoY)
        {
            string x = infoX.LastTime;
            string y = infoY.LastTime;
            int    result;

            if (x == null)
            {
                if (y == null)
                {
                    result = 0;
                }
                else
                {
                    result = -1;
                }
            }
            else
            {
                if (y == null)
                {
                    result = 1;
                }
                else
                {
                    int retval = x.Length.CompareTo(y.Length);
                    if (retval != 0)
                    {
                        result = retval;
                    }
                    else
                    {
                        result = x.CompareTo(y);
                    }
                }
            }
            return(result);
        }