コード例 #1
0
        //
        // Data Binding/Re-binding function
        private void RebindDataToStore(List <PhoneCall> phoneCallsData)
        {
            MyPhoneCallsGrid.GetSelectionModel().DeselectAll();

            MyPhoneCallsGrid.GetStore().RemoveAll();

            //
            // Trigger the PhoneCallsTypeFilter OnSelect Event
            PhoneCallsTypeFilter(null, null);
        }
コード例 #2
0
        protected void AutomarkCalls_Clicked(object sender, DirectEventArgs e)
        {
            List <PhoneCall> userSessionPhoneCalls;
            Dictionary <string, PhoneBookContact> userSessionAddressbook;
            PhoneBookContact addressBookEntry;
            int numberOfRemainingUnmarked;

            //Get the unmarked calls from the user session phonecalls container
            CurrentSession.FetchSessionPhonecallsAndAddressbookData(out userSessionPhoneCalls, out userSessionAddressbook);

            numberOfRemainingUnmarked = userSessionPhoneCalls.Where(phoneCall => string.IsNullOrEmpty(phoneCall.UiCallType)).ToList().Count;

            //If the user has no addressbook contacts, skip the auto marking process
            if (userSessionAddressbook.Keys.Count > 0)
            {
                foreach (var phoneCall in userSessionPhoneCalls.Where(phoneCall => string.IsNullOrEmpty(phoneCall.UiCallType)))
                {
                    if (userSessionAddressbook.Keys.Contains(phoneCall.DestinationNumberUri))
                    {
                        addressBookEntry = (PhoneBookContact)userSessionAddressbook[phoneCall.DestinationNumberUri];

                        if (!string.IsNullOrEmpty(addressBookEntry.Type))
                        {
                            phoneCall.UiCallType      = addressBookEntry.Type;
                            phoneCall.UiUpdatedByUser = sipAccount;
                            phoneCall.UiMarkedOn      = DateTime.Now;

                            Global.DATABASE.PhoneCalls.Update(phoneCall, phoneCall.PhoneCallsTableName);

                            ModelProxy model = MyPhoneCallsGrid.GetStore().Find("SessionIdTime", phoneCall.SessionIdTime.ToString());
                            model.Set(phoneCall);
                            model.Commit();
                        }
                    }
                }
            }

            MyPhoneCallsGrid.GetSelectionModel().DeselectAll();
            MyPhoneCallsGrid.GetStore().LoadPage(1);

            CurrentSession.AssignSessionPhonecallsAndAddressbookData(userSessionPhoneCalls, userSessionAddressbook);
        }
コード例 #3
0
        protected void MoveToDepartmnent(object sender, DirectEventArgs e)
        {
            PhoneCall        sessionPhoneCallRecord;
            List <PhoneCall> submittedPhoneCalls;
            List <PhoneCall> userSessionPhoneCalls;
            string           userSiteDepartment = string.Empty;

            string json = string.Empty;
            JavaScriptSerializer   serializer = new JavaScriptSerializer();
            JsonSerializerSettings settings   = new JsonSerializerSettings();

            //Get the session and sip account of the current user
            //CurrentSession = ((UserSession)HttpContext.Current.Session.Contents["UserData"]);
            sipAccount = CurrentSession.GetEffectiveSipAccount();

            //Get user phonecalls from the session
            //Handle user delegee mode and normal user mode
            userSessionPhoneCalls = CurrentSession.GetUserSessionPhoneCalls();

            json = e.ExtraParams["Values"];
            submittedPhoneCalls = serializer.Deserialize <List <PhoneCall> >(json);

            foreach (PhoneCall phoneCall in submittedPhoneCalls)
            {
                var sessionIdTime = phoneCall.SessionIdTime;

                sessionPhoneCallRecord = userSessionPhoneCalls.Find(
                    item => item.SessionIdTime.Year == sessionIdTime.Year &&
                    item.SessionIdTime.Month == sessionIdTime.Month &&
                    item.SessionIdTime.Day == sessionIdTime.Day &&
                    item.SessionIdTime.Hour == sessionIdTime.Hour &&
                    item.SessionIdTime.Minute == sessionIdTime.Minute &&
                    item.SessionIdTime.Second == sessionIdTime.Second);

                if (sessionPhoneCallRecord.UiAssignedToUser == sipAccount && !string.IsNullOrEmpty(sessionPhoneCallRecord.UiAssignedByUser))
                {
                    userSiteDepartment =
                        (CurrentSession.ActiveRoleName == Functions.UserDelegeeRoleName) ?
                        CurrentSession.DelegeeUserAccount.User.SiteName + "-" + CurrentSession.DelegeeUserAccount.User.DepartmentName :
                        CurrentSession.User.SiteName + "-" + CurrentSession.User.DepartmentName;

                    sessionPhoneCallRecord.UiCallType       = string.Empty;
                    sessionPhoneCallRecord.UiAssignedToUser = userSiteDepartment;

                    Global.DATABASE.PhoneCalls.Update(sessionPhoneCallRecord, sessionPhoneCallRecord.PhoneCallsTableName);

                    ModelProxy model = MyPhoneCallsGrid.GetStore().Find("SessionIdTime", sessionPhoneCallRecord.SessionIdTime.ToString());

                    //Remove it from the MyPhoneCallsGrid.GetStore()
                    MyPhoneCallsGrid.GetStore().Remove(model);

                    //Add it to the Departments's phoneCalls Store
                    DepartmentPhoneCallsStore.Add(phoneCall);

                    //Remove from the user own session phoneCalls list.
                    userSessionPhoneCalls.Remove(sessionPhoneCallRecord);
                }
                else
                {
                    continue;
                }
            }

            //Deselect all the grid's records
            MyPhoneCallsGrid.GetSelectionModel().DeselectAll();

            //Reassign the user session data
            //Handle the normal user mode and user delegee mode
            CurrentSession.AssignSessionPhonecallsAndAddressbookData(userSessionPhoneCalls: userSessionPhoneCalls, userSessionAddressBook: null);

            //Rebind data to the grid store
            RebindDataToStore(userSessionPhoneCalls);
        }