// GET: ConferenceForms/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ConferenceForm conferenceForm = db.ConferenceForms.Find(id);
            Expense        expense        = new Expense();

            ViewBag.Expenses = db.Expenses.AsNoTracking()
                               .Where(a => a.ConferenceFormID == id)
                               .Where(c => c.IsRemoved == false)
                               .OrderByDescending(a => a.ExpenseEstAmount).ToList();

            ViewBag.Trips = db.Trips.AsNoTracking()
                            .Where(a => a.ConferenceFormID == id)
                            .OrderByDescending(a => a.Date).ToList();

            var model = new ConferenceFormVM
            {
                ConferenceForm = conferenceForm
            };


            if (id == null)
            {
                return(HttpNotFound());
            }

            return(View(model));
        }
        public ActionResult Create([Bind(Include = "ID,ConferenceID,BenefitOfAttending,ReqReplacementStaff," +
                                                   "FormStatusID,CreatedBy,CreatedOn,UpdatedBy,UpdatedOn,RowVersion")] ConferenceForm conferenceForm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    conferenceForm.FormStatusID = db.FormStatus
                                                  .Where(f => f.StatusType == "Pending")
                                                  .SingleOrDefault().ID;

                    conferenceForm.StaffMemberID = db.Staff
                                                   .Where(s => s.Email == User.Identity.Name)
                                                   .SingleOrDefault().ID;

                    db.ConferenceForms.Add(conferenceForm);
                    db.SaveChanges();

                    return(RedirectToAction("Details", new { id = conferenceForm.ID }));
                }
            }
            catch (RetryLimitExceededException)
            {
                ModelState.AddModelError("", "Unable to save changes after multiple attempts. " +
                                         "Try again, and if the problem persists, see your system administrator.");
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the " +
                                         "problem persists see your system administrator.");
            }

            PopulateDropDownLists(conferenceForm);
            return(View(conferenceForm));
        }
        public ActionResult RemoveConfirmed(int id)
        {
            ConferenceForm conferenceForm = db.ConferenceForms.Find(id);

            db.Entry(conferenceForm).State = EntityState.Modified;
            conferenceForm.IsRemoved       = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        private void joinConferenceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ConferenceForm cf = new ConferenceForm();

            cf.DiscoManager = dm;
            cf.Nick         = muc.DefaultNick;
            if (cf.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            muc.GetRoom(cf.RoomAndNick).Join();
        }
Ejemplo n.º 5
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // pop up AddBookmark dialog
            ConferenceForm cf = new ConferenceForm();

            cf.DiscoManager = dm;
            cf.Nick         = muc.DefaultNick;
            if (cf.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            // TODO: add autojoin and name.
            bmm.AddConference(cf.RoomJID, null, false, cf.Nick);
        }
        // GET: ConferenceForms/Delete/5
        public ActionResult Remove(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ConferenceForm conferenceForm = db.ConferenceForms.Find(id);

            if (conferenceForm == null)
            {
                return(HttpNotFound());
            }
            return(View(conferenceForm));
        }
        // GET: ConferenceForms/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ConferenceForm conferenceForm = db.ConferenceForms.Find(id);

            if (conferenceForm == null)
            {
                return(HttpNotFound());
            }

            PopulateDropDownLists(conferenceForm);
            if (User.IsInRole("Admin"))
            {
                FormStatusDropDown(conferenceForm);
            }
            return(View(conferenceForm));
        }
Ejemplo n.º 8
0
        private void lvBookmarks_DoubleClick(object sender, EventArgs e)
        {
            if (lvBookmarks.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem lvi = lvBookmarks.SelectedItems[0];

            JID jid = (JID)lvi.Tag;
            BookmarkConference conf = bmm[jid];

            Debug.Assert(conf != null);

            ConferenceForm cf = new ConferenceForm();

            cf.DiscoManager = dm;
            cf.RoomAndNick  = new JID(jid.User, jid.Server, conf.Nick);

            if (cf.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            bmm.AddConference(cf.RoomJID, null, false, cf.Nick);
        }
Ejemplo n.º 9
0
        private void conferencesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ConferenceForm conferenceForm = new ConferenceForm(dataFormDTO);

            conferenceForm.Show();
        }
 private void PopulateDropDownLists(ConferenceForm conferenceForm = null)
 {
     ViewBag.ConferenceID = conferenceSelectList(conferenceForm?.ConferenceID);
 }
 private void FormStatusDropDown(ConferenceForm conferenceForm = null)
 {
     ViewBag.FormStatusID = FormStatusSelectList(conferenceForm?.FormStatusID);
 }
        public ActionResult EditPost(int?id, Byte[] rowVersion)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ConferenceForm conferenceFormToUpdate = db.ConferenceForms.Find(id);

            if (TryUpdateModel(conferenceFormToUpdate, "",
                               new string[] { "ID", "ConferenceID", "BenefitOfAttending", "ReqReplacementStaff",
                                              "MileageFormID", "FormStatusID" }))
            {
                try
                {
                    db.Entry(conferenceFormToUpdate).State = EntityState.Modified;
                    db.Entry(conferenceFormToUpdate).OriginalValues["RowVersion"] = rowVersion;
                    db.SaveChanges();

                    return(RedirectToAction("Details", new { id = conferenceFormToUpdate.ID }));
                }
                catch (DbUpdateConcurrencyException ex)// Added for concurrency
                {
                    var entry         = ex.Entries.Single();
                    var theValues     = (ConferenceForm)entry.Entity;
                    var databaseEntry = entry.GetDatabaseValues();
                    if (databaseEntry == null)
                    {
                        ModelState.AddModelError("", "Unable to save changes. The Conference Form was deleted by another user.");
                    }
                    else
                    {
                        var databaseValues = (ConferenceForm)databaseEntry.ToObject();
                        if (databaseValues.ConferenceID != theValues.ConferenceID)
                        {
                            ModelState.AddModelError("ConferenceID", "Current value: "
                                                     + db.Conferences.Find(databaseValues.ConferenceID).Name);
                        }
                        if (databaseValues.BenefitOfAttending != theValues.BenefitOfAttending)
                        {
                            ModelState.AddModelError("BenefitOfAttending", "Current value: "
                                                     + databaseValues.BenefitOfAttending);
                        }
                        if (databaseValues.ReqReplacementStaff != theValues.ReqReplacementStaff)
                        {
                            ModelState.AddModelError("ReqReplacementStaff", "Current value: "
                                                     + databaseValues.ReqReplacementStaff);
                        }
                        ModelState.AddModelError(string.Empty, "The record you attempted to edit "
                                                 + "was modified by another user after you received your values. The "
                                                 + "edit operation was canceled and the current values in the database "
                                                 + "have been displayed. If you still want to save your version of this record, click "
                                                 + "the Save button again.");
                        conferenceFormToUpdate.RowVersion = databaseValues.RowVersion;
                    }
                }
                catch (RetryLimitExceededException)
                {
                    ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
                }
                catch (DataException)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
                }
            }

            PopulateDropDownLists(conferenceFormToUpdate);
            if (User.IsInRole("Admin"))
            {
                FormStatusDropDown(conferenceFormToUpdate);
            }
            return(View(conferenceFormToUpdate));
        }