상속: DbContext
예제 #1
0
파일: Form1.cs 프로젝트: boldtbanan/StartR
        private void button3_Click(object sender, EventArgs e)
        {
            var factory = new ConnectionFactory()
            {
                HostName = "localhost"
            };

            using (var connection = factory.CreateConnection())
            {
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare("StartR", true, false, false, null);
                    StartREntities db = new StartREntities();
                    var            q  = db.Clients.OrderBy(m => m.LastName).Take(10);
                    foreach (var client in q)
                    {
                        QualifyClientCommand cmd = new QualifyClientCommand();
                        cmd.Address1  = client.Address1;
                        cmd.Address2  = client.Address2;
                        cmd.City      = client.City;
                        cmd.FirstName = client.FirstName;
                        cmd.Id        = client.Id;
                        cmd.LastName  = client.LastName;
                        cmd.State     = client.State;
                        cmd.Zip       = client.Zip;
                        var ser  = new XmlSerializer <QualifyClientCommand>();
                        var body = Encoding.UTF8.GetBytes(ser.Serialize(cmd));
                        channel.BasicPublish("", "StartR", null, body);
                    }
                }
                toolStripStatusLabel1.Text = "Done sending clients.";
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: keithelder/StartR
 private void button3_Click(object sender, EventArgs e)
 {
     var factory = new ConnectionFactory() { HostName = "localhost" };
     using (var connection = factory.CreateConnection())
     {
         using (var channel = connection.CreateModel())
         {
             channel.QueueDeclare("StartR", true, false, false, null);
             StartREntities db = new StartREntities();
             var q = db.Clients.OrderBy(m => m.LastName).Take(10);
             foreach (var client in q)
             {
                 QualifyClientCommand cmd = new QualifyClientCommand();
                 cmd.Address1 = client.Address1;
                 cmd.Address2 = client.Address2;
                 cmd.City = client.City;
                 cmd.FirstName = client.FirstName;
                 cmd.Id = client.Id;
                 cmd.LastName = client.LastName;
                 cmd.State = client.State;
                 cmd.Zip = client.Zip;
                 var ser = new XmlSerializer<QualifyClientCommand>();
                 var body = Encoding.UTF8.GetBytes(ser.Serialize(cmd));
                 channel.BasicPublish("", "StartR", null, body);
             }
         }
         toolStripStatusLabel1.Text = "Done sending clients.";
     }
 }