Example #1
0
        private void dgCallList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // CALL LIST
            // 고객 정보
            DataGrid view = e.Source as DataGrid;
            CallList item = view.SelectedItem as CallList;

            if (item == null)
            {
                e.Handled = true;
                return;
            }

            flycustomer = GetCustomerByIdx(item.Cust_Idx);

            if (flycustomer.Idx == -1)
            {
                flycustomer = new Customer() { Group_Idx = 0, Idx = item.Cust_Idx, Cellular = item.Cust_Tel };
                flyCustomer.Header = Application.Current.FindResource("PB_DATAGRID_CUST_TOP_LABEL_0").ToString();
                CustState = CUSTOMER_STATE.ADD;
            }
            else
            {
                flyCustomer.Header = Application.Current.FindResource("PB_DATAGRID_CUST_TOP_LABEL_1").ToString();
                CustState = CUSTOMER_STATE.MODIFY;
            }

            btnCustSave.Visibility = Visibility.Visible;
            dgridCustCallList.ItemsSource = GetCallListByCustIdx(flycustomer.Idx, flycustomer.Cellular);
            flyCustomer.DataContext = flycustomer;
            flyCustomer.IsOpen = true;
        }
Example #2
0
        private void MenuItem_Click_12(object sender, RoutedEventArgs e)
        {
            // CALL LIST
            // 고객 정보
            MenuItem menuitem = (MenuItem)e.Source;
            ContextMenu cm = (ContextMenu)menuitem.Parent;
            DataGrid view = (DataGrid)cm.PlacementTarget;
            CallList item = (CallList)view.SelectedItem;

            flycustomer = GetCustomerByIdx(item.Cust_Idx);

            if (flycustomer == null)
            {
                flycustomer = new Customer() { Group_Idx = 0, Idx = item.Cust_Idx, Cellular = item.Cust_Tel };
                flyCustomer.Header = Application.Current.FindResource("PB_DATAGRID_CUST_TOP_LABEL_0").ToString();
                CustState = CUSTOMER_STATE.ADD;
            }
            else
            {
                flyCustomer.Header = Application.Current.FindResource("PB_DATAGRID_CUST_TOP_LABEL_1").ToString();
                CustState = CUSTOMER_STATE.MODIFY;
            }

            btnCustSave.Visibility = Visibility.Visible;
            flyCustomer.DataContext = flycustomer;
            flyCustomer.IsOpen = true;
        }
Example #3
0
        private void MenuItem_Click_4(object sender, RoutedEventArgs e)
        {
            CustState = CUSTOMER_STATE.ADD;

            // 고객 추가
            GroupList gselitem = tvGroup.SelectedItem as GroupList;
            if (gselitem != null)
            {
                flycustomer = new Customer() { Group_Idx = gselitem.Idx };
            }
            else
            {
                flycustomer = new Customer();
            }

            flyCustomer.DataContext = flycustomer;
            flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_ADD").ToString();
            flyCustomer.IsOpen = true;
        }
Example #4
0
        private void MenuItem_Click_5(object sender, RoutedEventArgs e)
        {
            CustState = CUSTOMER_STATE.MODIFY;

            // 고객 수정
            MenuItem menuitem = (MenuItem)e.Source;
            ContextMenu cm = (ContextMenu)menuitem.Parent;
            DataGrid view = (DataGrid)cm.PlacementTarget;
            Customer item = (Customer)view.SelectedItem;

            flycustomer = new Customer() { Idx = item.Idx, Group_Idx = item.Group_Idx, Name = item.Name, Company = item.Company, Title = item.Title, Tel = item.Tel, Cellular = item.Cellular, Extension = item.Extension, Email = item.Email, Addr = item.Addr };

            flyCustomer.DataContext = flycustomer;
            // cmbGroup.SelectedValue = flycustomer.Group_Idx;
            flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_EDIT").ToString();
            flyCustomer.IsOpen = true;
        }
Example #5
0
        private void MenuItem_Click_4_1(object sender, RoutedEventArgs e)
        {
            // 고객 excel로 추가
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Multiselect = false;
            openFileDialog.Filter = "Excel 97-2013|*.xls";
            openFileDialog.FilterIndex = 1;
            openFileDialog.ShowDialog();

            string xlsfilename = openFileDialog.FileName;

            if (string.IsNullOrEmpty(xlsfilename))
                return;

            openFileDialog.Dispose();

            DataSet ds = ExcelHelper.OpenExcelDB(xlsfilename);

            if (ds != null)
            {
                if (ds.Tables.Count == 1)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Customer _customer = new Customer() {
                            Group_Name = row[0].ToString().Trim(),
                            Name = row[1].ToString().Trim(),
                            Company = row[2].ToString().Trim(),
                            Title = row[3].ToString().Trim(),
                            Tel = row[4].ToString().Trim(),
                            Cellular = row[5].ToString().Trim(),
                            Extension = row[6].ToString().Trim(),
                            Email = row[7].ToString().Trim(),
                            Addr = row[8].ToString().Trim()
                        };
                        customers.importExcel(_customer);
                    }
                }
            }
        }
Example #6
0
        private void dgCustList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // 고객 수정
            DataGrid view = e.Source as DataGrid;
            Customer item = view.SelectedItem as Customer;

            if (item == null)
            {
                e.Handled = true;
                return;
            }

            flycustomer = new Customer() { Idx = item.Idx, Group_Idx = item.Group_Idx, Name = item.Name, Company = item.Company, Title = item.Title, Tel = item.Tel, Cellular = item.Cellular, Extension = item.Extension, Email = item.Email, Addr = item.Addr };

            flyCustomer.DataContext = flycustomer;
            // cmbGroup.SelectedValue = flycustomer.Group_Idx;
            flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_EDIT").ToString();
            dgridCustCallList.ItemsSource = GetCallListByCustIdx(flycustomer.Idx, flycustomer.Cellular);
            flyCustomer.IsOpen = true;

            CustState = CUSTOMER_STATE.MODIFY;
        }
Example #7
0
        private void MenuItem_Click_3(object sender, RoutedEventArgs e)
        {
            // 고객 추가
            flycustomer = new Customer() { Group_Idx = ((GroupList)tvGroup.SelectedItem).Idx };
            flyCustomer.DataContext = flycustomer;
            flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_ADD").ToString();
            flyCustomer.IsOpen = true;
            dgridCustCallList.ItemsSource = null;

            CustState = CUSTOMER_STATE.ADD;
        }
Example #8
0
        public Customer GetCustomerByTel(string tel)
        {
            DataTable dt;
            Customer cust = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    db.SetParameters("@I_IDX", FbDbType.VarChar, tel);
                    dt = db.GetDataTableSP("GET_CUSTOMER_BY_TEL");

                    foreach (DataRow row in dt.Rows)
                    {
                        cust = new Customer()
                        {
                            IsChecked = false,
                            IsSelected = false,
                            Idx = string.IsNullOrEmpty(row[0].ToString()) == false ? int.Parse(row[0].ToString()) : -1,
                            Group_Idx = string.IsNullOrEmpty(row[1].ToString()) == false ? int.Parse(row[1].ToString()) : 0,
                            Name = row[2].ToString(),
                            Company = row[3].ToString(),
                            Title = row[4].ToString(),
                            Tel = row[5].ToString(),
                            Cellular = row[6].ToString(),
                            Extension = row[7].ToString(),
                            Email = row[8].ToString(),
                            Addr = row[9].ToString(),
                            Etc = row[10].ToString()
                        };
                    }
                }
                catch (FbException ex)
                {
                    util.WriteLog(ex.ErrorCode, ex.Message);
                }
            }

            return cust;
        }
Example #9
0
        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;
        }
Example #10
0
        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;
        }
Example #11
0
        // Send Sms
        public void SendSms(Customer customer, string smsmsg, string sender)
        {
            try
            {
                sms_msg msg = this.GetSmsMessage(USRSTRUCTS.SMS_SEND_REQ, smsmsg, sender, customer.Cellular, string.Empty, string.Empty);
                byte[] bytes = util.GetBytes(msg);

                client.Send(bytes, bytes.Length);
            }
            catch (SocketException ex)
            {
                util.WriteLog(ex.ErrorCode, ex.Message.ToString());
            }

            // Thread.Sleep(100);
        }