/// <summary> Обновить статус контакта </summary> public static void RefreshModelContactStatus(ModelContact modelContact) { var presenceStatus = Logic.GetPresenceStatusesByXmppIds(new [] { modelContact.XmppId }); modelContact.ModelEnumUserBaseStatusObj = ModelEnumUserBaseStatus.GetModelEnum(Convert.ToInt32(presenceStatus.FirstOrDefault(obj => obj.XmppId == modelContact?.XmppId)?.BaseStatus)); modelContact.UserExtendedStatus = presenceStatus.FirstOrDefault(obj => obj.XmppId == modelContact.XmppId)?.ExtStatus; }
private void SendEmail(ModelContact model) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); //set the addresses mail.From = new MailAddress("*****@*****.**"); mail.To.Add("*****@*****.**"); //set the content mail.Subject = "VNS WEB Mail"; mail.Body = "Party Name " + model.Name + "<br />" + "Party City" + model.City + "<br />" + "Party Contry" + model.Country + "<br />" + "Party Email" + model.Email + "<br />" + "Party PhoneNumber" + model.PhoneNumber + "<br />" + "Party Requirements" + model.YourRequirements + "<br />"; mail.IsBodyHtml = true; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "nayudunz"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); }
///<summary> Метод изменения статуса пользователя </summary> private void ChengeContactStatus(ModelContact modelContact) { if (modelContact == null) { return; } StackPanelBlocked.Visibility = Visibility.Hidden; TextBlockSentRequest.Visibility = Visibility.Hidden; ButtonSendRequest.Visibility = Visibility.Hidden; MenuItemBlock.Visibility = Visibility.Collapsed; MenuItemUnblock.Visibility = Visibility.Collapsed; if (modelContact.Blocked) { StackPanelBlocked.Visibility = Visibility.Visible; MenuItemUnblock.Visibility = Visibility.Visible; } else { MenuItemBlock.Visibility = Visibility.Visible; if (modelContact.Id > 0) { TextBlockSentRequest.Visibility = Visibility.Visible; } else { ButtonSendRequest.Visibility = Visibility.Visible; } } }
/// <summary> Событие клика по "шапке" в элементе list-a для сворачивания и разворачивания номеров </summary> private void ListBoxElementHeaderClick(object sender, RoutedEventArgs e) { var item = sender as Button; if (item != null) { var currentContact = item.DataContext as ExtendedModelContact; if (currentContact != null) { if (!currentContact.IsExpand) { var expandedContacts = CurrentListModelContact.Where(a => a.IsExpand); foreach (var contact in expandedContacts) { contact.IsExpand = false; } currentContact.IsExpand = true; _currentExpandContact = currentContact.ModelContactObj; ChengeContactStatus(_currentExpandContact); } else { currentContact.IsExpand = false; _currentExpandContact = null; } } } }
/// <summary> Конструктор </summary> public ViewModelContactDetail(ModelContact modelContact) { CurrentModelContact = modelContact; CommandDelete = new Command(obj => { if (DataSourceContact.DeleteModelContact(CurrentModelContact)) { OnDeleteModelContactSuccessful(); } }); CommandApplyInvite = new Command(obj => ApplyInvite()); CommandDenyInvite = new Command(obj => DenyInvite()); CommandAddToWhite = new Command(obj => { AddToWhite(); OnWhiteChanged(); }); CommandDeleteFromWhite = new Command(obj => { DeleteFromWhite(); OnWhiteChanged(); }); CommandSendRequest = new Command(obj => SendRequest()); CommandBlock = new Command(obj => { DataSourceContact.BlockModelContact(CurrentModelContact); OnBlockedChanged(); }); CommandUnblock = new Command(obj => { DataSourceContact.UnblockModelContact(CurrentModelContact); OnBlockedChanged(); }); CurrentModelContact.PropertyChanged += CurrentModelContact_PropertyChanged; }
public ActionResult Edit(ModelContact modelContact, FormCollection field) { String baoloi = ""; if (ModelState.IsValid) { try { Random repid = new Random(); /* String subject = field["subject"];*/ /* String address = modelContact.Email;*/ String message = field["message"]; modelContact.ReplayID = repid.Next(1, 10000); modelContact.ReplayDetail = message; modelContact.Update_At = DateTime.Now; modelContact.Update_By = (int?)Session["UserIdAdmin"]; db.Entry(modelContact).State = EntityState.Modified; db.SaveChanges(); /* this.SendEmail(address, subject, message);*/ return(RedirectToAction("Index")); } catch { baoloi += "khong thanh cong"; } } ViewBag.Error = baoloi; return(View(modelContact)); }
/// <summary> Конструктор </summary> public ViewCallActive(ModelContact modelContact) { InitializeComponent(); _viewModelCallActive = new ViewModelCallActive(modelContact); DataContext = _viewModelCallActive; if (_viewModelCallActive.CurrentModelCall != null && _viewModelCallActive.CurrentModelCall.IsDodicall && _viewModelCallActive.CurrentModelCall.ModelContactObj?.ModelContactSubscriptionObj != null && _viewModelCallActive.CurrentModelCall.ModelContactObj.ModelContactSubscriptionObj.ModelEnumSubscriptionStateObj.Code == 3 /* Both */) { ButtonChat.Visibility = Visibility.Visible; } else { ButtonChat.Visibility = Visibility.Hidden; } _viewModelCallActive.CloseView += ViewModelCallActiveOnCloseView; _viewModelCallActive.EventViewModel += ViewModelCallActiveOnEventViewModel; _viewModelCallActive.CommandCallTransfer = new Command(obj => ShowCallTransferWindow()); }
public ActionResult Email(ModelContact model) { SendEmail(model); model = new ModelContact(); model.Succesmessage = "Thank You For your Interest With VNS Our Representative Will Get Back You Shortely"; return(View("../Home/Contact", model)); }
/// <summary> Удалить контакт из список выбранных </summary> public void UnselectModelContact(ModelContact modelContact) { //SelectedListModelContact.Remove(modelContact); ХЗ почему не работает SelectedListModelContact.Remove(SelectedListModelContact.FirstOrDefault(obj => modelContact.DodicallId == obj.DodicallId)); OnEventViewModel("ChangedCountSelected"); OnPropertyChanged("CountSelectedModelContact"); OnPropertyChanged("SelectedModelContactList"); }
/// <summary> Начать исходящий звонок </summary> public static bool StartOutgoingCallUrl(ModelContact modelContact, string number) { var contactModelManaged = DataSourceContact.GetContactModelManagedFromModelContact(modelContact); var numberForCompare = number.Replace(" ", "").Replace("+", ""); return(Logic.StartCallToContactUrl(contactModelManaged, contactModelManaged.Contacts.First(obj => obj.Identity.Replace(" ", "").Replace("+", "") == numberForCompare), CallOptionsManaged.Default)); }
public ActionResult DeleteConfirmed(int id) { ModelContact modelContact = db.Contact.Find(id); db.Contact.Remove(modelContact); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> Отклонить приглашение </summary> public static bool DenyInviteModelContact(ModelContact modelContact) { var contactModelManaged = GetContactModelManagedFromModelContact(modelContact); var test = Logic.AnswerSubscriptionRequest(contactModelManaged, false); return(test); }
///<summary> Установить выделение на контакте (Временный кастыль для демо !!!) </summary> private void SetSelectedListBoxContact(ModelContact modelContact) { var modelContactFromList = _viewModelContact.CurrentListModelContact.FirstOrDefault(obj => obj.Id == modelContact.Id); if (modelContactFromList != null) { _viewModelContact.CurrentModelContact = modelContactFromList; } }
///<summary> Создание контрола запросов </summary> private Grid CreateRequestControl(ModelContact modelContact) { var result = new Grid { Height = 53, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(58) }, new ColumnDefinition(), new ColumnDefinition{ Width = new GridLength(56) } } }; result.MouseEnter += (sender, args) => result.Background = Brushes.WhiteSmoke; result.MouseLeave += (sender, args) => result.Background = Brushes.Transparent; var grid = new Grid { Height = 36, Width = 36, Margin = new Thickness(8, 0, 10, 0) }; Grid.SetColumn(grid, 0); grid.Children.Add(new Image { Source = modelContact.Avatar }); grid.Children.Add(new Image { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Height = 15, Width = 15, Source = UtilityPicture.GetBitmapImageFromStringUri(@"/Resources/IconTray_small.png") }); var textBlock = new TextBlock { FontWeight = FontWeights.Bold, FontSize = 14, TextTrimming = TextTrimming.CharacterEllipsis, VerticalAlignment = VerticalAlignment.Center, Text = modelContact.FullName }; Grid.SetColumn(textBlock, 1); var image = new Image { Margin = new Thickness(5, 5, 8, 5), Height = 17, Width = 16, Source = UtilityPicture.GetBitmapImageFromStringUri(@"/Resources/sent_request.png") }; Grid.SetColumn(image, 2); result.Children.Add(grid); result.Children.Add(textBlock); result.Children.Add(image); result.MouseLeftButtonDown += (sender, args) => OpenModelContactDetail(modelContact); result.DataContext = modelContact; return(result); }
/// <summary> Исходящий звонок </summary> public static void OutgoingCall(ModelContact modelContact) { if (modelContact == null) { return; } WindowMain.ShowInRightWorkspaceFront(new ViewCallActive(modelContact)); }
public ActionResult Create([Bind(Include = "Id,FullName,Email,Phone,Title,Detail,ReplayDetail,ReplayID,Created_At,Update_At,Update_By,Status")] ModelContact modelContact) { if (ModelState.IsValid) { db.Contact.Add(modelContact); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(modelContact)); }
/// <summary> Обработчик изменения ModelContact </summary> private void ModelContactOnPropertyChanged(ModelContact modelContact) { if (String.IsNullOrWhiteSpace(modelContact?.FirstName) && String.IsNullOrWhiteSpace(modelContact?.LastName)) { ButtonOk.IsEnabled = false; } else { ButtonOk.IsEnabled = true; } }
private void ApplyInvite(ModelContact modelContact) { if (modelContact == null || modelContact.Id > 0) { return; } _viewModelContactRequestInvite.CommandApplyInvite.Execute(modelContact); //if (modelContact.Id > 0) ((Button)sender).Visibility = Visibility.Collapsed; }
/// <summary> Пометить приглашение как прочитанное </summary> public static bool ReadInvite(ModelContact modelContact) { var result = Logic.MarkSubscriptionAsOld(modelContact.XmppId); if (result) { modelContact.ModelContactSubscriptionObj.ModelEnumSubscriptionStatusObj = ModelEnumSubscriptionStatus.GetModelEnum(2); } return(result); }
///<summary> Открыть вкладку контактов и выбрать контакт </summary> public void OpenContact(ModelContact modelContact) { GridContact_Click(null, null); var modelContactFromList = _viewModelContact.CurrentListModelContact.FirstOrDefault(obj => obj.Id == modelContact.Id); if (modelContactFromList != null) { _viewModelContact.CurrentModelContact = modelContactFromList; } }
public ActionResult Restore(int id) { ModelContact modelContact = db.Contact.Find(id); if (modelContact != null) { modelContact.Status = 1; db.Entry(modelContact).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Trash", "Contacts")); }
/// <summary> Возвращает чат с контактом (если чата нет то создаст новый) </summary> public static ModelChat GetModelChatByModelContact(ModelContact modelContact) { var arrayContactModelManaged = new[] { DataSourceContact.GetContactModelManagedFromModelContact(modelContact) }; var result = GetModelChatFromChatModelManaged(Logic.CreateChatWithContacts(arrayContactModelManaged)); RefreshModelContactChatStatus(new List <ModelChat> { result }); return(result); }
/// <summary> Конструктор </summary> public ViewModelManualContact() { CurrentModelContact = new ModelContact { ListModelUserContactExtra = new List <ModelUserContact>() }; CommandSave = new Command(obj => Save()); CommandAddUserContact = new Command(obj => AddUserContact()); AddUserContact(); }
///<summary> Метод принятия приглашения </summary> public void ApplyInvite(ModelContact modelContact) { if (modelContact == null) { return; } if (DataSourceContact.ApplyInviteModelContact(modelContact)) { OnApplyInviteSuccessful(modelContact); } }
///<summary> Метод отправки запроса контакту </summary> public void SendRequest(ModelContact modelContact) { if (modelContact == null) { return; } if (DataSourceContact.SendRequestModelContact(modelContact)) { OnSendRequestSuccessful(modelContact); } }
/// <summary> Изменение статуса контакта </summary> private void ChengeContactStatus(ModelContact modelContact) { if (modelContact == null) { return; } if (_currentExpandContact == null) { return; } if (_currentExpandContact.Id != modelContact.Id) { return; } switch (modelContact.ModelEnumUserBaseStatusObj?.Code) { case 1: foreach (var image in _listImageSip) { image.Source = UtilityPicture.GetBitmapImageFromStringUri("/Resources/transfer_online.png"); } break; case 3: foreach (var image in _listImageSip) { image.Source = UtilityPicture.GetBitmapImageFromStringUri("/Resources/transfer_dnd.png"); } break; default: foreach (var image in _listImageSip) { image.Source = UtilityPicture.GetBitmapImageFromStringUri("/Resources/transfer_default_offline.png"); } break; } if (!modelContact.IsAccessStatus) { foreach (var image in _listImageSip) { image.Source = UtilityPicture.GetBitmapImageFromStringUri("/Resources/transfer_default_offline.png"); } } }
/// <summary> Добавить контакт в список выбранных </summary> public void SelectModelContact(ModelContact modelContact) { if (SelectedListModelContact.FirstOrDefault(obj => obj.DodicallId == modelContact.DodicallId) != null) { return; } SelectedListModelContact.Add(modelContact); OnEventViewModel("ChangedCountSelected"); OnPropertyChanged("CountSelectedModelContact"); OnPropertyChanged("SelectedModelContactList"); }
/// <summary> Конструктор </summary> private WindowCallActive(ModelContact modelContact, string number) { InitializeComponent(); _viewModelCallActive = new ViewModelCallActive(modelContact, number); DataContext = _viewModelCallActive; Instance = this; _viewModelCallActive.CloseView += ViewModelCallActiveOnCloseView; _viewModelCallActive.EventViewModel += ViewModelCallActiveOnEventViewModel; }
// GET: Admin/Contacts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ModelContact modelContact = db.Contact.Find(id); if (modelContact == null) { return(HttpNotFound()); } return(View(modelContact)); }
/// <summary> Исходящий звонок (для контакта и его конкретного номера) </summary> public static void OutgoingCall(ModelContact modelContact, string number) { if (String.IsNullOrWhiteSpace(number) || modelContact == null || ViewModelCallActive.ExistCall) { return; } if (Instance == null) { var windowCall = new WindowCallActive(modelContact, number); windowCall.Show(); } }