public void SendSms(Customers items, string strmsg, string sender) { if (items != null) { smscustomers = new ObservableCollection<Customer>(items.ToList()); smsmsg = strmsg; smssender = sender; } foreach (Customer customer in smscustomers) { client.SendSms(customer, strmsg, sender); } //var item = smscustomers.FirstOrDefault<Customer>(); //if (item == null) //{ // smscustomers = null; // smsmsg = string.Empty; // smssender = string.Empty; //} //else //{ // client.SendSms(item, strmsg, sender); //} }
private void btnCustSave_Click(object sender, RoutedEventArgs e) { // 고객 추가/수정 save if (cmbGroup.SelectedIndex < 1) { MessageBox.Show(Application.Current.FindResource("MSG_ERR_CUSTOMER_EMPTY_GROUP").ToString(), Application.Current.FindResource("MSGBOX_TXT_TITLE").ToString()); cmbGroup.Focus(); return; } if (string.IsNullOrEmpty(flycustomer.Name)) { MessageBox.Show(Application.Current.FindResource("MSG_ERR_CUSTOMER_EMPTY_NAME").ToString(), Application.Current.FindResource("MSGBOX_TXT_TITLE").ToString()); txtName.Focus(); return; } if (string.IsNullOrEmpty(flycustomer.Tel) && string.IsNullOrEmpty(flycustomer.Cellular) && string.IsNullOrEmpty(flycustomer.Extension)) { MessageBox.Show(Application.Current.FindResource("MSG_ERR_CUSTOMER_EMPTY_TEL").ToString(), Application.Current.FindResource("MSGBOX_TXT_TITLE").ToString()); if (string.IsNullOrEmpty(txtName.Text)) txtName.Focus(); if (string.IsNullOrEmpty(txtCellular.Text)) txtCellular.Focus(); if (string.IsNullOrEmpty(txtExtension.Text)) txtExtension.Focus(); return; } if (customers == null) customers = new Customers(); if (CustState == CUSTOMER_STATE.ADD) { customers.add(flycustomer); } else if (CustState == CUSTOMER_STATE.MODIFY) { customers.modify(flycustomer); } flyCustomer.IsOpen = false; CustState = CUSTOMER_STATE.NONE; }
private void MenuItem_Click_10(object sender, RoutedEventArgs e) { // SMS 보내기 MenuItem menuitem = (MenuItem)e.Source; ContextMenu cm = (ContextMenu)menuitem.Parent; DataGrid view = (DataGrid)cm.PlacementTarget; Customers smscustlist = new Customers(); foreach (Customer item in view.ItemsSource) { if (item.IsChecked) smscustlist.Add(item); } if (smscustlist.Count < 1) { Customer item = (Customer)view.SelectedItem; smscustlist = new Customers(); smscustlist.Add(item); dgSmsReceiverList.ItemsSource = smscustlist; } else { dgSmsReceiverList.ItemsSource = smscustlist; } flySms.IsOpen = true; }
private void tvGroup_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { var val = e.NewValue as GroupList; if (val.Idx < 0) { e.Handled = true; return; } customers = new Customers(val.Idx); dgCustList.ItemsSource = customers; }
private void btnAddSms_Click(object sender, RoutedEventArgs e) { // SMS Flyout customer list add if (string.IsNullOrEmpty(txtSmsReceiver.Text.Trim())) { // e.Handled = true; return; } Customer cust = GetCustomerByTel(txtSmsReceiver.Text.Trim()); if (cust.Idx < 1) { cust = new Customer() { Cellular = txtSmsReceiver.Text.Trim() }; var items = dgSmsReceiverList.ItemsSource as Customers; if (items == null) { Customers custs = new Customers(); custs.Add(cust); dgSmsReceiverList.ItemsSource = custs; } else { var item = items.FirstOrDefault(x => x.Cellular.Equals(txtSmsReceiver.Text.Trim())); if (item != null) { txtSmsReceiver.Text = string.Empty; return; } items.Add(cust); // dgSmsReceiverList.ItemsSource = items; } } else { var items = dgSmsReceiverList.ItemsSource as Customers; if (items == null) { Customers custs = new Customers(); custs.Add(cust); dgSmsReceiverList.ItemsSource = custs; } else { var item = items.FirstOrDefault(x => x.Cellular.Equals(txtSmsReceiver.Text.Trim())); if (item != null) { txtSmsReceiver.Text = string.Empty; return; } items.Add(cust); // dgSmsReceiverList.ItemsSource = items; } } txtSmsReceiver.Text = string.Empty; }
private void MenuItem_Click_16(object sender, RoutedEventArgs e) { // SMS 탭, SMS 보내기 MenuItem menuitem = (MenuItem)e.Source; ContextMenu cm = (ContextMenu)menuitem.Parent; DataGrid view = (DataGrid)cm.PlacementTarget; Sms item = (Sms)view.SelectedItem; Customer tmpitem = new Customer() { Group_Idx = item.Cust_Idx, Name = item.Cust_Name, Cellular = item.Cust_Tel }; Customers smscustlist = new Customers(); smscustlist.Add(tmpitem); dgSmsReceiverList.ItemsSource = smscustlist; flySms.IsOpen = true; }