1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Messaging;
using System.Configuration;
namespace ApplicationSendMsgInQueue
{
public class MyNewQueue
{
static void Main(string[] args)
{
MyNewQueue newQueue = new MyNewQueue();
newQueue.SendMessageToQueue();
Console.WriteLine("L'employer a été bien enregistré");
Console.ReadLine();
}
public void SendMessageToQueue()
{
Employees employees = new Employees();
Employees[] employeesTable = new Employees[6];
employeesTable[0] = new Employees { EmployerID =Guid.NewGuid().ToString() , EmployeesName = "YESSOUFOU", EmployeesLastName = "Mohamed", EmployeesAddress = "15 rue Paris 75019", EmailEmployees = "modyes599@hotmail.com" };
employeesTable[1] = new Employees { EmployerID =Guid.NewGuid().ToString(), EmployeesName = "YESSOUFOU", EmployeesLastName = "Mourad", EmployeesAddress = "15 rue Paris 75018", EmailEmployees = "modyes199@hotmail.com" };
employeesTable[2] = new Employees { EmployerID =Guid.NewGuid().ToString(), EmployeesName = "YESSOUFOU", EmployeesLastName = "Adam", EmployeesAddress = "15 rue Paris 75017", EmailEmployees = "modyes99@hotmail.com" };
employeesTable[3] = new Employees { EmployerID =Guid.NewGuid().ToString(), EmployeesName = "YESSOUFOU", EmployeesLastName = "Ziadath", EmployeesAddress = "15 rue Paris 75016", EmailEmployees = "modyes299@hotmail.com" };
employeesTable[4] = new Employees { EmployerID =Guid.NewGuid().ToString(), EmployeesName = "YESSOUFOU", EmployeesLastName = "Manzidath", EmployeesAddress = "15 rue Paris 75015", EmailEmployees = "modyes399@hotmail.com" };
employeesTable[5] = new Employees { EmployerID =Guid.NewGuid().ToString(), EmployeesName = "YESSOUFOU", EmployeesLastName = "Fawaz", EmployeesAddress = "15 rue Paris 75014", EmailEmployees = "modyes499@hotmail.com" };
MessageQueue Myqueue = new MessageQueue(ConfigurationManager.AppSettings["MessageQueuePath"]);
for (int i = 0; i < (employeesTable.Length); i++)
{
Myqueue.Send(employeesTable[i]);
}
return;
}
}
} |
Partager