Esempio n. 1
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            pb = new PhoneBook();
            pb.Owner = this;
            if (startpopup)
            {
                // pb.Show();

                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    SearchCondition1 con = new SearchCondition1();
                    con.StartDate = pb.sdate.Value;
                    con.EndDate = pb.edate.Value;
                    con.Number = string.IsNullOrEmpty(pb.txtNumber.Text.Trim()) == false ? string.Format("%{0}%", pb.txtNumber.Text.Trim()) : string.Empty;

                    if (pb.calls == null)
                    {
                        pb.calls = new CallLists(con);
                        pb.dgCallList.ItemsSource = pb.calls;
                    }

                    pb.tabs.SelectedIndex = 1;
                }));
            }

            //btnsatate = new MinicrmButtonStates() { RecordBtn = (Style)Application.Current.FindResource("btnREC_off") };
            //this.DataContext = btnsatate;

            btnsatate = this.DataContext as MinicrmButtonStates;
        }
Esempio n. 2
0
        private void Couplemodeclient_CallRingInEvent(object obj, CommandMsg msg)
        {
            if (curCall != null) return;

            curCall = new CallList()
            {
                Direction = 1,
                Cust_Tel = msg.from_ext,
                Startdate = DateTime.Now,
                ext = msg.from_ext,
                to_ext = msg.to_ext
            };

            Customer cust = pb.GetCustomerByTel(msg.from_ext);

            string strmsg = string.Empty;
            if (cust.Idx < 1)
            {
                pb.CUSTOMERSTATE = CUSTOMER_STATE.ADD;
                cust.Group_Idx = 0;
                cust.Cellular = msg.from_ext;
                strmsg = Application.Current.FindResource("MSG_CALL_IN").ToString();
            }
            else
            {
                pb.CUSTOMERSTATE = CUSTOMER_STATE.MODIFY;
                curCall.Cust_Idx = cust.Idx;
                curCall.Name = cust.Name;
                strmsg = string.Format(Application.Current.FindResource("MSG_CALL_IN2").ToString(), cust.Name);
            }

            SetMessage(strmsg);
            SetNumber(msg.from_ext);

            // CallLists calllists = new CallLists();
            // calllists.add(curCall);

            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                if (startpopup)
                {
                    if (pb == null)
                    {
                        pb = new PhoneBook();
                        pb.Owner = this;
                    }

                    // pb.Show();
                }

                SearchCondition1 con = new SearchCondition1();
                con.StartDate = pb.sdate.Value;
                con.EndDate = pb.edate.Value;
                con.Number = string.IsNullOrEmpty(pb.txtNumber.Text.Trim()) == false ? string.Format("%{0}%", pb.txtNumber.Text.Trim()) : string.Empty;

                if (pb.calls == null)
                {
                    pb.calls = new CallLists(con);
                    pb.dgCallList.ItemsSource = pb.calls;
                }

                pb.calls.add(curCall);

                if (pb.Visibility == Visibility.Collapsed || pb.Visibility == Visibility.Hidden)
                {
                    pb.tabs.SelectedIndex = 1;
                    pb.dgridCustCallList.ItemsSource = pb.GetCallListByCustIdx(cust.Idx, curCall.Cust_Tel);
                    pb.btnCustMemo.Visibility = Visibility.Visible;
                    pb.FlyCustomer = cust;
                    pb.flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_INFO").ToString();
                    pb.flyCustomer.IsOpen = true;

                    if (startpopup)
                    {
                        pb.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    pb.tabs.SelectedIndex = 1;
                    pb.dgridCustCallList.ItemsSource = pb.GetCallListByCustIdx(cust.Idx, curCall.Cust_Tel);
                    pb.btnCustMemo.Visibility = Visibility.Visible;
                    pb.FlyCustomer = cust;
                    pb.flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_INFO").ToString();

                    if (startpopup)
                    {
                        pb.flyCustomer.IsOpen = true;
                    }
                }
            }));

            this.UIChanging(msg.status);
        }
Esempio n. 3
0
        private void btnBooks_Click(object sender, RoutedEventArgs e)
        {
            if (pb == null)
            {
                pb = new PhoneBook();
                pb.Owner = this;
                pb.Show();
            }
            else
            {
                pb.Show();
            }
            pb.tabs.SelectedIndex = 0;

            this.ClearFocus((Button)sender);
        }