Пример #1
0
        private void UpdateCallHistoryView()
        {
            CallButlerDataset.CallHistoryDataTable callHistoryTbl = callButlerDataset.CallHistory;
            CallButlerDataset.CallHistoryRow[]     callHistory    = (CallButlerDataset.CallHistoryRow [])callHistoryTbl.Select("", "Timestamp DESC");

            toolTip.RemoveAll();
            pnlCallHistory.Controls.Clear();

            // Only display as many as will fit on the screen
            const int labelHeight = 24;
            int       maxItems    = pnlCallHistory.Height / labelHeight;
            int       totalItems  = Math.Min(callHistory.Length, maxItems);

            pnlCallHistory.SuspendLayout();
            for (int index = totalItems - 1; index >= 0; index--)
            {
                Label callItemLabel = CreateCallItemLabel();

                callItemLabel.Text = callHistory[index].Timestamp.ToShortDateString() + " " + callHistory[index].Timestamp.ToShortTimeString() + " - ";

                if (!callHistory[index].IsCallerDisplayNameNull() && callHistory[index].CallerDisplayName.Length > 0)
                {
                    callItemLabel.Text += callHistory[index].CallerDisplayName;
                }
                else
                {
                    callItemLabel.Text += CallButler.Manager.Utils.PrivateLabelUtils.ReplaceProductName(Properties.LocalizedStrings.SummaryView_UnkownCaller);
                }

                if (!callHistory[index].IsCallerUsernameNull() && callHistory[index].CallerUsername.Length > 0)
                {
                    callItemLabel.Text += " @ " + WOSI.Utilities.StringUtils.FormatPhoneNumber(callHistory[index].CallerUsername);
                }

                toolTip.SetToolTip(callItemLabel, callItemLabel.Text);

                pnlCallHistory.Controls.Add(callItemLabel);
            }
            pnlCallHistory.ResumeLayout(true);

            //callHistoryTbl.Locale = new System.Globalization.CultureInfo(System.Globalization.CultureInfo.CurrentCulture.LCID);

            CallButlerDataset.CallHistoryRow[] calls = (CallButlerDataset.CallHistoryRow[])callHistoryTbl.Select("Timestamp >= #" + DateTime.Now.ToString("d", System.Globalization.CultureInfo.InvariantCulture) + " 00:00#");
            lblCallsToday.Text = calls.Length.ToString();

            DateTime startDate = DateTime.Now.AddDays(-(int)DateTime.Now.DayOfWeek);

            calls             = (CallButlerDataset.CallHistoryRow[])callHistoryTbl.Select("Timestamp >= #" + DateTime.Now.ToString("d", System.Globalization.CultureInfo.InvariantCulture) + "#");
            lblCallsWeek.Text = calls.Length.ToString();

            DateTime now = DateTime.Now;

            startDate          = new DateTime(now.Year, now.Month, 1);
            calls              = (CallButlerDataset.CallHistoryRow[])callHistoryTbl.Select("Timestamp >= #" + DateTime.Now.ToString("d", System.Globalization.CultureInfo.InvariantCulture) + "#");
            lblCallsMonth.Text = calls.Length.ToString();

            lblCallsTotal.Text = callHistoryTbl.Count.ToString();
        }
        public override CallButler.Data.CallButlerDataset.CallHistoryDataTable GetCallHistory(int customerID)
        {
            CallButler.Data.CallButlerDataset.CallHistoryDataTable callHistoryTable = new CallButlerDataset.CallHistoryDataTable();

            callHistoryTable.Merge(data.CallHistory);
            callHistoryTable.AcceptChanges();

            return(callHistoryTable);
        }
        public override CallButler.Data.CallButlerDataset.CallHistoryDataTable GetCallHistory(int customerID)
        {
            CallButler.Data.CallButlerDataset.CallHistoryDataTable callHistoryTable = new CallButlerDataset.CallHistoryDataTable();

            callHistoryTable.Merge(data.CallHistory);
            callHistoryTable.AcceptChanges();

            return callHistoryTable;
        }