private void InitializeView(Int32 idCommunity, long idCall, long idMembership) { View.IdMembershipToReplace = idMembership; List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoEvaluationStep> > steps = Service.GetAvailableSteps(idCall, WizardEvaluationStep.ManageEvaluators); steps.ForEach(s => s.Status = Core.Wizard.WizardItemStatus.disabled); View.LoadWizardSteps(idCall, View.IdCommunity, steps); CommitteeMember member = Service.GetCommitteeMembership(idMembership); if (member == null || member.Evaluator == null || member.Evaluator.Person == null) { View.DisplayMemberNotFound(); } else if (member.Status == MembershipStatus.Replaced) { View.RedirectToUrl(RootObject.ViewEvaluators(idMembership, idCall, idCommunity, View.PreloadView)); } else { Boolean completed = Service.EvaluationsCompleted(idMembership); if (completed) { View.DisplayEvaluationsCompleted(member.Evaluator.Person.SurnameAndName); } else { Dictionary <Domain.Evaluation.EvaluationStatus, long> info = Service.GetEvaluatorStatistics(member); View.DisplayMemberInfo(member.Evaluator.Person.SurnameAndName, info[Domain.Evaluation.EvaluationStatus.Evaluated], info[Domain.Evaluation.EvaluationStatus.Evaluating], info[Domain.Evaluation.EvaluationStatus.None]); View.LoadEvaluationInfos(Service.GetMemberEvaluations(member, View.AnonymousDisplayname, View.UnknownDisplayname)); } } }
public void ConstructorTest() { CommitteeMember target = new CommitteeMember(); // TODO: Implement code to verify target Assert.IsNotNull(target); }
// GET: CommitteeMember public ActionResult Index(int page = 1) { if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString())) { //Log.Error(ex + ex.StackTrace); TempData["SessionExipred"] = "true"; return(RedirectToAction("Index", "Login", null)); } CommitteeMember cm = new CommitteeMember(); try { MysqlDBA <CommINSTYear> mysqlDBA = new MysqlDBA <CommINSTYear>(FunctionController.CONNSTR); CommINSTYear queryCrit = new CommINSTYear(); queryCrit.ACommNo = Session["INSTNO"].ToString(); List <CommINSTYear> commINSTYears = (List <CommINSTYear>)mysqlDBA.getDataListNoKey(queryCrit); queryCrit = new CommINSTYear(); queryCrit.BCommNo = Session["INSTNO"].ToString(); commINSTYears.AddRange((List <CommINSTYear>)mysqlDBA.getDataListNoKey(queryCrit)); cm.INSTList = commINSTYears.OrderBy(p => p.INSTNO).ToPagedList(page, DefaultPageSize); } catch (Exception ex) { Log.Error(ex + ex.StackTrace); TempData["action"] = "committee"; TempData["error"] = ex + ex.StackTrace; return(RedirectToAction("Index", "CommitteeMember", null)); } TempData["action"] = "committee"; return(View(cm)); }
public void SaveDeleteTest() { CommitteeMember member = new CommitteeMember(); MemberType mtype = NHibernateHelper.DaoFactory.GetMemberTypeDao().GetById((int)MemberTypes.CommitteeMember, false); //member.Email = StaticProperties.TestString; //member.UserID = StaticProperties.ExistingUserID; member.AssociatedPosition = NHibernateHelper.DaoFactory.GetPositionDao().GetById(StaticProperties.ExistingPositionID, false); member.DepartmentMember = NHibernateHelper.DaoFactory.GetDepartmentMemberDao().GetById(1, false); member.MemberType = mtype; //Make sure the file is valid Assert.IsTrue(ValidateBO <CommitteeMember> .isValid(member), "CommitteeMember not valid: " + member.getValidationResultsAsString(member)); Assert.IsTrue(member.IsTransient()); //file is not saved using (var ts = new TransactionScope()) { member = NHibernateHelper.DaoFactory.GetCommitteeMemberDao().SaveOrUpdate(member); ts.CommitTransaction(); } Assert.IsFalse(member.IsTransient()); CommitteeMember memberDB = new CommitteeMember(); //Get a new file using the saved file's ID memberDB = NHibernateHelper.DaoFactory.GetCommitteeMemberDao().GetById(member.ID, false); //Make sure they are the same Assert.AreEqual(member, memberDB); this.TestContext.WriteLine("Member Created had ID = {0}", memberDB.ID); //Now delete the file using (var ts = new TransactionScope()) { NHibernateHelper.DaoFactory.GetCommitteeMemberDao().Delete(member); ts.CommitTransaction(); } //Make sure it is deleted bool isDeleted = false; try { member = NHibernateHelper.DaoFactory.GetCommitteeMemberDao().GetById(memberDB.ID, false); member.IsTransient(); } catch (NHibernate.ObjectNotFoundException) { isDeleted = true; } Assert.IsTrue(isDeleted); }
public ActionResult DeleteConfirmed(int id) { CommitteeMember committeemember = db.CommitteeMembers.Find(id); db.CommitteeMembers.Remove(committeemember); db.SaveChanges(); return(RedirectToAction("Index")); }
protected void btnAddMember_Click(object sender, EventArgs e) { //Create the new department member DepartmentMember member = new DepartmentMember(); member.DepartmentFIS = STR_FRAC; member.FirstName = txtFName.Text; member.LastName = txtLName.Text; member.OtherDepartmentName = string.IsNullOrEmpty(txtDepartment.Text) ? "Other" : txtDepartment.Text; member.LoginID = txtLoginID.Text.ToLower().Trim(); //Create the membership object CommitteeMember committeeAccess = new CommitteeMember(); committeeAccess.AssociatedPosition = currentPosition; committeeAccess.DepartmentMember = member; switch (dlistMemberType.SelectedValue) { case "Committee": committeeAccess.MemberType = MemberTypeBLL.GetByID((int)MemberTypes.CommitteeMember); break; case "Faculty": committeeAccess.MemberType = MemberTypeBLL.GetByID((int)MemberTypes.FacultyMember); break; case "Review": committeeAccess.MemberType = MemberTypeBLL.GetByID((int)MemberTypes.Reviewer); break; } //save the department member and add to the position committee for this position using (var ts = new TransactionScope()) { DepartmentMemberBLL.EnsurePersistent(member); committeeAccess.DepartmentMember = member; currentPosition.CommitteeMembers.Add(committeeAccess); Position position = currentPosition; PositionBLL.EnsurePersistent(position); ts.CommitTransaction(); } //Display an update successful message lblCommitteeUpdated.Text = "Committee Membership Successfully Updated"; //rebind the datagrid this.bindMembers(); this.ShowUpdateAcessRegion(); }
public ActionResult DeleteConfirmed(int id) { CommitteeMember committeeMember = db.CommitteeMembers.Find(id); Graduation graduation = db.Graduations.Find(committeeMember.Student.Graduation.FirstOrDefault().ID); db.CommitteeMembers.Remove(committeeMember); db.SaveChanges(); TempData["msg"] = "<script>alert('This commitee member has been successfully deleted.')</script>"; return(RedirectToAction("Edit", "Graduation", new { id = graduation.ID })); }
// // GET: /Admin/CommitteeMember/Details/5 public ActionResult Details(int id = 0) { CommitteeMember committeemember = db.CommitteeMembers.Find(id); if (committeemember == null) { return(HttpNotFound()); } return(View(committeemember)); }
public ActionResult Edit([Bind(Include = "ID,StudentID,Name,Email,Department,University")] CommitteeMember committeeMember) { if (ModelState.IsValid) { db.Entry(committeeMember).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Graduation", new { id = committeeMember.StudentID })); } ViewBag.Student = committeeMember.Student; ViewBag.StudentID = committeeMember.StudentID; return(View(committeeMember)); }
public bool AddCommitteeMember(CommitteMemberModel committeeMember) { var membersToCommittee = new List <MembersToCommittee>(); bool data = false; if (committeeMember.Id != 0) { membersToCommittee = _objRepository.GetMembersToCommittee(committeeMember.Id); } var objcommitteeMember = new CommitteeMember { Address = committeeMember.Address, FirstName = committeeMember.FirstName, LastName = committeeMember.LastName, MiddleName = committeeMember.MiddleName, City = committeeMember.City, EmailAddress = committeeMember.EmailAddress, ContactNumber = committeeMember.ContactNumber, State = committeeMember.State, Zip = committeeMember.Zip }; if (committeeMember.Id != 0) { objcommitteeMember.Id = committeeMember.Id; data = _objRepository.UpdateCommitteeMember(objcommitteeMember); } if (committeeMember.Id == 0) { data = _objRepository.AddCommitteeMember(objcommitteeMember); } if (membersToCommittee != null && membersToCommittee.Count > 0) { _objRepository.DeletemembersToCommittee(membersToCommittee); foreach (var committeeId in committeeMember.CommitteeIds) { _objRepository.UpdatemembersToCommittee(objcommitteeMember.Id, committeeId); } } else { foreach (var committeeId in committeeMember.CommitteeIds) { _objRepository.InsertmembersToCommittee(objcommitteeMember.Id, committeeId); } } return(data); }
public void ReplaceEvaluator(long idCall, Int32 idNewEvaluator, Boolean assignAll) { CommitteeMember member = Service.ReplaceEvaluator(idCall, View.IdMembershipToReplace, idNewEvaluator, assignAll, CallService.CallUseDss(View.IdCall)); if (member != null) { View.RedirectToUrl(RootObject.ViewEvaluators(View.IdMembershipToReplace, View.IdCall, View.IdCommunity, View.PreloadView)); } else { View.DisplayError(EvaluationEditorErrors.ReplacingEvaluator); } }
public FormAssignment(CommitteeMember chair, Form prev) { loggedChair = chair; InitializeComponent(); ctrp = new ControllerPapers(); List <Paper> paperList = (List <Paper>)ctrp.GetAllPapers(); foreach (Paper p in paperList) { listBox1.Items.Add(p.IdP.ToString() + '.' + p.Title); } prevForm = prev; }
public CommitteeMember Login(string username, string password) { CommitteeMember cm = repo.GetOne(username); if (cm.Password == password) { return(cm); } else { return(new CommitteeMember("", "", "", "", "", "", "", "")); } }
// Committee Member Section #region Committee Member Section public bool AddCommitteeMember(CommitteeMember committeeMember) { try { _entity.CommitteeMembers.Add(committeeMember); _entity.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public ActionResult AddMembers(Guid AssessmentId, ICollection <Guid> DozIds) { var assessment = Db.Assessments.SingleOrDefault(x => x.Id == AssessmentId); if (DozIds == null || DozIds.Count == 0) { foreach (var member in assessment.Committee.Members.ToList()) { Db.CommitteeMember.Remove(member); } Db.SaveChanges(); return(PartialView("_SaveSuccess")); } foreach (var member in assessment.Committee.Members.ToList()) { var inList = DozIds.Contains(member.Member.Id); if (inList) { DozIds.Remove(member.Member.Id); } else { Db.CommitteeMember.Remove(member); } } // die verbleibenden sind neu foreach (var dozId in DozIds) { var cm = new CommitteeMember { Member = Db.Members.SingleOrDefault(x => x.Id == dozId), HasChair = false, Committee = assessment.Committee }; Db.CommitteeMember.Add(cm); } Db.SaveChanges(); return(Json(new { result = "Redirect", url = Url.Action("Details", new { id = assessment.Id }) })); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommitteeMember committeeMember = db.CommitteeMembers.Find(id); if (committeeMember == null) { return(HttpNotFound()); } return(View(committeeMember)); }
public ActionResult Create([Bind(Include = "ID,StudentID,Name,Email,Department,University")] CommitteeMember committeeMember) { if (ModelState.IsValid) { db.CommitteeMembers.Add(committeeMember); db.SaveChanges(); return(RedirectToAction("Index", "Graduation", new { id = committeeMember.StudentID })); } ViewBag.Student = committeeMember.Student; ViewBag.StudentID = committeeMember.StudentID; ViewBag.Student_FN = committeeMember.Student.FirstName; ViewBag.Student_LN = committeeMember.Student.LastName; return(View(committeeMember)); }
public ActionResult Edit(CommitteeMember committeemember) { if (ModelState.IsValid) { db.Entry(committeemember).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.CommitteeSeatId = new SelectList(db.CommitteeSeats, "Id", "Id", committeemember.CommitteeSeatId); ViewBag.CommitteeSeatId = new SelectList(db.CommitteeSeats.OrderBy(s => s.Committee.Name).ThenBy(s => s.FacultySchoolId ?? Int16.MaxValue).ThenBy(s => s.Id).Select(s => new { Id = s.Id, CommSeat = s.Committee.Name + " - " + (s.FacultySchool.Abbreviation ?? "At-Large") + " - " + SqlFunctions.StringConvert((double)(s.StaggerYear ?? 0)).Trim() }), "Id", "CommSeat", committeemember.CommitteeSeatId); //ViewBag.FacultyId = new SelectList(db.Faculties, "Id", "First", committeemember.FacultyId); ViewBag.FacultyId = new SelectList(db.Faculties.OrderBy(f => f.Last).ThenBy(f => f.First).Select(f => new { Id = f.Id, FullName = f.Last + ", " + f.First }), "Id", "FullName", committeemember.FacultyId); return(View(committeemember)); }
// // GET: /Admin/CommitteeMember/Edit/5 public ActionResult Edit(int id = 0) { CommitteeMember committeemember = db.CommitteeMembers.Find(id); if (committeemember == null) { return(HttpNotFound()); } //ViewBag.CommitteeSeatId = new SelectList(db.CommitteeSeats, "Id", "Id", committeemember.CommitteeSeatId); ViewBag.CommitteeSeatId = new SelectList(db.CommitteeSeats.OrderBy(s => s.Committee.Name).ThenBy(s => s.FacultySchoolId ?? Int16.MaxValue).ThenBy(s => s.Id).Select(s => new { Id = s.Id, CommSeat = s.Committee.Name + " - " + (s.FacultySchool.Abbreviation ?? "At-Large") + " - " + SqlFunctions.StringConvert((double)(s.StaggerYear ?? 0)).Trim() }), "Id", "CommSeat", committeemember.CommitteeSeatId); //ViewBag.FacultyId = new SelectList(db.Faculties, "Id", "First", committeemember.FacultyId); ViewBag.FacultyId = new SelectList(db.Faculties.OrderBy(f => f.Last).ThenBy(f => f.First).Select(f => new { Id = f.Id, FullName = f.Last + ", " + f.First }), "Id", "FullName", committeemember.FacultyId); return(View(committeemember)); }
public FormBidProposals(CommitteeMember cm, Form prev) { loggedUser = new CommitteeMember(); ctrlp = new ControllerPapers(); ctrlb = new ControllerBiddings(); loggedUser = cm; InitializeComponent(); List <Paper> paperList = (List <Paper>)ctrlp.GetAllPapers(); foreach (Paper p in paperList) { CheckedListBoxProposals.Items.Add(p.IdP.ToString() + '.' + p.Title); } prevForm = prev; }
public ActionResult Create(AssessmentCreateModel model) { var member = GetMyMembership(); var org = GetMyOrganisation(); var curr = Db.Curricula.SingleOrDefault(x => x.ShortName.Equals(model.CurriculumShortName) && x.Organiser.Id == org.Id); var sem = Db.Semesters.SingleOrDefault(x => x.Name.Equals(model.SemesterName)); var assessment = new Assessment { Name = model.Name, Description = model.Description, Curriculum = curr, Semester = sem }; var committee = new Committee { Name = "Aufnahmekommission für " + model.Name, Curriculum = curr }; var comMember = new CommitteeMember { Member = member, HasChair = true }; committee.Members = new List <CommitteeMember>(); committee.Members.Add(comMember); assessment.Committee = committee; Db.CommitteeMember.Add(comMember); Db.Committees.Add(committee); Db.Assessments.Add(assessment); Db.SaveChanges(); return(RedirectToAction("Details", new { id = assessment.Id })); }
public FormCommitteeMember(CommitteeMember c, Form prev) { controllerCM = new ControllerCommitteeMembers(); loggedUser = new CommitteeMember(); loggedUser = c; InitializeComponent(); LabelUsername.Text = loggedUser.Username; if (c.Role == "chair") { //only the chiar can change the deadlines and assign papers for review label4.Visible = true; chgDdlineLab.Visible = true; } prevForm = prev; }
public void CascadeMemberTypeSaveTest() { //Grab an existing member out of the database CommitteeMember member = NHibernateHelper.DaoFactory.GetCommitteeMemberDao().GetById(StaticProperties.ExistingCommitteeMemberID, false); //Get all possible member types (lookup table) List <MemberType> memberTypeList = NHibernateHelper.DaoFactory.GetMemberTypeDao().GetAll(); Assert.IsFalse(member.MemberType.IsTransient()); //make sure we have a valid memberType int originalMemberTypeID = member.MemberType.ID; this.TestContext.WriteLine("Original MemberType = {0}", originalMemberTypeID); //Now find a memberType that doesn't equal the current one MemberType newType = new MemberType(); foreach (MemberType mType in memberTypeList) { if (mType.ID != originalMemberTypeID) { newType = mType; break; } } //Make sure we got a different memberType Assert.AreNotEqual <int>(member.MemberType.ID, newType.ID); //Now update the committeeMember with the new memberType using (var ts = new TransactionScope()) { member.MemberType = newType; NHibernateHelper.DaoFactory.GetCommitteeMemberDao().SaveOrUpdate(member); ts.CommitTransaction(); } this.TestContext.WriteLine("New MemberTypeID = {0}", newType.ID); //Get the original CommitteeMember back out of the database, and make sure the memberType changed to the new type CommitteeMember memberDB = NHibernateHelper.DaoFactory.GetCommitteeMemberDao().GetById(StaticProperties.ExistingCommitteeMemberID, false); Assert.AreEqual <int>(memberDB.MemberType.ID, newType.ID); }
public ActionResult Delete(int?id) { if (id == null) { TempData["msg"] = "<script>alert('Sorry! No record found to delete.')</script>"; return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommitteeMember committeeMember = db.CommitteeMembers.Find(id); if (committeeMember == null) { TempData["msg"] = "<script>alert('Sorry! No record found to delete.')</script>"; return(HttpNotFound()); } int sendId = (int)id; return(DeleteConfirmed(sendId)); }
public bool UpdateCommitteeMember(CommitteMemberModel committeeMember) { var objcommitteeMember = new CommitteeMember { Address = committeeMember.Address, FirstName = committeeMember.FirstName, LastName = committeeMember.LastName, MiddleName = committeeMember.MiddleName, City = committeeMember.City, EmailAddress = committeeMember.EmailAddress, ContactNumber = committeeMember.ContactNumber, State = committeeMember.State, Zip = committeeMember.Zip, Id = committeeMember.Id }; return(_objRepository.UpdateCommitteeMember(objcommitteeMember)); }
public ActionResult AddNewMember(CommitteeMemberViewModel viewModel) { var committeeMember = new CommitteeMember { CommitteeId = viewModel.CommitteeId, UserId = viewModel.MemberId }; _context.CommitteeMembers.Add(committeeMember); _context.SaveChanges(); var result = UserManager.AddToRole(viewModel.MemberId, viewModel.Role); if (result == IdentityResult.Success) { return(RedirectToAction("Details", new { id = viewModel.CommitteeId })); } else { return(HttpNotFound("Can't add new Role")); } }
public override void LoadData() { base.LoadData(); DepartmentMember departmentMember = new DepartmentMember { DepartmentFIS = StaticProperties.TestString, FirstName = StaticProperties.TestString, LastName = StaticProperties.TestString, LoginID = StaticProperties.TestString, OtherDepartmentName = StaticProperties.TestString }; using (var ts = new TransactionScope()) { DepartmentMemberBLL.EnsurePersistent(departmentMember); for (int i = 0; i < 4; i++) { var memberType = new MemberType { Type = StaticProperties.TestString }; var committeeMember = new CommitteeMember { AssociatedPosition = PositionBLL.GetByID(StaticProperties.ExistingPositionID), DepartmentMember = departmentMember, MemberType = memberType }; MemberTypeBLL.EnsurePersistent(memberType); CommitteeMemberBLL.EnsurePersistent(committeeMember); } ts.CommitTransaction(); } }
public void testare01() { Bidding c = new Bidding("", 12, true); Debug.Assert(c.Accepted == true); Debug.Assert(c.IdPaper == 12); Paper p2 = new Paper(1, "Bayes Theorem", "#spam", "Internet", "Bill", "Science Daily", "2017-05-04", "path", 2); Debug.Assert(p2.IdP == 1); Debug.Assert(p2.Keywords == "#spam"); Speaker s = new Speaker("username", "password", "ion", "iancu", "*****@*****.**"); Debug.Assert(s.FirstName == "ion"); Debug.Assert(s.Email == "*****@*****.**"); User u = new User("username2", "password2", "Ben", "G", "*****@*****.**"); Debug.Assert(u.FirstName == "Ben"); Debug.Assert(u.Email == "*****@*****.**"); Listener l = new Listener("andrei_b", "12345", "Andrei", "Barz", "*****@*****.**"); Debug.Assert(l.FirstName == "Andrei"); Debug.Assert(l.Email == "*****@*****.**"); Review r = new Review("marcanton", 1, "reject", "The paper is not good enough to pass"); Debug.Assert(r.Qualifier == "reject"); Debug.Assert(r.UsernameCommiteeMember == "marcanton"); CommitteeMember cm = new CommitteeMember("username", "pass", "Pop", "Antonio", "*****@*****.**", "www.web.ro", "Medicine", "normal"); Debug.Assert(cm.FirstName == "Pop"); Debug.Assert(cm.Affiliation == "Medicine"); }
private void button1_Click(object sender, EventArgs e) { string username = TextBoxUsername.Text; string password = TextBoxPassword.Text; var item = ComboBoxParticipants.SelectedItem; if (item == "Committee Member") { CommitteeMember cm = controllerCM.Login(username, password); if (cm.Username == username) //login successful { this.Hide(); FormCommitteeMember secondform = new FormCommitteeMember(cm, this); secondform.Show(); } } else if (item == "Listener") { Listener l = controllerL.Login(username, password); if (l.Username == username) //login successful { this.Hide(); FormListener secondform = new FormListener(l, this); secondform.Show(); } } else if (item == "Speaker") { Speaker s = controllerS.Login(username, password); if (s.Username == username) //login successful { this.Hide(); FormSpeaker secondform = new FormSpeaker(s, this); secondform.Show(); } } }
public void SelectEvaluator(Int32 idUser) { List <Int32> inuseEvaluators = new List <Int32>(); litePerson person = CurrentManager.GetLitePerson(idUser); CommitteeMember member = Service.GetCommitteeMembership(View.IdMembershipToReplace); if (member != null && member.Committee != null) { inuseEvaluators.AddRange(member.Committee.Members.Where(m => m.Deleted == BaseStatusDeleted.None && m.Evaluator != null && m.Evaluator.Person != null).Select(m => m.Evaluator.Person.Id).ToList()); } if (idUser > 0) { inuseEvaluators.Add(idUser); } if (idUser == 0 || person == null) { View.InitializeEvaluatorSelection(inuseEvaluators); } else { View.LoadSelectEvaluator(inuseEvaluators, idUser, person.SurnameAndName, View.AssignAll); } }