Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            using (var ctx = new testEntities_agentpri())
            {
                {
                    try
                    {
                        var users = from ex in ctx.crm_aspect_monitor_agent2 select ex;
                        foreach (var c in users)
                        {
                            agent  agentaspect = utils.TransToAgent(c);
                            string jsonkey     = string.Format("agent_{0}_{1}", c.userId, c.serviceId);
                            string jsonvalue   = JsonConvert.SerializeObject(agentaspect);
                            Console.WriteLine(jsonvalue);

                            if (mc.Get(jsonkey) != null)
                            {
                                bool b = mc.Store(StoreMode.Replace, jsonkey, jsonvalue);

                                Console.WriteLine(string.Format("replace key {0}============{1}", jsonkey, b));
                            }
                            else
                            {
                                bool b = mc.Store(StoreMode.Add, jsonkey, jsonvalue);

                                Console.WriteLine(string.Format("add key {0}============{1}", jsonkey, b));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Beispiel #2
0
        public static agent TransToAgent(object t)
        {
            agent agentaspect           = new agent();
            crm_aspect_monitor_agent2 c = (crm_aspect_monitor_agent2)t;

            agentaspect.userId                  = c.userId;
            agentaspect.serviceId               = c.serviceId;
            agentaspect.serviceType             = c.serviceType;
            agentaspect.serviceTypeId           = c.serviceTypeId;
            agentaspect.statusId                = c.statusId;
            agentaspect.acceptCalls             = c.acceptCalls;
            agentaspect.acceptSeconds           = c.acceptSeconds;
            agentaspect.acdCalls                = c.acdCalls;
            agentaspect.activeSeconds           = c.activeSeconds;
            agentaspect.agdCalls                = c.agdCalls;
            agentaspect.agentIndex              = c.agentIndex;
            agentaspect.aodCalls                = c.aodCalls;
            agentaspect.audioPath               = c.audioPath;
            agentaspect.chatCalls               = c.chatCalls;
            agentaspect.conferenceCalls         = c.conferenceCalls;
            agentaspect.connectSeconds          = c.connectSeconds;
            agentaspect.consultAtionCalls       = c.consultAtionCalls;
            agentaspect.ctiCalls                = c.ctiCalls;
            agentaspect.currentServiceId        = c.currentServiceId;
            agentaspect.didCalls                = c.didCalls;
            agentaspect.emailCalls              = c.emailCalls;
            agentaspect.firstName               = c.firstName;
            agentaspect.heldCalls               = c.heldCalls;
            agentaspect.heldSeconds             = c.heldSeconds;
            agentaspect.idleSeconds             = c.idleSeconds;
            agentaspect.imCalls                 = c.imCalls;
            agentaspect.internalCalls           = c.internalCalls;
            agentaspect.internalSeconds         = c.internalSeconds;
            agentaspect.lastDisposition         = c.lastDisposition;
            agentaspect.lastDispositionId       = c.lastDispositionId;
            agentaspect.lastName                = c.lastName;
            agentaspect.loggedInSeconds         = c.loggedInSeconds;
            agentaspect.manualCalls             = c.manualCalls;
            agentaspect.manualSeconds           = c.manualSeconds;
            agentaspect.monitoringCalls         = c.monitoringCalls;
            agentaspect.multiSeconds            = c.multiSeconds;
            agentaspect.notReadySeconds         = c.notReadySeconds;
            agentaspect.numberOfCallbacks       = c.numberOfCallbacks;
            agentaspect.numberOfRefusals        = c.numberOfRefusals;
            agentaspect.numberOfSuccesses       = c.numberOfSuccesses;
            agentaspect.otherSeconds            = c.otherSeconds;
            agentaspect.parkSeconds             = c.parkSeconds;
            agentaspect.previewSeconds          = c.previewSeconds;
            agentaspect.rejectCalls             = c.rejectCalls;
            agentaspect.reservedCalls           = c.reservedCalls;
            agentaspect.reservedCallsReceived   = c.reservedCallsReceived;
            agentaspect.reservedSeconds         = c.reservedSeconds;
            agentaspect.reservedSecondsReceived = c.reservedSecondsReceived;
            agentaspect.station                 = c.station;
            agentaspect.statusReason            = c.statusReason;
            agentaspect.statusReasonId          = c.statusReasonId;
            agentaspect.statusSeconds           = c.statusSeconds;
            agentaspect.statusStartTimeMilitary = c.statusStartTimeMilitary;
            agentaspect.transferredCalls        = c.transferredCalls;
            agentaspect.workgroup               = c.workgroup;
            agentaspect.workgroupId             = c.workgroupId;
            agentaspect.wrapSeconds             = c.wrapSeconds;
            agentaspect.contacts                = c.contacts;
            agentaspect.inactiveSeconds         = c.inactiveSeconds;
            agentaspect.timezoneIdentifier      = c.timezoneIdentifier;
            agentaspect.utcStartTime            = c.utcStartTime;
            agentaspect.application             = c.application;
            agentaspect.applicationId           = c.applicationId;
            agentaspect.service                 = c.service;
            agentaspect.status                  = c.status;
            agentaspect.timeArrival             = c.timeArrival;

            return(agentaspect);
        }