Exemple #1
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);
        }
Exemple #2
0
        private void DepartmentPhoneCallsGridManager(bool GetFreshData = true, bool BindData = true)
        {
            if (GetFreshData == true || departmentPhoneCalls == null)
            {
                //string SiteDepartment = session.NormalUserInfo.SiteName + "_" + session.NormalUserInfo.Departments;
                string SiteDepartment =
                    (CurrentSession.ActiveRoleName == Functions.UserDelegeeRoleName) ?
                    CurrentSession.DelegeeUserAccount.User.SiteName + "-" + CurrentSession.DelegeeUserAccount.User.DepartmentName :
                    CurrentSession.User.SiteName + "-" + CurrentSession.User.DepartmentName;

                departmentPhoneCalls = Global.DATABASE.PhoneCalls.GetChargeableCallsBySipAccount(SiteDepartment).ToList();
            }

            if (BindData == true)
            {
                DepartmentPhoneCallsGrid.GetStore().DataSource = departmentPhoneCalls;
                DepartmentPhoneCallsGrid.GetStore().DataBind();
            }
        }
Exemple #3
0
 protected void PhoneCallsTabsPanel_TabChange(object sender, DirectEventArgs e)
 {
     MyPhoneCallsGrid.GetStore().Reload();
     DepartmentPhoneCallsGrid.GetStore().Reload();
 }