Exemple #1
0
        public void Try_AddItemsToMasterIndex()
        {
            var           master = ObjectIndex.Instance;
            IDomainObject chair  = new Chair()
            {
                DisplayName = "My Chair"
            };
            IComposedObject diningRoom = new DiningRoom()
            {
                DisplayName = "My DiningRoom"
            };

            diningRoom.AddPart(chair);

            //Master.Reg(diningRoom);
            Console.WriteLine("AFTER ADDING THE DININGROOM:{0} items", master.Count());
            Console.WriteLine("Found DiningRooms:");
            foreach (var i in master.GetAll())
            {
                Console.WriteLine(String.Format("\t{0}", i.DisplayName));
            }
            diningRoom.AddPart(new Table {
                DisplayName = "Some Table", Id = "SPECIAL_TABLE"
            });
            diningRoom.AddPart(new Table {
                DisplayName = "Some other Table"
            });
            var res = master.GetAll <Table>();

            if (!res.Any())
            {
                Console.WriteLine("Found no Tables");
            }
            else
            {
                Console.WriteLine("Found Tables:");
                foreach (var i in res)
                {
                    Console.WriteLine("\t{0}", i.DisplayName);
                }
            }

            //REMOVING
            master.Unregister(chair);
            Console.WriteLine("AFTER REMOVING THE CHAIR:{0} items", master.Count());
            foreach (var i in master.GetAll())
            {
                Console.WriteLine("\t{0}", i.DisplayName);
            }


            master.Unregister(diningRoom);
            Console.WriteLine("AFTER REMOVING THE DININGROOM:{0} items", master.Count());
            foreach (var i in master.GetAll())
            {
                Console.WriteLine("\t{0}", i.DisplayName);
            }
        }
Exemple #2
0
    public static void Main()
    {
        RemotingConfiguration.Configure("src/Clients/DiningRoom.exe.config", false);
        DiningRoom diningRoom = new DiningRoom();

        Application.Run(diningRoom.gui);
        diningRoom.centralNode.OrderReadyEvent -= diningRoom.handleReadyOrder;
        diningRoom.gui.MakeOrderEvent          -= diningRoom.MakeOrder;
        diningRoom.gui.ServeOrderEvent         -= diningRoom.handleServedOrder;
    }
        public string InsertarComedor(DiningRoom comedor)
        {
            int result;

            try
            {
                using (var context = new ProyectoMaestriaEntities())
                {
                    var repetido = context.DiningRoom.SingleOrDefault(x => x.Code == comedor.Code);
                    if (repetido == null)
                    {
                        var std = new DiningRoom()
                        {
                            //    ID = comedor.ID,
                            Code              = comedor.Code,
                            Name              = comedor.Name,
                            Address           = comedor.Address,
                            Phone             = comedor.Phone,
                            Email             = comedor.Email,
                            Neiborhood        = comedor.Neiborhood,
                            City              = comedor.City,
                            Contact           = comedor.Contact,
                            ContactEmail      = comedor.ContactEmail,
                            ContactPhone      = comedor.ContactPhone,
                            ChildNumber       = comedor.ChildNumber,
                            ScheduleReception = comedor.ScheduleReception
                        };
                        context.DiningRoom.Add(std);

                        result = context.SaveChanges();
                        if (result == 0)
                        {
                            return("no se ha podido ingresar el registro");
                        }
                        else
                        {
                            return(std.ID.ToString());
                        }
                    }
                    else
                    {
                        return("el registro ya se encuentra en la base de datos");
                    }
                }
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
        public string UpdateDinner(DiningRoom comedor)
        {
            int modify = 0;

            try
            {
                using (var context = new ProyectoMaestriaEntities())
                {
                    var result = context.DiningRoom.SingleOrDefault(b => b.ID == comedor.ID);
                    if (result != null)
                    {
                        result.Code              = comedor.Code;
                        result.Name              = comedor.Name;
                        result.Address           = comedor.Address;
                        result.Phone             = comedor.Phone;
                        result.Email             = comedor.Email;
                        result.Neiborhood        = comedor.Neiborhood;
                        result.City              = comedor.City;
                        result.Contact           = comedor.Contact;
                        result.ContactEmail      = comedor.ContactEmail;
                        result.ContactPhone      = comedor.ContactPhone;
                        result.ChildNumber       = comedor.ChildNumber;
                        result.ScheduleReception = comedor.ScheduleReception;


                        modify = context.SaveChanges();
                        if (modify == 0)
                        {
                            return("no se ha podido modificar el registro");
                        }
                        else
                        {
                            return("se ha modificado el registro satisfactoriamente");
                        }
                    }
                    else
                    {
                        return("no se ha encontrado coincidencia en la base de datos");
                    }
                }
            }

            catch (Exception e)
            {
                return(e.Message);
            }
        }
        public List <DiningRoom> GettAllDinners()
        {
            List <DiningRoom> diningRooms = new List <DiningRoom>();

            using (var context = new ProyectoMaestriaEntities())
            {
                var result = context.DiningRoom.ToList();


                if (result != null)
                {
                    foreach (var temp in result)
                    {
                        DiningRoom diningRoom = new DiningRoom();
                        diningRoom.ID                = temp.ID;
                        diningRoom.Code              = temp.Code;
                        diningRoom.Name              = temp.Name;
                        diningRoom.Address           = temp.Address;
                        diningRoom.Phone             = temp.Phone;
                        diningRoom.Email             = temp.Email;
                        diningRoom.Neiborhood        = temp.Neiborhood;
                        diningRoom.City              = temp.City;
                        diningRoom.Contact           = temp.Contact;
                        diningRoom.ContactEmail      = temp.ContactEmail;
                        diningRoom.ContactPhone      = temp.ContactPhone;
                        diningRoom.ChildNumber       = temp.ChildNumber;
                        diningRoom.ScheduleReception = temp.ScheduleReception;
                        diningRooms.Add(diningRoom);
                    }

                    return(diningRooms);
                }
                else
                {
                    return(diningRooms);
                }
            }
        }
Exemple #6
0
 public Fork(int id, DiningRoom room)
 {
     this.room = room;
     Id        = id + 1;
 }
        public string Update(DiningRoom comedor)
        {
            LogicBL logicBL = new LogicBL();

            return(logicBL.UpdateDinner(comedor));
        }
        public string Insert(DiningRoom comedor)
        {
            LogicBL logicBL = new LogicBL();

            return(logicBL.InsertComedor(comedor));
        }
 protected DiningRoomStaff(DiningRoom diningRoom) : base()
 {
     this.diningRoom = diningRoom;
 }
Exemple #10
0
        public string UpdateDinner(DiningRoom code)
        {
            ComedorDAL comedordal = new ComedorDAL();

            return(comedordal.UpdateDinner(code));
        }
Exemple #11
0
        public string InsertarComedor(DiningRoom comedor)
        {
            ComedorDAL comedordal = new ComedorDAL();

            return(comedordal.InsertarComedor(comedor));
        }
Exemple #12
0
 public Sensor(int id, DiningRoom room)
 {
     this.room = room;
     Id        = id + 1;
 }