示例#1
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);
     }
 }
 //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();
     }
 }
示例#3
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;
 }
 private void AddMessageCenterChatInfo(string name, long id, MessageCenterType type, string lasttime)
 {
     if (!string.IsNullOrEmpty(name) && id > 0L && !string.IsNullOrEmpty(lasttime))
     {
         MessageCenterChatInfo messageCenterInfo = new MessageCenterChatInfo();
         messageCenterInfo.Name = name;
         messageCenterInfo.Id = id;
         messageCenterInfo.Type = type;
         messageCenterInfo.LastTime = lasttime;
         LocalDataUtil.Instance.AddChatInfo(messageCenterInfo);
     }
 }
 private bool StaffHeadInfo(MessageCenterChatInfo info)
 {
     Staff staff = this.dataService.GetStaff(info.Id);
     bool result;
     if (staff != null && staff.HeaderImage != null)
     {
         this.tbkID.Text = info.Id.ToString();
         this.tbkName.Text = staff.Name;
         this.tbkDate.Text = info.LastTime;
         this.imgHead.Source = staff.HeaderImageOnline;
         this.staff = staff;
         result = true;
     }
     else
     {
         result = false;
     }
     return result;
 }
 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;
 }
 public bool InitData(MessageCenterChatInfo info)
 {
     bool result;
     if (info.Type == MessageCenterType.EntStaff)
     {
         result = this.StaffHeadInfo(info);
     }
     else
     {
         result = this.GroupHeadInfo(info);
     }
     return result;
 }
 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;
 }