Example #1
0
        public ActionResult Par(int id)
        {
            var client  = new RestClient("http://localhost:18080/IRMCJEE-web/IRMC/event/one?idEv=" + id);
            var request = new RestRequest(Method.GET);

            request.AddHeader("Content-type", "application/json");


            IRestResponse <List <_event> > u = client.Execute <List <_event> >(request);


            eventt = u.Data[0];

            fs.Participer(eventt.id_Ev);
            Data.user uss = new Data.user();
            IEnumerable <Data.user> ev = userSe.FindById(1);

            foreach (Data.user r in ev)
            {
                if (r.id == 1)
                {
                    uss = r;
                    break;
                }
                break;
            }


            fs.SendEmail(uss);
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult UpdateEvent(_event model)
 {
     if (ModelState.IsValid)
     {
         var dao = new EventsDAO();
         //Kiểm tra xem tên sự kiện này đã có chưa
         bool exist = dao.EventExistForUpdate(model.Name, Convert.ToInt32(model.ID));
         if (!exist)
         {
             UserLogin userlogin = (UserLogin)Session["USER_SESSION"];
             model.ModifiedBy = userlogin.UserName;
             string metatitle = CastString.Cast(model.Name);
             model.MetaTitle = metatitle;
             bool result = dao.UpdateEvent(model);
             if (result)
             {
                 SetAltert("Cập nhật sự kiện thành công", 0);
                 return(RedirectToAction("Index", "Events"));
             }
             else
             {
                 SetAltert("Chưa cập nhật sự kiện được", 2);
             }
         }
         else
         {
             SetAltert("Sự kiện này đã tồn tại", 2);
         }
     }
     else
     {
     }
     return(View(model));
 }
 void LoadEvent()
 {
     //Debug.Log(_turnBattleCount + " - " + _eventStart + " == " + _eventAround);
     if (_turnAround - _eventStart == _eventAround)
     {
         _eventStart   = _turnAround;
         _eventAround  = Random.Range(1, 4);
         _evenAttack   = 1;
         _currentEvent = (_event)Random.Range(0, 3);
         Debug.Log("New event is " + _currentEvent);
         if (_currentEvent == _event.Sunshine)
         {
             _core._eventPanel.GetComponent <Image>().sprite = _eventIcon[0];
             _core._environment[0].SetActive(false);
         }
         else if (_currentEvent == _event.Rain)
         {
             _core._environment[0].SetActive(true);
             _core._eventPanel.GetComponent <Image>().sprite = _eventIcon[1];
         }
         else if (_currentEvent == _event.Wind)
         {
             _core._eventPanel.GetComponent <Image>().sprite = _eventIcon[2];
             _core._environment[0].SetActive(false);
         }
     }
     _turnAround++;
 }
Example #4
0
        public ActionResult Edit(int id, EventViewModel FVM)
        {
            var client  = new RestClient("http://localhost:18080/IRMCJEE-web/IRMC/event/one?idEv=" + id);
            var request = new RestRequest(Method.GET);

            request.AddHeader("Content-type", "application/json");


            IRestResponse <List <_event> > u = client.Execute <List <_event> >(request);


            eventt = u.Data[0];

            // combinaison entre Model et view

            FVM.id_Ev       = eventt.id_Ev;
            FVM.title       = eventt.title;
            FVM.description = eventt.description;
            FVM.startDate   = eventt.startDate;
            FVM.endDate     = eventt.endDate;
            FVM.capacity    = eventt.capacity;
            FVM.cat         = eventt.cat;
            FVM.startDate   = localDate;
            FVM.image       = eventt.image;


            fs.Update(eventt);
            fs.Commit();
            return(View());
        }
Example #5
0
 public ActionResult CreateEvent(_event model)
 {
     if (ModelState.IsValid)
     {
         var  dao   = new EventsDAO();
         bool exits = dao.EventExist(model.Name);
         if (!exits)
         {
             //Lấy ra user đăng nhập để gán vào CreatedBY
             UserLogin userlogin = (UserLogin)Session["USER_SESSION"];
             model.CreatedBy = userlogin.UserName;
             string metatitle = CastString.Cast(model.Name);
             model.MetaTitle = metatitle;
             bool result = dao.CreateEvent(model);
             if (result)
             {
                 SetAltert("Tạo sự kiện thành công", 0);
                 return(RedirectToAction("Index", "Events"));
             }
             else
             {
                 SetAltert("Chưa tạo được sự kiện", 2);
             }
         }
         else
         {
             SetAltert("Sự kiện này đã có", 2);
         }
     }
     return(View(model));
 }
Example #6
0
        // GET: Event/Edit/5
        public ActionResult Edit(_event item)
        {
            {
                var u = ctx._event.Where(x => x.id_Ev == item.id_Ev).FirstOrDefault();

                if (ModelState.IsValid)
                {
                    u.title       = item.title;
                    u.description = item.description;
                    u.capacity    = item.capacity;
                    u.cat         = item.cat;
                    u.startDate   = item.startDate;
                    u.endDate     = item.endDate;
                    u.startDate   = localDate;



                    ctx.SaveChanges();

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(u));
                }
            }
        }
Example #7
0
        // GET: Formation/Edit/5
        public ActionResult Edit(int id)
        {
            var client  = new RestClient("http://localhost:18080/IRMCJEE-web/IRMC/event/one?idEv=" + id);
            var request = new RestRequest(Method.GET);

            request.AddHeader("Content-type", "application/json");


            IRestResponse <List <_event> > u = client.Execute <List <_event> >(request);


            eventt = u.Data[0];


            EventViewModel FVM = new EventViewModel();

            FVM.id_Ev       = eventt.id_Ev;
            FVM.title       = eventt.title;
            FVM.description = eventt.description;
            FVM.startDate   = eventt.startDate;
            FVM.endDate     = eventt.endDate;
            FVM.capacity    = eventt.capacity;
            FVM.cat         = eventt.cat;
            FVM.startDate   = localDate;
            FVM.image       = eventt.image;


            if (FVM == null)
            {
                return(HttpNotFound());
            }
            return(View(FVM));
        }
Example #8
0
        public ActionResult Edit(long id, EventViewModel FVM)
        {
            int idev    = (int)(long)id;
            var client  = new RestClient("http://localhost:18080/IRMCJEE-web/IRMC/event/one?idEv=" + idev);
            var request = new RestRequest(Method.GET);

            request.AddHeader("Content-type", "application/json");


            IRestResponse <List <_event> > u = client.Execute <List <_event> >(request);


            eventt = u.Data[0];
            // eventt = fs.GetById(id);

            // combinaison entre Model et view

            eventt.id_Ev       = idev;
            eventt.title       = FVM.title;
            eventt.description = FVM.description;
            eventt.startDate   = FVM.startDate;
            eventt.endDate     = FVM.endDate;
            eventt.capacity    = FVM.capacity;
            eventt.cat         = FVM.cat;
            eventt.startDate   = FVM.startDate;
            eventt.image       = FVM.image;


            fs.Update(eventt);
            fs.Commit();
            return(RedirectToAction("Index"));
        }
 //Update sự kiện
 public bool UpdateEvent(_event entity)
 {
     try
     {
         var model = db.events.Find(entity.ID);
         model.EventDate    = entity.EventDate;
         model.StartTime    = entity.StartTime;
         model.EndTime      = entity.EndTime;
         model.ModifiedDate = DateTime.Now;
         model.ModifiedBy   = entity.ModifiedBy;
         model.Name         = entity.Name;
         model.Image        = entity.Image;
         model.Description  = entity.Description;
         model.Detail       = entity.Detail;
         model.Status       = entity.Status;
         model.TopHot       = entity.TopHot;
         model.MetaTitle    = entity.MetaTitle;
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            _event _event = db.events.Find(id);

            db.events.Remove(_event);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private void btnAccept_Click(object sender, RoutedEventArgs e)
        {
            decimal?priceValue;
            decimal parsedPrice;

            BindingExpression price = tbPrice.GetBindingExpression(TextBox.TextProperty);
            BindingExpression name  = tbName.GetBindingExpression(TextBox.TextProperty);

            if (string.IsNullOrEmpty(tbName.Text as string))
            {
                AddError(name, "Polje je obavezno");
                return;
            }
            else
            {
                System.Windows.Controls.Validation.ClearInvalid(name);
            }

            if (string.IsNullOrEmpty(tbPrice.Text as string))
            {
                priceValue = null;
            }

            else if (!decimal.TryParse(tbPrice.Text, out parsedPrice))
            {
                AddError(price, "Vrijednost nije validna");
                return;
            }
            else
            {
                priceValue = parsedPrice;
                System.Windows.Controls.Validation.ClearInvalid(price);
            }

            if (!name.HasValidationError)
            {
                if (lbDialog.Content.Equals("Kreiranje događaja"))
                {
                    tbEventSearch.Text = tbName.Text;
                    tbEventPrice.Text  = tbPrice.Text;

                    _event newEvent = new _event(tbName.Text, "edukacija", priceValue);
                    _event.Insert(newEvent);
                    events.Add(newEvent.id, newEvent.name);
                }
                else if (lbDialog.Content.Equals("Kreiranje stavke"))
                {
                    tbItemSearch.Text = tbName.Text;

                    item newItem = new item(tbName.Text, priceValue, null);
                    item.Insert(newItem);
                    items.Add(newItem.id, newItem.name);
                }
                eventPopup.IsOpen = false;
                tbName.Clear();
                tbPrice.Clear();
            }
        }
Example #12
0
        public ActionResult Create(_event ev)
        {
            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:18080/IRMCJEE-web/IRMC/event/");

            Client.PostAsJsonAsync <_event>("", ev).ContinueWith((postTask) => postTask.Result.IsSuccessStatusCode);
            return(RedirectToAction("Index"));
        }
        private void atbEventSearch_SelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var obj = atbEventSearch.SelectedItem as string;

            if (obj != null)
            {
                _event newEvent = _event.SelectById(events.FirstOrDefault(ev => ev.Value.Equals(obj)).Key);
                tbEventPrice.Text = newEvent.event_price.ToString();
            }
        }
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            List <Boolean>    validationResults = new List <Boolean>();
            BindingExpression eventPrice        = tbEventPrice.GetBindingExpression(TextBox.TextProperty);
            BindingExpression clientName        = tbClientSearch.GetBindingExpression(TextBox.TextProperty);

            eventPrice.UpdateSource();

            validationResults.Add(eventPrice.HasValidationError);
            if (!validationResults.Contains(true))
            {
                client  selectedClient = null;
                _event  selectedEvent  = null;
                decimal?selectedPrice  = null;

                var obj1 = atbClientSearch.SelectedItem as string;
                if (obj1 != null)
                {
                    selectedClient = client.SelectById(clients.FirstOrDefault(c => c.Value.Equals(obj1)).Key);
                }
                var obj2 = atbEventSearch.SelectedItem as string;
                if (obj2 != null)
                {
                    selectedEvent = _event.SelectById(events.FirstOrDefault(c => c.Value.Equals(obj2)).Key);
                }
                var obj3 = tbEventPrice.Text as string;
                if (obj3 != null && !obj3.Equals(""))
                {
                    selectedPrice = Convert.ToDecimal(obj3, CultureInfo.CurrentCulture);
                }

                if (obj1 != null && obj2 != null)
                {
                    if (lbTermError.Visibility == Visibility.Hidden)
                    {
                        lbTermError.Visibility        = Visibility.Hidden;
                        lbReservationError.Visibility = Visibility.Collapsed;
                        reservation newReservation = EntityFactory.CreateReservation(EntityFactory.User.id, selectedClient.id, selectedEvent.id, selectedPrice, false);
                        reservation.Insert(newReservation);
                        var terms = termDatagrid.Items.Cast <term>().ToList();
                        terms.ForEach(t =>
                        {
                            t.reservation = newReservation;
                            t.items.ToList().ForEach(i => i.term = t);
                            term.Insert(t);
                        });
                        ClearAllFields();
                    }
                    else
                    {
                        lbReservationError.Visibility = Visibility.Visible;
                    }
                }
            }
        }
 public ActionResult Edit([Bind(Include = "event_id,event_date,created_by,event_name,event_description")] _event _event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(_event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.created_by = new SelectList(db.users, "user_id", "employee_flag", _event.created_by);
     return(View(_event));
 }
 //Phương thức tạo mới sự kiện
 public bool CreateEvent(_event entity)
 {
     try
     {
         entity.CreatedDate = DateTime.Now;
         db.events.Add(entity);
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        // GET: Events/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            _event _event = db.events.Find(id);

            if (_event == null)
            {
                return(HttpNotFound());
            }
            return(View(_event));
        }
        // GET: Events/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            _event _event = db.events.Find(id);

            if (_event == null)
            {
                return(HttpNotFound());
            }
            ViewBag.created_by = new SelectList(db.users, "user_id", "employee_flag", _event.created_by);
            return(View(_event));
        }
 set => SetProperty(ref _event, value);