public async Task <IActionResult> Create([Bind("Id,OrgId,Name,PhoneCode,PhoneNumber,Age,Email,InstagramProfile,FacebookProfile,TwitterProfile,AddressLine1,AddressLine2,AddressStreet,AddressCity,AddressState,AddressCountry,AddressZipcode,Gender,ImageFile,ImagePath")] Volunteers volunteers) { var country = _unitOfWork.CountryRepository.GetByID(Convert.ToInt32(volunteers.AddressCountry)); var states = _unitOfWork.StateRepository.GetByID(Convert.ToInt32(volunteers.AddressState)); volunteers.PhoneCode = country.PhoneCode.ToString(); volunteers.PhoneNumber = volunteers.PhoneCode.ToString() + volunteers.PhoneNumber; if (ModelState.IsValid) { volunteers.OrgId = orgId; volunteers.ImagePath = await _imageService.ImageUpload(volunteers.ImageFile, "Banners"); _unitOfWork.VolunteersRepository.Insert(volunteers); await _unitOfWork.SaveAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["ContactTypeId"] = new SelectList(_unitOfWork.ContactTypeRepository.GetAll(), "Id", "Name", volunteers.VolunteersTypeId); ViewData["AddressCountry"] = new SelectList(_commonServices.GetCountries(), "Id", "Name", volunteers.AddressCountry); // ViewData["AddressState"] = new SelectList(_commonServices.GetStates(), "Id", "Name", volunteers.AddressState); ViewData["PhoneCode"] = new SelectList(_commonServices.GetPhoneCode(), "Id", "PhoneCode", volunteers.PhoneCode); return(View(volunteers)); }
public async Task <IActionResult> Edit(int id, [Bind("VolunteerId,Name,Surname,Email,VolunteerPassword,PhoneNumber")] Volunteers volunteers) { if (id != volunteers.VolunteerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(volunteers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolunteersExists(volunteers.VolunteerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(volunteers)); }
public async Task <IActionResult> Edit(int id, [Bind("VolunteerId,FirstName,LastName,Position,Age,StartDate,AnimalId")] Volunteers volunteers) { if (id != volunteers.VolunteerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(volunteers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolunteersExists(volunteers.VolunteerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AnimalId"] = new SelectList(_context.Animals, "AnimalId", "AnimalId", volunteers.AnimalId); return(View(volunteers)); }
public VolunteerEditForm(string connStringIN) { InitializeComponent(); foreach (TextBox tb in this.Controls.OfType <TextBox>()) { tbList.Add(tb); } foreach (CheckBox chk in this.Controls.OfType <CheckBox>()) { chkList.Add(chk); } clsVolGroups = new VolGroups(CCFBGlobal.connectionString); clsVolunteers = new Volunteers(CCFBGlobal.connectionString); parm_VolunteerType clsVolTypes = new parm_VolunteerType(CCFBGlobal.connectionString); ArrayList lstVolTypes = new ArrayList(); clsVolTypes.openAll(); for (int i = 0; i < clsVolTypes.RowCount; i++) { lstVolTypes.Add(new parmType(clsVolTypes.ID, clsVolTypes.Type, clsVolTypes.SortOrder, clsVolTypes.ShortName)); } cboVolType.DataSource = lstVolTypes; cboVolType.DisplayMember = "LongName"; cboVolType.ValueMember = "UID"; }
public async Task <IActionResult> Edit(int id, [Bind("Id,OrgId,Name,PhoneNumber,Age,Email,InstagramProfile,FacebookProfile,TwitterProfile,AddressLine1,AddressLine2,AddressStreet,AddressCity,AddressState,AddressCountry,AddressZipcode")] Volunteers volunteers) { if (id != volunteers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { volunteers.OrgId = orgId; _unitOfWork.VolunteersRepository.Update(volunteers); await _unitOfWork.SaveAsync(); } catch (DbUpdateConcurrencyException) { if (!VolunteersExists(volunteers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } // ViewData["VolunteersTypeId"] = new SelectList(_unitOfWork.VolunteersTypeRepository.GetAll(), "Id", "Name", volunteers.VolunteersTypeId); return(View(volunteers)); }
public ActionResult DeleteConfirmed(int id) { Volunteers volunteers = db.Volunteers.Find(id); db.Volunteers.Remove(volunteers); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CreateVolunteer(Volunteers volunteers) { if (volunteers == null) { throw new ArgumentNullException(nameof(volunteers)); } _context.Volunteers.Add(volunteers); }
protected void btnSave_Click(object sender, EventArgs e) { Elderlies objElder = new Elderlies(); objElder.ElderID = Request.QueryString["ElderID"]; objElder.getDetails(); objElder.status = objElder.getStatus(); if (rblSuccess.SelectedIndex == 0) { lblChanges.Text = objElder.setSuccess(); txtFeedback.Visible = false; } else { lblChanges.Text = objElder.setUnsuccess(); txtFeedback.Visible = true; //Feedback coding if (txtFeedback.Text.Length > 1) { Volunteers objVolunteer = new Volunteers(); objVolunteer.EmailAddr = Session["LoginID"].ToString(); objVolunteer.Password = objVolunteer.getPass(); objVolunteer.getDetails(); string feedbacktext = txtFeedback.Text; string strConn = ConfigurationManager.ConnectionStrings["P2ConnectionString"].ToString(); SqlConnection conn = new SqlConnection(strConn); SqlCommand cmd = new SqlCommand("INSERT INTO Feedback(VolunteerID, ElderID, Feedback, DateCreated) Output inserted.FeedbackID " + "Values(@volunteerid, @ElderID, @feedbacktext, GetDate())", conn); string elderid = Request.QueryString["ElderID"]; cmd.Parameters.AddWithValue("@volunteerid", objVolunteer.VolunteerID); cmd.Parameters.AddWithValue("@ElderID", elderid); cmd.Parameters.AddWithValue("@feedbacktext", feedbacktext); SqlDataAdapter daFeedback = new SqlDataAdapter(cmd); DataSet result = new DataSet(); conn.Open(); int id = cmd.ExecuteNonQuery(); conn.Close(); lblFeedback.Text = "Success Sent!"; } else { lblFeedback.Text = "Error!"; } } }
public ActionResult Edit([Bind(Include = "Id,Name,Email,Phone")] Volunteers volunteers) { if (ModelState.IsValid) { db.Entry(volunteers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(volunteers)); }
public async Task <IActionResult> Create([Bind("VolunteerId,Name,Surname,Email,VolunteerPassword,PhoneNumber")] Volunteers volunteers) { if (ModelState.IsValid) { _context.Add(volunteers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(volunteers)); }
public ActionResult Create([Bind(Include = "Id,Name,Email,Phone")] Volunteers volunteers) { if (ModelState.IsValid) { db.Volunteers.Add(volunteers); db.SaveChanges(); return(View()); } return(View(volunteers)); }
public async Task <IActionResult> Create([Bind("VolunteerId,FirstName,LastName,Position,Age,StartDate,AnimalId")] Volunteers volunteers) { if (ModelState.IsValid) { _context.Add(volunteers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AnimalId"] = new SelectList(_context.Animals, "AnimalId", "AnimalId", volunteers.AnimalId); return(View(volunteers)); }
public object Login_Validation(string Mobile_Email, string Password) { long result; bool ifmobile = long.TryParse(Mobile_Email, out result); Predicate <Volunteer> mob_vol = x => (x.Mobile_Number == Mobile_Email || x.Mobile_Alternate == Mobile_Email) && x.Password == Password; Predicate <Volunteer> email_vol = x => x.Email == Mobile_Email && x.Password == Password; Predicate <User> mob_user = x => (x.Mobile_Number == Mobile_Email || x.Mobile_Alternate == Mobile_Email) && x.Password == Password; Predicate <User> email_user = x => x.Email == Mobile_Email && x.Password == Password; Predicate <Driver> mob_dri = x => (x.Mobile_Number == Mobile_Email || x.Mobile_Alternate == Mobile_Email) && x.Password == Password; Predicate <Driver> email_dri = x => x.Email == Mobile_Email && x.Password == Password; if (ifmobile) { if (Volunteers.Exists(mob_vol)) { return(Volunteers.Where(x => mob_vol(x)).FirstOrDefault()); } else if (Users.Exists(mob_user)) { return(Users.Where(x => mob_user(x)).FirstOrDefault()); } else if (Drivers.Exists(mob_dri)) { return(Drivers.Where(x => mob_dri(x)).FirstOrDefault()); } else { return(null); } } else { if (Volunteers.Exists(email_vol)) { return(Volunteers.Where(x => email_vol(x)).FirstOrDefault()); } else if (Users.Exists(email_user)) { return(Users.Where(x => email_user(x)).FirstOrDefault()); } else if (Drivers.Exists(email_dri)) { return(Drivers.Where(x => email_dri(x)).FirstOrDefault()); } else { return(null); } } }
protected void Page_Load(object sender, EventArgs e) { DataSet result = new DataSet(); Volunteers objVolunteer = new Volunteers(); int errorCode = objVolunteer.getDetailsOnly(ref result); if (errorCode == 0) { gvVolunteerDetails.DataSource = result.Tables["VolunteerDetails"]; gvVolunteerDetails.DataBind(); } }
public async Task <IActionResult> Create([Bind("VolunteerId,UserId,VolunteerName,VolunteerSurname,VolunteerUserName,VolunteerEmail,VolunteerPassword,VolunteerPhoneNumber")] Volunteers volunteers) { if (ModelState.IsValid) { volunteers.VolunteerPassword = Crypto.Hash(volunteers.VolunteerPassword); _context.Add(volunteers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "UserId", "UserId", volunteers.UserId); return(View(volunteers)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Volunteers volunteers = db.Volunteers.Find(id); if (volunteers == null) { return(HttpNotFound()); } return(View(volunteers)); }
public void SpawnVolunteers(int number) { for (int i = 0; i < number; ++i) { GameObject volunteer = GameObject.Instantiate(m_VolunteerPrefab); volunteer.transform.parent = m_VolunteerParent; volunteer.SetActive(false); Volunteers volunteerComponent = volunteer.GetComponent <Volunteers>(); if (volunteerComponent != null) { m_VolunteerList.Add(volunteerComponent); } } }
public ActionResult _VolunteersCreatePartial([Bind(Include = "Id,Name,Email,Phone")] Volunteers volunteers) { if (ModelState.IsValid) { db.Volunteers.Add(volunteers); db.SaveChanges(); ModelState.Clear(); Response.Redirect(Request.Url.AbsolutePath); //redirects page to index page, prevents double submissions on page refresh. return(View()); } return(View(volunteers)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,OrgId,Name,PhoneCode,PhoneNumber,Age,Email,InstagramProfile,FacebookProfile,TwitterProfile,AddressLine1,AddressLine2,AddressStreet,AddressCity,AddressState,AddressCountry,AddressZipcode,Gender,ImageFile,ImagePath")] Volunteers volunteers) { var country = _unitOfWork.CountryRepository.GetByID(Convert.ToInt32(volunteers.AddressCountry)); var state = _unitOfWork.StateRepository.GetByID(Convert.ToInt32(volunteers.AddressState)); volunteers.PhoneCode = country.PhoneCode.ToString(); volunteers.PhoneNumber = volunteers.PhoneCode.ToString() + volunteers.PhoneNumber; if (id != volunteers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { // volunteers.ImagePath = await _imageService.ImageUpload(volunteers.ImageFile, "Banners"); volunteers.OrgId = orgId; //volunteers.ImagePath = await _imageService.ImageUpload(volunteers.ImageFile, "Banners"); volunteers.ImagePath = await _imageService.ImageUpload(volunteers.ImageFile, "Banners"); _unitOfWork.VolunteersRepository.Update(volunteers); await _unitOfWork.SaveAsync(); } catch (DbUpdateConcurrencyException) { if (!VolunteersExists(volunteers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } // ViewData["VolunteersTypeId"] = new SelectList(_unitOfWork.VolunteersTypeRepository.GetAll(), "Id", "Name", volunteers.VolunteersTypeId); ViewData["AddressCountry"] = new SelectList(_commonServices.GetCountries(), "Id", "Name", volunteers.AddressCountry); //int n = Convert.ToInt32(volunteers.AddressState); //ViewData["AddressState"] = new SelectList(_commonServices.GetStates(n), "Id", "Name", volunteers.AddressState); ViewData["PhoneCode"] = new SelectList(_commonServices.GetPhoneCode(), "Id", "PhoneCode", volunteers.PhoneCode); return(View(volunteers)); }
public async Task <IPagedResults <Volunteer> > GetVolunteersAsync(VolunteersSearchQueryParameters searchQuery) { var onlyEssUsers = searchQuery.OnlyEssUsers ?? false; var onlyAdmins = searchQuery.OnlyAdminUsers ?? false; var items = await Volunteers .Where(v => !searchQuery.HasQuery() || EF.Functions.Like(v.LastName, $"%{searchQuery.Query}%")) .Where(v => !onlyEssUsers || !v.IsAdministrator.Value) .Where(v => !onlyAdmins || v.IsAdministrator.Value) .Where(v => searchQuery.OrganizationId == null || v.Organization.Id == Guid.Parse(searchQuery.OrganizationId)) .Where(t => searchQuery.Active == t.Active) .Sort(searchQuery.SortBy ?? "lastname") .ToArrayAsync(); return(new PaginatedList <Volunteer>(mapper.Map <IEnumerable <Volunteer> >(items), searchQuery.Offset, searchQuery.Limit)); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { Volunteers volunteers = null; try { volunteers = (Volunteers)volunteersDataGrid.SelectedItem; ctx.Volunteers.Remove(volunteers); ctx.SaveChanges(); } catch (DataException ex) { MessageBox.Show(ex.Message); } volunteerViewSource.View.Refresh(); }
public async Task <IActionResult> Create([Bind("Id,OrgId,Name,VolunteersTypeId,PhoneNumber,Age,Email,InstagramProfile,FacebookProfile,TwitterProfile,AddressLine1,AddressLine2,AddressStreet,AddressCity,AddressState,AddressCountry,AddressZipcode")] Volunteers volunteers) { if (ModelState.IsValid) { volunteers.OrgId = orgId; _unitOfWork.VolunteersRepository.Insert(volunteers); await _unitOfWork.SaveAsync(); return(RedirectToAction(nameof(Index))); } return(View(volunteers)); }
// GET: Volunteer public async Task <ActionResult> Index() { Volunteers TskVol = new Volunteers(); TskVol.tasks = (from o in db.Tasks orderby o.Modified_date descending select o).Take(5).ToList(); TskVol.volunteers = db.Volunteers.OrderByDescending(a => a.Date).Take(5).ToList(); var responseString = await client.GetStringAsync("http://mmgnr1keg7.execute-api.us-east-1.amazonaws.com/prod/api/feature/careers"); dynamic developer = JObject.Parse(responseString); ViewBag.Developer = (string)developer["name"]; return(View("Admin/Index", TskVol)); }
protected void Page_Load(object sender, EventArgs e) { DataSet result = new DataSet(); Elderlies objElder = new Elderlies(); Volunteers objVolunteer = new Volunteers(); objVolunteer.EmailAddr = Session["LoginID"].ToString(); objVolunteer.getPass(); objVolunteer.getId(); int errorCode = objVolunteer.getPrepare(ref result); if (errorCode == 0) { gvElderPrepare.DataSource = result.Tables["ElderDetails"]; gvElderPrepare.DataBind(); } }
public ActionResult Edit(HttpPostedFileBase volunteer_cv, [Bind(Include = "volunteer_id,volunteer_name,volunteer_dob,volunteer_email,volunteer_phone,volunteer_interests,volunteer_shifts,volunteer_message,volunteer_cv")] Volunteers volunteers) { try { if (ModelState.IsValid) { db.Entry(volunteers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Admin")); } return(View(volunteers)); } catch (Exception e) { ViewBag.ExceptionMessage = e.Message; } return(View("~/Views/Errors/Details.cshtml")); }
private void AddVolunteers(Person person, Organization organization) { TaskGroup group = new TaskGroup(TaskGroupType.Volunteers); Volunteers volunteers = Volunteers.GetOpen(); foreach (Volunteer volunteer in volunteers) { if (volunteer.Owner.Identity == person.Identity) { group.Tasks.Add(new TaskVolunteer(volunteer)); } } if (group.Tasks.Count > 0) { Add(group); } }
public ActionResult Index(HttpPostedFileBase volunteer_cv, [Bind(Include = "volunteer_id,volunteer_name,volunteer_dob,volunteer_email,volunteer_phone,volunteer_interests,volunteer_shifts,volunteer_message,volunteer_cv")] Volunteers volunteers) { try { //load list of check box items ViewBag.Shifts = ca.Shifts(); ViewBag.Interests = ca.Areas_Of_Interest(); if (volunteer_cv != null) { var file_ext = System.IO.Path.GetExtension(volunteer_cv.FileName).Substring(1); if (ca.file_extensions.Contains(file_ext) == true) { var resume = Path.GetFileName(volunteer_cv.FileName); volunteers.volunteer_cv = resume; //move file to server and save var cv_path = Path.Combine(Server.MapPath("~/resumes/"), resume); volunteer_cv.SaveAs(cv_path); } else { ModelState.AddModelError(string.Empty, "File upload is not allowed. Please try again!"); } } if (ModelState.IsValid) { //save to DB db.Volunteers.Add(volunteers); db.SaveChanges(); ViewBag.err_msg = "Thanks for submiting your application. We will contact you soon!"; //return RedirectToAction("Index"); } return(View(volunteers)); } catch (Exception e) { ViewBag.ExceptionMessage = e.Message; } return(View("~/Views/Errors/Details.cshtml")); }
//warn the nearest volunteer there is someone cutting down the trees public Volunteers WarnNearestVolunteer(EvilPeople evilPerson) { float closestDist = Mathf.Infinity; Volunteers nearestVolunteer = null; if (m_PlayerVolunteer != null) { if (m_PlayerVolunteer.CheckCanChase()) { float newDist = Vector2.SqrMagnitude(evilPerson.transform.position - m_PlayerVolunteer.transform.position); nearestVolunteer = m_PlayerVolunteer; } } foreach (Volunteers volunteer in m_NPCObjectPooler.m_VolunteerList) { if (!volunteer.gameObject.activeSelf) { continue; } //make sure volunteer is available to start chasing if (!volunteer.CheckCanChase()) { continue; } float newDist = Vector2.SqrMagnitude(evilPerson.transform.position - volunteer.transform.position); if (newDist < closestDist) { closestDist = newDist; nearestVolunteer = volunteer; } } if (nearestVolunteer != null) { //pass the evil person to the nearest volunteer nearestVolunteer.ChaseEvilPerson(evilPerson); } return(nearestVolunteer); }
public ActionResult Details(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Volunteers volunteers = db.Volunteers.Find(id); if (volunteers == null) { return(HttpNotFound()); } return(View(volunteers)); } catch (Exception e) { ViewBag.ExceptionMessage = e.Message; } return(View("~/Views/Errors/Details.cshtml")); }
public ActionResult DeleteConfirmed(int id) { try { Volunteers volunteers = db.Volunteers.Find(id); db.Volunteers.Remove(volunteers); if (volunteers.volunteer_cv != null) { string resume_path = Request.MapPath("~/resumes/" + volunteers.volunteer_cv); System.IO.File.Delete(resume_path); //delete file from server } db.SaveChanges(); return(RedirectToAction("Admin")); } catch (Exception e) { ViewBag.ExceptionMessage = e.Message; } return(View("~/Views/Errors/Details.cshtml")); }
protected void PopulateGrids (bool rebuildOthersGrid) { Volunteers allVolunteers = Volunteers.GetOpen(); int currentUserId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); Person viewingPerson = Person.FromIdentity(currentUserId); Authority authority = viewingPerson.GetAuthority(); Volunteers geoVolunteers = new Volunteers(); Volunteers directReportVolunteers = new Volunteers(); Volunteers vicesAndAdminsVolunteers = new Volunteers(); Volunteers ownerVolunteers = new Volunteers(); Geographies authGeos = this.GetAuthorityArea(); People directReports = GetDirectReports(); People vicesAndAdmins = this.GetVicesAndAdmins(); // Build lookup tables Dictionary<int, bool> geoLookup = new Dictionary<int, bool>(); Dictionary<int, bool> directReportLookup = new Dictionary<int, bool>(); Dictionary<int, bool> vicesAndAdminsLookup = new Dictionary<int, bool>(); Dictionary<int, bool> leadsVicesAndAdminsLookup = new Dictionary<int, bool>(); foreach (Geography geo in authGeos) { geoLookup[geo.Identity] = true; } foreach (Person person in directReports) { directReportLookup[person.Identity] = true; } foreach (Person person in vicesAndAdmins) { vicesAndAdminsLookup[person.Identity] = true; } // Build volunteer lists Dictionary<int, Organization> viewerOrgDict = new Dictionary<int, Organization>(); Organizations viewerOrgsList = authority.GetOrganizations(RoleTypes.AllLocalRoleTypes ); foreach (Organization o in viewerOrgsList) viewerOrgDict[o.Identity]= o; //Volunteers filteredVolunteers = new Volunteers(); //foreach (Volunteer volunteer in allVolunteers) //{ // try // { // Person p = volunteer.Person; // filteredVolunteers.Add(volunteer); // } // catch // { // } //} //allVolunteers = filteredVolunteers; foreach (Volunteer volunteer in allVolunteers) { try { bool hasAuthority = false; // Only show geoVolunteers that volounteered for an org where viewer have a role. // (This is currently always PP) // Unless it is directly assigned. foreach (VolunteerRole rle in volunteer.Roles) { if (viewerOrgDict.ContainsKey(rle.OrganizationId)) { hasAuthority = true; break; } } if (hasAuthority && geoLookup.ContainsKey(volunteer.Geography.Identity)) { geoVolunteers.Add(volunteer); /* Fix for the viewing users volunteers showing up in more than one list */ // BROKEN FIX -- this caused only one volunteer to be displayed, EVER, and delayed // volunteer processing by several days -RF //break; } // If directly assigned to me show regardless of org. if (volunteer.OwnerPersonId == currentUserId) { ownerVolunteers.Add(volunteer); } if (hasAuthority && directReportLookup.ContainsKey(volunteer.OwnerPersonId)) { directReportVolunteers.Add(volunteer); } if (hasAuthority && vicesAndAdminsLookup.ContainsKey(volunteer.OwnerPersonId)) { vicesAndAdminsVolunteers.Add(volunteer); } } finally { // DEBUG USE ONLY - INTENTIONALLY NO EFFECT } } if (rebuildOthersGrid) { geoVolunteers.Remove(ownerVolunteers); geoVolunteers.Remove(directReportVolunteers); geoVolunteers.Remove(vicesAndAdminsVolunteers); this.GridOther.DataSource = geoVolunteers; } this.GridLeadGeography.DataSource = vicesAndAdminsVolunteers; this.GridReports.DataSource = directReportVolunteers; this.GridOwner.DataSource = ownerVolunteers; }