Ejemplo n.º 1
0
        private void button9_Click(object sender, EventArgs e)
        {
            using (var ctx = new testEntities_table())
            {
                try
                {
                    var users = from ex in ctx.crm_aspect_monitor_table2 select ex;
                    foreach (var c in users)
                    {
                        table  tableaspect = utils.TransTotable(c);
                        string jsonkey     = string.Format("table_{0}", c.tableId);
                        string jsonvalue   = JsonConvert.SerializeObject(tableaspect);
                        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);
                }
            }
        }
Ejemplo n.º 2
0
        public static table TransTotable(object t)
        {
            table tableaspect           = new table();
            crm_aspect_monitor_table2 c = (crm_aspect_monitor_table2)t;

            tableaspect.tableId              = c.tableId;
            tableaspect.filter               = c.filter;
            tableaspect.service              = c.service;
            tableaspect.status               = c.status;
            tableaspect.application          = c.application;
            tableaspect.applicationId        = c.applicationId;
            tableaspect.serviceId            = c.serviceId;
            tableaspect.serviceType          = c.serviceType;
            tableaspect.serviceTypeId        = c.serviceTypeId;
            tableaspect.startTimeMilitary    = c.startTimeMilitary;
            tableaspect.statusId             = c.statusId;
            tableaspect.scheduledCallbacks   = c.scheduledCallbacks;
            tableaspect.abandoned            = c.abandoned;
            tableaspect.badPhoneNumberCount  = c.badPhoneNumberCount;
            tableaspect.dialed               = c.dialed;
            tableaspect.endTimeMilitary      = c.endTimeMilitary;
            tableaspect.excludedCount        = c.excludedCount;
            tableaspect.filterId             = c.filterId;
            tableaspect.inProgress           = c.inProgress;
            tableaspect.leftToBeDialed       = c.leftToBeDialed;
            tableaspect.recordsProcessed     = c.recordsProcessed;
            tableaspect.rgBusyQueueCount     = c.rgBusyQueueCount;
            tableaspect.selected             = c.selected;
            tableaspect.serviceTableId       = c.serviceTableId;
            tableaspect.tableName            = c.tableName;
            tableaspect.timezoneFailureCount = c.timezoneFailureCount;
            tableaspect.touchedcount         = c.touchedcount;
            tableaspect.timezoneIdentifier   = c.timezoneIdentifier;
            tableaspect.utcStartTime         = c.utcStartTime;
            tableaspect.utcStopTime          = c.utcStopTime;

            return(tableaspect);
        }