public static void SendInfo(string fromuser, string touser) { int FromUserIndex; ThreadTools.Users.Online.IsAuthenticated(fromuser, out FromUserIndex); NetTalk.BLL.Users apiusers = new NetTalk.BLL.Users(); NetTalk.DAL.TbUsers user = apiusers.Find(touser); if (user != null) { string CardDataHtml = "<p>", CardDataText = ""; if (user.TbVcard != null) { if (!string.IsNullOrEmpty(user.TbVcard.VcardEmail)) { CardDataHtml += "ایمیل: " + user.TbVcard.VcardEmail + "<br />"; CardDataText += "ایمیل: " + user.TbVcard.VcardEmail + ","; } if (!string.IsNullOrEmpty(user.TbVcard.VcardTelFax)) { CardDataHtml += "فکس: " + user.TbVcard.VcardTelFax + "<br />"; CardDataText += "فکس: " + user.TbVcard.VcardTelFax + ","; } if (!string.IsNullOrEmpty(user.TbVcard.VcardTelCell)) { CardDataHtml += "موبایل: " + user.TbVcard.VcardTelCell + "<br />"; CardDataText += "موبایل: " + user.TbVcard.VcardTelCell + ","; } if (!string.IsNullOrEmpty(user.TbVcard.VcardTelVoice)) { CardDataHtml += "داخلی: " + user.TbVcard.VcardTelVoice + "<br />"; CardDataText += "داخلی: " + user.TbVcard.VcardTelVoice + ","; } if (!string.IsNullOrEmpty(user.TbVcard.VcardTelVoice2)) { CardDataHtml += "مستقیم: " + user.TbVcard.VcardTelVoice2 + "<br />"; CardDataText += "مستقیم: " + user.TbVcard.VcardTelVoice2 + ","; } } CardDataHtml += "</p>"; ThreadTools.Users.Online[FromUserIndex].Send( XML.Messages.Create(touser, fromuser, CardDataText, CardDataHtml, null)); } }
public static Presence GetPresence(string username) { Presence p = new Presence(); NetTalk.BLL.Users api = new NetTalk.BLL.Users(); NetTalk.DAL.TbUsers user = api.Find(username); p.Show = GetShowType(user.TbUserStatus.UserStatus); p.Type = (user.TbUserStatus.UserIsOnline) ? PresenceType.available : PresenceType.unavailable; p.Status = user.TbUserStatus.UserStatusText; if (!string.IsNullOrEmpty(user.TbVcard.VcardPhoto)) { Element xtag = new Element("x"); xtag.Namespace = "vcard-temp:x:update"; Element photo = new Element("photo"); photo.Value = user.TbVcard.VcardPhoto; xtag.AddChild(photo); p.AddChild(xtag); } return(p); }