private void button3_Click_1(object sender, EventArgs e) { using (var ctx = new testEntities_wrokgroup()) { try { var users = from ex in ctx.crm_aspect_monitor_workgroup2 select ex; foreach (var c in users) { wrokgroup wrokgroupaspect = utils.TransToWrokgroup(c); string jsonkey = string.Format("workgroup_{0}", c.workgroupId); string jsonvalue = JsonConvert.SerializeObject(wrokgroupaspect); 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); } } }
public static wrokgroup TransToWrokgroup(object t) { wrokgroup wrokgroupaspect = new wrokgroup(); crm_aspect_monitor_workgroup2 c = (crm_aspect_monitor_workgroup2)t; wrokgroupaspect.workgroupId = c.workgroupId; wrokgroupaspect.acceptSeconds = c.acceptSeconds; wrokgroupaspect.acdCalls = c.acdCalls; wrokgroupaspect.activeSeconds = c.activeSeconds; wrokgroupaspect.agdCalls = c.agdCalls; wrokgroupaspect.aodCalls = c.aodCalls; wrokgroupaspect.chatCalls = c.chatCalls; wrokgroupaspect.conferenceCalls = c.conferenceCalls; wrokgroupaspect.connectSeconds = c.connectSeconds; wrokgroupaspect.consultationCalls = c.consultationCalls; wrokgroupaspect.ctiCalls = c.ctiCalls; wrokgroupaspect.didCalls = c.didCalls; wrokgroupaspect.emailCalls = c.emailCalls; wrokgroupaspect.heldCalls = c.heldCalls; wrokgroupaspect.heldCeconds = c.heldCeconds; wrokgroupaspect.idleCeconds = c.idleCeconds; wrokgroupaspect.imCalls = c.imCalls; wrokgroupaspect.internalCalls = c.internalCalls; wrokgroupaspect.internalSeconds = c.internalSeconds; wrokgroupaspect.loggedinSeconds = c.loggedinSeconds; wrokgroupaspect.manualCalls = c.manualCalls; wrokgroupaspect.manualSeconds = c.manualSeconds; wrokgroupaspect.multiSeconds = c.multiSeconds; wrokgroupaspect.notReadySeconds = c.notReadySeconds; wrokgroupaspect.numberOfCallbacks = c.numberOfCallbacks; wrokgroupaspect.numberOfRefusals = c.numberOfRefusals; wrokgroupaspect.numberOfSuccesses = c.numberOfSuccesses; wrokgroupaspect.otherSeconds = c.otherSeconds; wrokgroupaspect.parkSeconds = c.parkSeconds; wrokgroupaspect.previewSeconds = c.previewSeconds; wrokgroupaspect.reservedCalls = c.reservedCalls; wrokgroupaspect.reservedCallsReceived = c.reservedCallsReceived; wrokgroupaspect.reservedSeconds = c.reservedSeconds; wrokgroupaspect.reservedSecondsReceived = c.reservedSecondsReceived; wrokgroupaspect.transferredCalls = c.transferredCalls; wrokgroupaspect.workgroup = c.workgroup; wrokgroupaspect.wrapSeconds = c.wrapSeconds; wrokgroupaspect.acceptedCallsCount = c.acceptedCallsCount; wrokgroupaspect.rejectedCallsCount = c.rejectedCallsCount; return(wrokgroupaspect); }