コード例 #1
0
ファイル: Sms.cs プロジェクト: step4u/MiniCRM
        public Smses(SearchCondition1 val)
        {
            DataTable dt;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    db.SetParameters("@I_SDATE", FbDbType.TimeStamp, val.StartDate);
                    db.SetParameters("@I_EDATE", FbDbType.TimeStamp, val.EndDate);
                    db.SetParameters("@I_NUMBER", FbDbType.VarChar, val.Number);

                    dt = db.GetDataTableSP("GET_SMS_LIST");

                    foreach (DataRow row in dt.Rows)
                    {
                        this.Add(new Sms()
                        {
                            Idx       = string.IsNullOrEmpty(row[0].ToString()) == false ? int.Parse(row[0].ToString()) : -1,
                            Cust_Idx  = string.IsNullOrEmpty(row[1].ToString()) == false ? int.Parse(row[1].ToString()) : -1,
                            Cust_Name = row[2].ToString(),
                            Cust_Tel  = row[3].ToString(),
                            Regdate   = string.IsNullOrEmpty(row[4].ToString()) == false ? DateTime.Parse(row[4].ToString()) : new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Local),
                            Memo      = row[5].ToString(),
                            Result    = string.IsNullOrEmpty(row[6].ToString()) == false ? int.Parse(row[6].ToString()) : -1
                        });
                    }
                }
                catch (FbException e)
                {
                    util.WriteLog(e.ErrorCode, e.Message);
                }
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: step4u/MiniCRM
        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;
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: step4u/MiniCRM
        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);
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: step4u/MiniCRM
        private void Client_SmsSentCompletedEvent(object obj, sms_msg msg)
        {
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                SearchCondition1 con = new SearchCondition1();
                con.StartDate = pb.sdate.Value;
                con.EndDate = pb.edate.Value;
                // Smses smslists = new Smses();
                if (pb.smslist == null)
                    pb.smslist = new Smses(con);

                Customer itm = smscustomers.FirstOrDefault(x => x.Cellular.Equals(msg.receiverphones));

                if (itm != null)
                {
                    Sms item = new Sms()
                    {
                        Cust_Name = itm.Name,
                        Cust_Tel = msg.receiverphones,
                        Memo = msg.message,
                        Regdate = DateTime.Now,
                        Result = msg.status
                    };

                    pb.smslist.add(item);
                    pb.dgSmsList.ItemsSource = pb.smslist;

                    smscustomers.Remove(itm);
                    this.SendSms(null, smsmsg, smssender);
                }
                
            }));
        }
コード例 #5
0
ファイル: PhoneBook.xaml.cs プロジェクト: step4u/MiniCRM
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            SearchCondition1 con = new SearchCondition1();
            con.StartDate = sdate.Value;
            con.EndDate = edate.Value;
            con.Number = string.IsNullOrEmpty(txtNumber.Text.Trim()) == false ? string.Format("%{0}%", txtNumber.Text.Trim()) : string.Empty;

            if (tabs.SelectedIndex == 1)
            {
                calls = new CallLists(con);
                dgCallList.ItemsSource = calls;
            }
            else if (tabs.SelectedIndex == 2)
            {
                smslist = new Smses(con);
                dgSmsList.ItemsSource = smslist;
            }
        }