public ActionResult Delete(int id)
        {
            PersonLayer cersonLayer = new PersonLayer();

            cersonLayer.Delete(id);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public PerformerViewModel(Performer performer, PersonLayer parentState, MODBEntities db)
     : base(parentState, true)
 {
     _performer = performer;
     this.db    = db;
     EventClass.getInstance().UpdateEvent += Update;
 }
        public ActionResult Edit_get(int id)
        {
            PersonLayer      cpersonlayer      = new PersonLayer();
            PersonProperties cpersonproperties = cpersonlayer.person_layer.Single(p => p.ID == id);

            return(View(cpersonproperties));
        }
        // GET: Person
        public ActionResult Index()
        {
            PersonLayer             personLayer      = new PersonLayer();
            List <PersonProperties> personproperties = personLayer.person_layer.ToList();

            return(View(personproperties));
        }
Exemplo n.º 5
0
 public OrderViewModel(Order order, PersonLayer parentState, MODBEntities db)
     : base(parentState, true)
 {
     _order  = order;
     this.db = db;
     EventClass.getInstance().UpdateEvent += Update;
 }
 public ActionResult Edit_post(PersonProperties cPersonProperties)
 {
     if (ModelState.IsValid)
     {
         PersonLayer cpersonlayer = new PersonLayer();
         cpersonlayer.Editperson(cPersonProperties);
         return(RedirectToAction("Index"));
     }
     return(View(cPersonProperties));
 }
 public ActionResult Create(PersonProperties CpersonProperties)
 {
     if (ModelState.IsValid)
     {
         PersonLayer personlayer = new PersonLayer();
         personlayer.AddPerson(CpersonProperties);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemplo n.º 8
0
        //send message to all room
        public ActionResult CheckAllRoom(MessageHTML m)
        {
            MessageLayer   memlayer = new MessageLayer();
            List <Message> mlist    = memlayer.GetMessage();

            DormLayer layer       = new DormLayer();
            Dorm      dorm        = layer.GetDorm(Session["UserName"].ToString());
            int       sender_dorm = dorm.Dorm_ID;

            int         mlistid  = mlist.Count;
            Message     mem      = new Message();
            RoomLayer   RoomDB   = new RoomLayer();
            List <Room> RoomList = RoomDB.GetStatusRoom(); //only room that have person live

            foreach (Room r in RoomList)
            {
                if (r.Dorm_ID == sender_dorm)
                {
                    PersonLayer   PL            = new PersonLayer();
                    List <Person> personoomList = PL.GetPerson();
                    foreach (Person person in personoomList)
                    {
                        if (person.Room_ID == r.Room_ID)
                        {
                            mem = new Message();
                            mem.Receiver_Username = person.Username;
                            mem.Sender_Username   = Session["UserName"].ToString();
                            mem.MessageID         = mlistid + 1;
                            mem.Title             = m.Subject;
                            mem.Text   = m.Message;
                            mem.Isread = 0;
                            mem.Date   = DateTime.Now.ToString("dd-MM-yyyy") + " " +
                                         DateTime.Today.ToString("HH:mm:ss tt"); //Date + Time

                            db.Message.Add(mem);
                            db.SaveChanges();
                            mlistid++;
                        }
                    }
                }
            }


            //return mem.Receiver_Username + " " + mem.Sender_Username + " " +
            //   " " + mem.Date ;
            return(RedirectToAction("index", new
            {
                action = 1
            }));
        }
Exemplo n.º 9
0
        //send message to specific room

        public ActionResult CheckSpecificRoom(MessageHTML m, string receiver)
        {
            Message        mem          = new Message();
            bool           CheckRoom    = false;
            string         NotFoundRoom = "This room is available";
            MessageLayer   memlayer     = new MessageLayer();
            List <Message> mlist        = memlayer.GetMessage();


            DormLayer layer       = new DormLayer();
            Dorm      dorm        = layer.GetDorm(Session["UserName"].ToString());
            int       sender_dorm = dorm.Dorm_ID;


            /// scan username of room
            RoomLayer   Rl       = new RoomLayer();
            List <Room> roomList = Rl.GetStatusRoom(); //get only unavailable room

            foreach (Room room in roomList)
            {
                if (room.Dorm_ID == sender_dorm)
                {
                    //int.Parse(receiver)
                    String roomnum = room.Floor + room.Room_number;
                    if (roomnum == receiver)
                    {
                        PersonLayer   PL            = new PersonLayer();
                        List <Person> personoomList = PL.GetPerson();
                        foreach (Person person in personoomList)
                        {
                            if (person.Room_ID == room.Room_ID)
                            {
                                mem.Receiver_Username = person.Username;
                                CheckRoom             = true;
                            }
                        }
                    }
                }
            }
            ///

            mem.Sender_Username = Session["UserName"].ToString();
            mem.MessageID       = mlist.Count + 1;
            mem.Title           = m.Subject;
            mem.Isread          = 0;
            mem.Text            = m.Message;
            mem.Date            = DateTime.Now.ToString("dd-MM-yyyy") + " " +
                                  DateTime.Today.ToString("HH:mm:ss tt"); //Date + Time
            if (CheckRoom == true)
            {
                db.Message.Add(mem);
                db.SaveChanges();

                return(RedirectToAction("Index", new
                {
                    action = 1
                }));
            }
            else
            {
                return(View("Messenger"));
                //return NotFoundRoom;
            }

            // return mem.Receiver_Username + " " + mem.Sender_Username + " " +
            //    " " + mem.Date;
        }