Beispiel #1
0
        protected void AssignDispute(object sender, DirectEventArgs e)
        {
            PhoneCall        sessionPhoneCallRecord;
            List <PhoneCall> submittedPhoneCalls;
            List <PhoneCall> userSessionPhoneCalls;

            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"];
            settings.NullValueHandling = NullValueHandling.Ignore;

            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);

                sessionPhoneCallRecord.UiCallType      = "Disputed";
                sessionPhoneCallRecord.UiMarkedOn      = DateTime.Now;
                sessionPhoneCallRecord.UiUpdatedByUser = sipAccount;

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

            PhoneCallsAllocationToolsMenu.Hide();

            //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);
        }
Beispiel #2
0
        protected void AssignSelectedPhonecallsToMe_DirectEvent(object sender, DirectEventArgs e)
        {
            List <PhoneCall> submittedPhoneCalls;
            List <PhoneCall> userSessionPhoneCalls;

            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)
            {
                //Assign the call to this user
                phoneCall.UiAssignedToUser = sipAccount;
                phoneCall.UiCallType       = string.Empty;

                //Update this phonecall in the database
                Global.DATABASE.PhoneCalls.Update(phoneCall, phoneCall.PhoneCallsTableName);

                //Commit the changes to the grid and it's store
                ModelProxy model = DepartmentPhoneCallsStore.Find("SessionIdTime", phoneCall.SessionIdTime.ToString());

                //Remove from the Departments's phoneCalls Store
                DepartmentPhoneCallsStore.Remove(model);

                //Add it to the phonecalls store
                MyPhoneCallsGrid.GetStore().Add(phoneCall);

                //Add this new phonecall to the user session
                userSessionPhoneCalls.Add(phoneCall);
            }

            //Reload the department phonecalls grid
            DepartmentPhoneCallsGrid.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);
        }
Beispiel #3
0
        //
        // STORE LOADERS
        protected void MyPhoneCallsStore_Load(object sender, EventArgs e)
        {
            if (!Ext.Net.X.IsAjaxRequest)
            {
                //Get use session and user phonecalls list.
                CurrentSession = ((UserSession)HttpContext.Current.Session.Contents["UserData"]);

                //Get user session phonecalls; handle normal user mode and delegee mode
                List <PhoneCall> userSessionPhoneCalls = CurrentSession.GetUserSessionPhoneCalls().Where(phoneCall => string.IsNullOrEmpty(phoneCall.UiCallType) == true).ToList();

                MyPhoneCallsGrid.GetStore().DataSource = userSessionPhoneCalls;
                MyPhoneCallsGrid.GetStore().DataBind();
            }
        }
Beispiel #4
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);
        }
Beispiel #5
0
        protected void PhoneCallsTypeFilter(object sender, DirectEventArgs e)
        {
            //User session phonecalls container
            List <PhoneCall> userSessionPhoneCalls;

            //The phone calls type filter
            string phoneCallsTypeFilter = Convert.ToString(HelperFunctions.ReturnEmptyIfNull(FilterTypeComboBox.SelectedItem.Value));


            if (phoneCallsTypeFilter != "Unallocated")
            {
                //Get user session phonecalls; handle normal user mode and delegee mode
                userSessionPhoneCalls = CurrentSession.GetUserSessionPhoneCalls().Where(phoneCall => phoneCall.UiCallType == phoneCallsTypeFilter).ToList();

                //Bind them to the Grid
                MyPhoneCallsGrid.GetStore().DataSource = userSessionPhoneCalls;
                MyPhoneCallsGrid.GetStore().DataBind();

                //Enable/Disable the context menu items
                PhoneBookNameEditorTextbox.ReadOnly = true;

                if (phoneCallsTypeFilter == "Personal")
                {
                    AllocatePhonecallsAsPersonal.Disabled         = true;
                    AllocateDestinationsAsAlwaysPersonal.Disabled = true;

                    AllocatePhonecallsAsDispute.Disabled          = false;
                    AllocatePhonecallsAsBusiness.Disabled         = false;
                    AllocateDestinationsAsAlwaysBusiness.Disabled = false;
                }

                if (phoneCallsTypeFilter == "Business")
                {
                    AllocatePhonecallsAsBusiness.Disabled         = true;
                    AllocateDestinationsAsAlwaysBusiness.Disabled = true;

                    AllocatePhonecallsAsDispute.Disabled          = false;
                    AllocatePhonecallsAsPersonal.Disabled         = false;
                    AllocateDestinationsAsAlwaysPersonal.Disabled = false;
                }

                if (phoneCallsTypeFilter == "Disputed")
                {
                    AllocatePhonecallsAsDispute.Disabled = true;

                    AllocatePhonecallsAsBusiness.Disabled         = false;
                    AllocatePhonecallsAsPersonal.Disabled         = false;
                    AllocateDestinationsAsAlwaysBusiness.Disabled = false;
                    AllocateDestinationsAsAlwaysPersonal.Disabled = false;
                }
            }
            else
            {
                //Get user session phonecalls; handle normal user mode and delegee mode
                userSessionPhoneCalls = CurrentSession.GetUserSessionPhoneCalls().Where(phoneCall => string.IsNullOrEmpty(phoneCall.UiCallType)).ToList();

                //Bind them to the Grid
                MyPhoneCallsGrid.GetStore().DataSource = userSessionPhoneCalls;
                MyPhoneCallsGrid.GetStore().DataBind();

                //Enable/Disable the context menu items
                PhoneBookNameEditorTextbox.ReadOnly = false;

                AllocatePhonecallsAsDispute.Disabled  = false;
                AllocatePhonecallsAsBusiness.Disabled = false;
                AllocatePhonecallsAsPersonal.Disabled = false;

                AllocateDestinationsAsAlwaysPersonal.Disabled = false;
                AllocateDestinationsAsAlwaysBusiness.Disabled = false;
            }
        }