//Show a listbox to add extra skills in positions in postings create private void PopulateAssignedPostingSkillData(Posting postings) { var allSkills = db.Skills; var pSkills = new HashSet <int>(postings.Skills.Select(b => b.ID)); var viewModelAvailable = new List <SkillVM>(); var viewModelSelected = new List <SkillVM>(); foreach (var skill in allSkills) { if (pSkills.Contains(skill.ID)) { viewModelSelected.Add(new SkillVM { SkillID = skill.ID, SkillName = skill.SkillName, Assigned = pSkills.Contains(skill.ID) }); } else { viewModelAvailable.Add(new SkillVM { SkillID = skill.ID, SkillName = skill.SkillName, Assigned = pSkills.Contains(skill.ID) }); } } ViewBag.selSkills = new MultiSelectList(viewModelSelected, "SkillID", "SkillName"); ViewBag.availSkills = new MultiSelectList(viewModelAvailable, "SkillID", "SkillName"); }
public static Posting GetOtherStationPosting(string ThisStation) { // p.Originator realy means 'posting message DESTINATION' var qq = Posting.All().Where(p => p.Originator == ThisStation).Select(p => new Posting()); //IEnumerable<Posting> q = Posting.All(); //// p.Originator realy means 'posting message DESTINATION' //q.Where( p => p.Originator == ThisStation && // p.NumberofPendingUpdates == 0); //q.Select( p => new Posting()); if (qq.Count() > 0) { return qq.First(); } else { return new Posting { DataType = "CurrentDayPickup", DefaultRouteId = "999", key = null, NumberofPendingUpdates = 99, isDragnDrop = false, Originator = "foo" }; } }
private void UpdatePostingSkills(string[] selectedSkills, Posting postingToUpdate) { if (selectedSkills == null) { postingToUpdate.Skills = new List <Skill>(); return; } var selectedSkillsHS = new HashSet <string>(selectedSkills); var postingSkills = new HashSet <int> (postingToUpdate.Skills.Select(c => c.ID));//IDs of the currently selected skills foreach (var skill in db.Skills) { if (selectedSkillsHS.Contains(skill.ID.ToString())) { if (!postingSkills.Contains(skill.ID)) { postingToUpdate.Skills.Add(skill); } } else { if (postingSkills.Contains(skill.ID)) { postingToUpdate.Skills.Remove(skill); } } } }
public async Task <IActionResult> Edit(int id, [Bind("PostingId,JobTitle,JobLocation,Category,Requirements,NumberOfVolunteersNeeded,AgeRequirementFrom,AgeRequirementTo,State,DateOfPosting,ApplicationUserId")] Posting posting) { if (id != posting.PostingId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(posting); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostingExists(posting.PostingId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(posting)); }
private void UpdatePostingRequirements(string[] selectedReqs, Posting postingToUpdate) { if (selectedReqs == null) { postingToUpdate.Requirements = new List <Requirement>(); return; } var selectedRequirementHS = new HashSet <string>(selectedReqs); var postingRequirements = new HashSet <int> (postingToUpdate.Requirements.Select(c => c.ID));//IDs of the currently selected Reqs foreach (var reqs in db.Requirements) { if (selectedRequirementHS.Contains(reqs.ID.ToString())) { if (!postingRequirements.Contains(reqs.ID)) { postingToUpdate.Requirements.Add(reqs); } } else { if (postingRequirements.Contains(reqs.ID)) { postingToUpdate.Requirements.Remove(reqs); } } } }
private void SavedAsTemplate_fn(string templateName, Posting posting, string selectedRequirements, string selectedSkills, string selectedLocations, string selectedDays) { //var postingTemplateHS = new HashSet<int>(db.PostingTemplates.Where(pt => pt.PositionID == posting.PositionID).Select(pt => pt.PositionID)); PostingTemplate postingTemplate = new PostingTemplate { templateName = templateName, pstNumPosition = posting.pstNumPosition, pstFTE = posting.pstFTE, pstSalary = posting.pstSalary, pstCompensationType = posting.pstCompensationType, pstJobDescription = posting.pstJobDescription, pstOpenDate = posting.pstOpenDate, pstEndDate = posting.pstEndDate, pstJobStartDate = posting.pstJobStartDate, pstJobEndDate = posting.pstJobEndDate, PositionID = posting.PositionID, RequirementIDs = selectedRequirements, SkillIDs = selectedSkills, LocationIDs = selectedLocations, dayIDs = selectedDays }; //if (postingTemplateHS.Contains(posting.PositionID)) //{ // var postingTemplateToDelete = db.PostingTemplates.Find(posting.PositionID); // db.PostingTemplates.Remove(postingTemplateToDelete); //} db.PostingTemplates.Add(postingTemplate); }
public ActionResult AddPost(Posting posting) { posting.PostingDate = DateTime.Today; posting.PostingAuthor = "John Doe"; repo.AddPosting(posting); return(View("AddPost")); }
// GET: Postings/Details/5 public ActionResult Details(int?id, int userID) { if (id == null) { logger.Info("Details/ Bad HTTP Request with ID {0}", id); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string userName = db.Applicants.Where(a => a.ID == userID).Select(a => a.apFirstName).SingleOrDefault(); int n_y = db.JobGroups.Max(jg => jg.ID); Posting posting = db.Postings.Find(id); int jobTypeID = posting.Position.JobGroupID; Picked pickedToEdit = db.Pickeds.Where(p => p.PickedID == userID).SingleOrDefault(); if (pickedToEdit != null) { pickedToEdit.jobTypePrevPicked2 = pickedToEdit.jobTypePrevPicked1; pickedToEdit.jobTypePrevPicked1 = pickedToEdit.jobTypeJustPicked; pickedToEdit.jobTypeJustPicked = jobTypeID; pickedToEdit.firstTimeAccess = false; recommenderSystem.FavoriteJobType_train(userID, pickedToEdit.jobTypePrevPicked1, pickedToEdit.jobTypePrevPicked2, pickedToEdit.jobTypeJustPicked, n_y, userName); db.SaveChanges(); } if (posting == null) { logger.Info("Details/ Failed to find Posting with ID {0}", id); return(HttpNotFound()); } ViewBag.JobRequirements = db.JobRequirements.Where(j => j.PostingID == id); ViewBag.JobLocations = db.JobLocations.Where(jl => jl.PostingID == id); ViewBag.PostingSkills = db.PostingSkills.Where(ps => ps.PostingID == id); return(View(posting)); }
public ActionResult Delete(int?id) { if (id == null) { logger.Info("Delete/ Bad HTTP Request with ID {0}", id); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Posting posting = db.Postings.Find(id); if (User.IsInRole("Hiring Team")) { if (posting.CreatedBy != User.Identity.Name) { logger.Info("Delete/ Bad HTTP Gateway"); return(new HttpStatusCodeResult(HttpStatusCode.BadGateway)); } } if (posting == null) { logger.Info("Delete/ HTTP Not Found Posting ID {0}", id); return(HttpNotFound()); } ViewBag.JobRequirements = db.JobRequirements.Where(j => j.PostingID == id).OrderBy(a => a.QualificationID); ViewBag.JobLocations = db.JobLocations.Where(jl => jl.PostingID == id); ViewBag.PostingSkills = db.PostingSkills.Where(ps => ps.PostingID == id); return(View(posting)); }
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath) { var cell = (FeedResultsCell)tableView.DequeueReusableCell(FeedResultsCell.Key); if (cell == null) { cell = new FeedResultsCell(); } cell.BackgroundColor = ColorScheme.Clouds; Posting post = feedClient.postings[indexPath.Row]; cell.PostingTitle.AttributedText = new NSAttributedString(post.PostTitle, Constants.HeaderAttributes); cell.PostingDescription.AttributedText = new NSAttributedString(post.Description, Constants.FeedDescriptionAttributes); if (post.ImageLink != "-1") { cell.PostingImage.SetImage( url: new NSUrl(post.ImageLink), placeholder: UIImage.FromBundle("placeholder.png") ); } else { cell.PostingImage.Image = UIImage.FromBundle("placeholder.png"); } return(cell); }
//Updates the Posting types on edit private void UpdatePostingTypes(string[] selectedTypes, Posting postingToUpdate) { if (selectedTypes == null) { postingToUpdate.Posting_PostingTypes = new List <Posting_PostingType>(); return; } var selectedTypesHS = new HashSet <string>(selectedTypes); var postingTypes = new HashSet <int> (postingToUpdate.Posting_PostingTypes.Select(c => c.PostingTypes.PostingTypeID)); foreach (var type in _context.PostingTypes) { if (selectedTypesHS.Contains(type.PostingTypeID.ToString())) { if (!postingTypes.Contains(type.PostingTypeID)) { postingToUpdate.Posting_PostingTypes.Add(new Posting_PostingType { PostingID = postingToUpdate.PostingID, PostingTypeID = type.PostingTypeID }); } } else { if (postingTypes.Contains(type.PostingTypeID)) { Posting_PostingType typeToRemove = postingToUpdate.Posting_PostingTypes.FirstOrDefault(i => i.PostingTypeID == type.PostingTypeID); _context.Remove(typeToRemove); } } } }
private void PopulateAssignedQualificationData(Posting posting) { var allqual = db.Qualifications; var appquals = new HashSet <int>(posting.Qualifications.Select(b => b.ID)); var viewModelAvailable = new List <AssignedQualificationVM>(); var viewModelSelected = new List <AssignedQualificationVM>(); foreach (var ql in allqual) { if (appquals.Contains(ql.ID)) { viewModelSelected.Add(new AssignedQualificationVM { QualificationID = ql.ID, QualificationName = ql.Name, // Assigned = true }); } else { viewModelAvailable.Add(new AssignedQualificationVM { QualificationID = ql.ID, QualificationName = ql.Name, // Assigned = true }); } } ViewBag.selOpts = new MultiSelectList(viewModelSelected, "QualificationID", " QualificationName"); ViewBag.availOpts = new MultiSelectList(viewModelAvailable, "QualificationID", " QualificationName"); }
//private void PopulateAssignedCityData(Posting posting) //{ // var appcities = new HashSet<int>(posting.Cities.Select(b => b.ID)); // var viewModelAvailable = new List<AssignedCityVM>(); // var viewModelSelected = new List<AssignedCityVM>(); // foreach (var ql in allcities) // { // if (appcities.Contains(ql.ID)) // { // viewModelSelected.Add(new AssignedCityVM // { // CityID = ql.ID, // CityName = ql.Name, // // Assigned = true // }); // } // else // { // viewModelAvailable.Add(new AssignedCityVM // { // CityID = ql.ID, // CityName = ql.Name, // // Assigned = true // }); // } // } // ViewBag.selCities = new MultiSelectList(viewModelSelected, "CityID", "CityName"); // ViewBag.availCities = new MultiSelectList(viewModelAvailable, "CityID", " CityName"); //} private void PopulateAssignedSchoolData(Posting posting) { var allschools = db.Schools; var appschools = new HashSet <int>(posting.Schools.Select(b => b.ID)); var viewModelAvailable = new List <AssignedSchoolVM>(); var viewModelSelected = new List <AssignedSchoolVM>(); foreach (var ql in allschools) { if (appschools.Contains(ql.ID)) { viewModelSelected.Add(new AssignedSchoolVM { SchoolID = ql.ID, SchoolName = ql.Name, // Assigned = true }); } else { viewModelAvailable.Add(new AssignedSchoolVM { SchoolID = ql.ID, SchoolName = ql.Name, // Assigned = true }); } } ViewBag.selSchools = new MultiSelectList(viewModelSelected, "SchoolID", "SchoolName"); ViewBag.availSchools = new MultiSelectList(viewModelAvailable, "SchoolID", "SchoolName"); }
//public ActionResult Index() //{ // if (!User.IsInRole("Admin")) // { // return View("Indexuser", db.Postings.OrderBy(p => p.Name).ToPagedList(1, 25)); // } // return View(db.Postings.OrderBy(p => p.Name).ToPagedList(1, 25)); //} // GET: Postings/Details/5 public ActionResult Details(int?id, string message) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Posting posting = db.Postings.AsNoTracking() //.Include(p =>p.City) //.Include(p => p.School) .Include(p => p.Skills) .Include(p => p.Qualifications) .Include(p => p.Position) .Include(p => p.Applications) .Where(p => p.ID == id).SingleOrDefault(); var postype = posting.PositionType; if (postype == "Teaching") { ViewBag.SkillsList = posting.Qualifications.ToList(); } if (postype == "Non-Teaching") { ViewBag.SkillsList = posting.Skills.ToList(); } if (posting == null) { return(HttpNotFound()); } ViewBag.Message = message; ViewBag.Closed = posting.ClosingDate < DateTime.Today; return(View(posting)); }
private void PopulateAssignedSkillData(Posting posting) { var allSkills = db.Skills; var appSkills = new HashSet <int>(posting.Skills.Select(b => b.ID)); var viewModelAvailable = new List <AssignedSkillVM>(); var viewModelSelected = new List <AssignedSkillVM>(); foreach (var skills in allSkills) { if (appSkills.Contains(skills.ID)) { viewModelSelected.Add(new AssignedSkillVM { SkillID = skills.ID, SkillName = skills.SkillName, // Assigned = true }); } else { viewModelAvailable.Add(new AssignedSkillVM { SkillID = skills.ID, SkillName = skills.SkillName, // Assigned = false }); } } ViewBag.selOpts = new MultiSelectList(viewModelSelected, "SkillID", "SkillName"); ViewBag.availOpts = new MultiSelectList(viewModelAvailable, "SkillID", "SkillName"); }
//private void UpdatePostingCities(string[] selectedCities, Posting postingToUpdate) //{ // if(selectedCities==null) // { // postingToUpdate.Cities = new List<City>(); // return; // } // var selectedcitiesHS = new HashSet<string>(selectedCities); // var postingcities = new HashSet<int> // (postingToUpdate.Cities.Select(c => c.ID)); // foreach (var qual in db.Cities) // { // if (selectedcitiesHS.Contains(qual.ID.ToString())) // { // if (!postingcities.Contains(qual.ID)) // { // postingToUpdate.Cities.Add(qual); // } // } // else // { // if (postingcities.Contains(qual.ID)) // { // postingToUpdate.Cities.Remove(qual); // } // } // } //} private void UpdatePostingSchools(string[] selectedSchools, Posting postingToUpdate) { if (selectedSchools == null) { postingToUpdate.Schools = new List <School>(); return; } var selectedschoolsHS = new HashSet <string>(selectedSchools); var postingschools = new HashSet <int> (postingToUpdate.Schools.Select(c => c.ID)); foreach (var qual in db.Schools) { if (selectedschoolsHS.Contains(qual.ID.ToString())) { if (!postingschools.Contains(qual.ID)) { postingToUpdate.Schools.Add(qual); } } else { if (postingschools.Contains(qual.ID)) { postingToUpdate.Schools.Remove(qual); } } } }
public ActionResult Post(Posting posting) { if (!ModelState.IsValid) { var viewModel = new PostingFormViewModel { Posting = posting, PostingTypes = _context.PostingTypes.ToList(), PageTitle = "Edit" }; return(View("PostingForm", viewModel)); } if (posting.Id == 0) { var currentUser = User.Identity.GetUserId(); var user = _context.Users.Single(u => u.Id == currentUser); posting.UserId = currentUser; posting.TimePosted = DateTime.Now; posting.OrganizationId = user.OrganizationId; _context.Postings.Add(posting); } else { var postingInDb = _context.Postings.Single(p => p.Id == posting.Id); postingInDb.Title = posting.Title; postingInDb.PostingTypeId = posting.PostingTypeId; postingInDb.TimePosted = posting.TimePosted; postingInDb.Description = posting.Description; postingInDb.UserId = posting.UserId; } _context.SaveChanges(); return(RedirectToAction("Index", "Posting")); }
public IHttpActionResult GetPosting(int id) { Posting posting = db.Postings.Find(id); Competition competition = db.Competitions.Where(c => c.CompetitionId == posting.CompetitionId).FirstOrDefault(); User user = db.Users.Where(u => u.UserId == posting.UserId).FirstOrDefault(); if (posting == null) { return(NotFound()); } return(Ok(new { CompetitionId = competition.CompetitionId, CompetitionName = competition.CompetitionName, AwardId = competition.AwardId, Descriptions = competition.Descriptions, StartDate = competition.StartDate, EndDate = competition.EndDate, PostingId = posting.PostingId, Mark = posting.Mark, Quote = posting.Quote, LastEdit = posting.LastEdit, ImagePath = posting.ImagePath, PostingUserId = posting.UserId, UserNameCreatePosting = user.Username })); }
/// <summary> /// Create a new posting /// </summary> /// <param name="lastAccountEvent"></param> /// <param name="LastCounterAccountEvent"></param> /// <param name="mutationType"></param> /// <param name="entryType"></param> /// <param name="amount"></param> /// <param name="currency"></param> /// <param name="descr2"></param> /// <param name="descr3"></param> /// <returns>Posting object</returns> public static Posting CreatePosting(Mutation lastAccountEvent, Mutation LastCounterAccountEvent, MutationTypes mutationType, MutationEntryTypes entryType, decimal amount, string currency, string descr2 = "", string descr3 = "") { Posting result = new Posting(); Mutation accountEvent = CreateMutation(lastAccountEvent, LastCounterAccountEvent, mutationType, entryType, amount, currency, descr2, descr3); // Swap CR to DR and Vsa versa before creating a CounteraccountEvent. MutationEntryTypes CounterEntryType; if (entryType == MutationEntryTypes.Cr) { CounterEntryType = MutationEntryTypes.Dr; } else { CounterEntryType = MutationEntryTypes.Cr; } Mutation CounteraccountEvent = CreateMutation(LastCounterAccountEvent, lastAccountEvent, mutationType, CounterEntryType, amount, currency, descr2, descr3); // Set the mutation id's in the counterAccounts. CounteraccountEvent.CounterAccount.MutationId = accountEvent.MutationId; accountEvent.CounterAccount.MutationId = CounteraccountEvent.MutationId; result.Mutations[0] = accountEvent; result.Mutations[1] = CounteraccountEvent; return(result); }
private async Task AddDocumentsAsync(Posting posting, List <IFormFile> theFiles) { foreach (var f in theFiles) { if (f != null) { string mimeType = f.ContentType; string fileName = Path.GetFileName(f.FileName); long fileLength = f.Length; //Note: you could filter for mime types if you only want to allow //certain types of files. I am allowing everything. if (!(fileName == "" || fileLength == 0))//Looks like we have a file!!! { PostingDocument d = new PostingDocument(); using (var memoryStream = new MemoryStream()) { await f.CopyToAsync(memoryStream); d.FileContent.Content = memoryStream.ToArray(); } d.MimeType = mimeType; d.FileName = fileName; posting.PostingDocuments.Add(d); } ; } } }
public ActionResult Create([Bind(Include = "Id,Title,Content,ClosingDate")] Posting posting, int[] skillsToAdd, int SchoolProgramId) { var whatis = SchoolProgramId; SchoolProgram sp = db.Programs.FirstOrDefault(x => x.Id == SchoolProgramId); //posting needs a school program var userId = User.Identity.GetUserId(); Company company = db.Companies.Find(userId); if (userId == null) { return(RedirectToAction("MessagePage", "Home", new MessageCarrier { message = "You must be signed in as a company to submit a new job posting", actn = "Index", ctrller = "Home" })); } posting.PostingDate = DateTime.Now; posting.SchoolProgram = sp; foreach (int skillId in skillsToAdd) { Skill skill = db.Skills.Find(skillId); posting.Skills.Add(skill); } if (ModelState.IsValid) { company.Postings.Add(posting); db.SaveChanges(); return(RedirectToAction("Details", new { id = posting.Id })); } return(View(posting)); }
public async Task <IActionResult> Create([Bind("ID,NumberOpen,ClosingDate,StartDate,PositionID")] Posting posting , List <IFormFile> theFiles) { try { if (ModelState.IsValid) { await AddDocumentsAsync(posting, theFiles); _context.Add(posting); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (RetryLimitExceededException /* dex */) { ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator."); } catch (DbUpdateException dex) { if (dex.GetBaseException().Message.Contains("UNIQUE constraint failed")) { ModelState.AddModelError("", "Unable to save changes. Remember, you cannot have multiple postings for the same position with the same closing date."); } else { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } } PopulateDropDownLists(posting); return(View(posting)); }
private void UpdatePostingPokemon(string[] selectedPokemons, Posting postingToUpdate) { if (selectedPokemons == null) { postingToUpdate.Pokemons = new List <Pokemon>(); return; } var selectedPokemonHS = new HashSet <string>(selectedPokemons); var postingPokemon = new HashSet <int> (postingToUpdate.Pokemons.Select(c => c.PokemonId)); foreach (var pokemon in db.Pokemons) { if (selectedPokemonHS.Contains(pokemon.PokemonId.ToString())) { if (!postingPokemon.Contains(pokemon.PokemonId)) { postingToUpdate.Pokemons.Add(pokemon); } } else { if (postingPokemon.Contains(pokemon.PokemonId)) { postingToUpdate.Pokemons.Remove(pokemon); } } } }
public void UpdateTest_createNewPublish_and_Update_Position_Return_Successfully() { //Arrange var parameter = new ParametersForPosition() { SchoolYear = "20192020", PositionID = getNewPublishID("LTO").ToString() }; var position = PublishPositionExe.Position(parameter)[0]; position.Operate = "Update"; position.SchoolYear = "20192020"; position.PositionTitle = "Test Grade 10 Teacher"; position.PositionLevel = "BC708E"; position.Description = " position descriptions from HR staff using interface method"; position.StartDate = "2019/09/03"; position.EndDate = "2020/06/30"; position.DatePublish = "2019/12/11"; position.DateApplyOpen = "2019/12/13"; position.DateApplyClose = "2019/12/15"; string expect = "Successfully"; //Act var testPosition = new Posting(new PostingPublish()); // IPostingPosition<string> testPosition = new PostingPublish<string>(); // var testList = testPosition.Update(parameter) .Position(parameter);// RequestPostingExe.Positions(parameter); string result = testPosition.Update(position); //Assert Assert.AreEqual(expect, result, $" Postion update is { result} "); }
public static Posting Get_next_posting_to_process(string ThisStation) { IList <Posting> plist; plist = Posting.Find(x => x.Originator == ThisStation); return(plist.Count > 0 ? plist.First() : null); }
public void PositionsTest_Return_All_Published_PositionList() { //Arrange ParametersForPositionList parameter = new ParametersForPositionList() { Operate = "Position", UserID = "mif", SchoolYear = "20192020", PositionType = "LTO", Panel = "All", Status = "Open", SearchBy = "All", SearchValue1 = "", SearchValue2 = "" }; string action = "Position"; // parameter.Operate = action; string expect = "334"; //Act // var myList = new PostingPosition<PositionListPublish>(new PostingPublish<PositionListPublish>()); var myList = new Posting(new PostingPublish()); // IPostingPosition<PositionListPublish> myList = new PostingPublish<PositionListPublish>(); var testList = myList.Positions <PositionListPublish>(parameter); var myGridview = new System.Web.UI.WebControls.GridView(); myGridview.AutoGenerateColumns = true; myGridview.DataSource = testList; myGridview.DataBind(); var result = myGridview.Rows.Count.ToString(); //Assert // Assert.AreEqual(expect, result, $" Posting position List { result}"); Assert.IsNotNull(result, $" Request Posting position List { result}"); }
private void UpdatePositionDay(string[] selectedDay, Posting postingToUpdate) { if (selectedDay == null) { postingToUpdate.Days = new List <Day>(); return; } var selectedDaysHS = new HashSet <string>(selectedDay); var positionDays = new HashSet <int>(postingToUpdate.Days.Select(p => p.ID)); foreach (var day in db.Days) { if (selectedDaysHS.Contains(day.ID.ToString())) { if (!positionDays.Contains(day.ID)) { postingToUpdate.Days.Add(day); } } else { if (positionDays.Contains(day.ID)) { postingToUpdate.Days.Remove(day); } } } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Posting posting = db.Postings .Where(p => p.ID == id).SingleOrDefault(); if (posting == null) { return(HttpNotFound()); } if (posting.ClosingDate < DateTime.Today) { return(RedirectToAction("Details", new { id = posting.ID })); } PopulateDropDownLists(posting); PopulateAssignedSkillData(posting); PopulateAssignedQualificationData(posting); PopulateAssignedRequirmentData(posting); return(View(posting)); }
private void PopulateListBoxByID(int id, Posting posting) { // LINQ Query select Qualification table in order to receive ID and QlfDescription that correspond to PostingID var qJobRequirements = (from jr in db.JobRequirements join q in db.Qualification on jr.QualificationID equals q.ID where jr.PostingID == id select q.ID); var Qualifications = db.Qualification.OrderBy(q => q.QlfDescription); // LINQ Query select Location table in order to receive ID and Address that correspond to PostingID var qJobLocations = (from jl in db.JobLocations join l in db.Locations on jl.LocationID equals l.ID where jl.PostingID == id select l.ID); var Locations = db.Locations.OrderBy(l => l.Address); // LINKQ Query select Skill table in order to receive ID and SkillDescription that correspond to PostingID var qPostingSkills = (from ps in db.PostingSkills join s in db.Skills on ps.SkillID equals s.ID where ps.PostingID == id select s.ID); var Skills = db.Skills.OrderBy(s => s.SkillDescription); var Days = db.Days.OrderBy(d => d.dayOrder); var qDays = posting.Days.OrderBy(d => d.dayOrder).Select(d => d.ID); // Create ViewBags with value is MultiSelectList ViewBag.JobRequirements = new MultiSelectList(Qualifications, "ID", "QlfDescription", qJobRequirements.ToArray()); ViewBag.JobLocations = new MultiSelectList(Locations, "ID", "Address", qJobLocations.ToArray()); ViewBag.PostingSkills = new MultiSelectList(Skills, "ID", "SkillDescription", qPostingSkills.ToArray()); ViewBag.pDays = new MultiSelectList(Days, "ID", "dayName", qDays.ToArray()); }
private void UpdatePostingQualifications(string[] selectedQuals, Posting postingToUpdate) { if (selectedQuals == null) { postingToUpdate.Qualifications = new List <Qualification>(); return; } var selectedQualificationHS = new HashSet <string>(selectedQuals); var postingQualification = new HashSet <int> (postingToUpdate.Qualifications.Select(c => c.ID));//IDs of the currently selected Qualification foreach (var Qual in db.Qualifications) { if (selectedQualificationHS.Contains(Qual.ID.ToString())) { if (!postingQualification.Contains(Qual.ID)) { postingToUpdate.Qualifications.Add(Qual); } } else { if (postingQualification.Contains(Qual.ID)) { postingToUpdate.Qualifications.Remove(Qual); } } } }
public override void DoProcessRequest(IExecutionContext context) { posting = PostingDataAccess.Instance.LoadPosting(null, shortName); posting.Views++; PostingDataAccess.Instance.SavePosting(posting); contentType = defaultContentType; }
public ActionResult Create(string name, long channelId, long templateId) { var posting = new Posting(); posting.Name = name; posting.Channel = channelRepository.GetByPrimaryKey(channelId); posting.Template = templateRepository.GetByPrimaryKey(templateId); posting.Create(); TempData["Message"] = "Posting created"; return Redirect(Request.UrlReferrer.ToString()); }
protected Posting AddPosting(ref ShipmentOperation operation, string debt, string cred, DateTime date, Money summ, string comment = "", string type = "Standart") { var accDebt = _provider.GetAccount(debt); var accCred = _provider.GetAccount(cred); var posting = new Posting(type, accDebt, accCred, date, summ, String.IsNullOrEmpty(comment) ? operation.Comment : comment); operation.AddPosting(posting); return posting; }
public void ContactPerson(Posting companyProfile, userProfile contactUser, string contactText) { ContactRequest request = (ContactRequest)WSApplication.Application.ActivityRoot.GetDocumentFactory("ContactRequest").CreateDocument(); request.CompanyName = companyProfile.Heading; //request.CompanyUrl = UrlRewriter.Instance.GetContentUrl(companyProfile.ContentType, companyProfile.ShortName); request.ContactText = contactText; request.ToAddress = contactUser.Email; request.Send("/ContactNotification"); }
public void LoadTags(Posting posting, string tags) { if (tags == null) return; Dictionary<string, Posting.tag> reference = new Dictionary<string, Posting.tag>(); List<Posting.tag> dupList = new List<Posting.tag>(); foreach (Posting.tag node in posting.tags) { if (reference.ContainsKey(node.SafeText)) { dupList.Add(node); continue; } reference[node.SafeText] = node; } foreach (string tagText in ParseAndDedupeTags(tags)) { var safeText = StringHandler.Instance.ReplaceAll(tagText); if (reference.ContainsKey(safeText)) { reference.Remove(safeText); continue; } Posting.tag newTag = new Posting.tag(); newTag.TagText = tagText; newTag.SafeText = safeText; newTag.Posting = posting; posting.tags.Add(newTag); } ISession session = NHibernateManager.Instance.GetSession(); // remove deleted tags foreach (Posting.tag tag in reference.Values) { session.Delete(tag); posting.tags.Remove(tag); } // remove dup tags foreach (Posting.tag tag in dupList) { session.Delete(tag); posting.tags.Remove(tag); } }
public void LoadTags(Posting posting, string tags) { if (tags == null) return; Dictionary<string, Posting.tags_Node> reference = new Dictionary<string, Posting.tags_Node>(); List<Posting.tags_Node> dupList = new List<Posting.tags_Node>(); foreach (Posting.tags_Node node in posting.tags) { if (reference.ContainsKey(node.SafeText)) { dupList.Add(node); continue; } reference[node.SafeText] = node; } foreach (string tag in NormalizeTags(tags)) { if (reference.ContainsKey(tag)) { reference.Remove(tag); continue; } Posting.tags_Node node = posting.tags.AppendNode(); node.TagText = tag; node.SafeText = NormalizeTagText(tag); } // remove deleted tags foreach (Posting.tags_Node node in reference.Values) posting.tags.Remove(node); // remove dup tags foreach (Posting.tags_Node node in dupList) posting.tags.Remove(node); }
public override void DoProcessRequest(IExecutionContext context) { if (currentUser == null) return; // There are a few special cases we should be aware of // We allow access to a special "profile" id, and "new" id // one is accessing the user's profile, the other requests // that a new posting be created. Both are available to all // authenticated parties, therefore this controller grants // that access. if (shortName == "profile") posting = currentUser.Posting ?? PostingDataAccess.Instance.CreatePosting(currentUser); else if ( shortName == "new" || (String.IsNullOrEmpty(shortName) && String.IsNullOrEmpty(postingId))) posting = PostingDataAccess.Instance.CreatePosting(currentUser); else if (!String.IsNullOrEmpty(shortName)) posting = PostingDataAccess.Instance.LoadPosting(null, shortName); else posting = PostingDataAccess.Instance.LoadPosting(postingId, null); }
public void PopulatePosting(string contents, string tags, Posting posting, ContentType contentType) { if (posting.CreatedOn == null) { posting.ContentType = contentType; posting.CreatedOn = DateTime.Now; } if (posting.Contents == null) posting.Contents = new Contents(); posting.Contents.ContentsText = contents; if (contents != null) { string shortText = StripSummaryText(contents); posting.ShortText = shortText.Substring(0, Math.Min(shortTextLength, shortText.Length)); } else posting.ShortText = null; if (posting.Heading != null) { string salt = new Random().Next(1000000).ToString(); string shortName = StringHandler.Instance.ReplaceAll(posting.Heading); posting.ShortName = shortName.Substring( 0, Math.Min(shortNameLength - salt.Length, shortName.Length) ) + salt; } posting.LastModifiedOn = DateTime.Now; TagDataAccess.Instance.LoadTags(posting, tags); }
public void Transaction() { dataStore.Settings.AutoGenerate = true; dataStore.CreateStorage(typeof(Posting)); Posting posting = new Posting(); posting.Topic = "Transaction Test"; posting.Details = "Testing support of transactions."; dataStore.BeginTransaction(); dataStore.Insert(posting); dataStore.RollbackTransaction(); int count = dataStore.CreateFindCollectionCommand(typeof(Posting), null).Execute().Count; Assert.AreEqual(0,count,"Insert Rollback Test"); dataStore.BeginTransaction(); dataStore.Insert(posting); dataStore.CommitTransaction(); count = dataStore.CreateFindCollectionCommand(typeof(Posting), null).Execute().Count; Assert.AreEqual(1,count,"Insert Rollback Test"); posting.Topic = "Updated Transaction"; dataStore.BeginTransaction(); dataStore.Update(posting); dataStore.Update(posting); dataStore.RollbackTransaction(); Posting updatedPosting = (Posting)dataStore.CreateFindObjectCommand(typeof(Posting),"WHERE ID = " + posting.ID).Execute();; Assert.AreEqual(updatedPosting.Topic,"Transaction Test","Update Rollback Test"); dataStore.DeleteStorage(typeof(Posting)); }
public void SavePosting(Posting posting) { posting.LastModifiedOn = DateTime.Now; ISession session = NHibernateManager.Instance.GetSession(); if (posting.Contents != null) session.SaveOrUpdate(posting.Contents); session.SaveOrUpdate(posting); session.Flush(); }
public Posting CreatePosting(UserProfile currentUser) { var posting = new Posting(); posting.User = currentUser; posting.tags = new List<Posting.tag>(); posting.Views = 0; posting.Deleted = false; posting.Flagged = false; posting.Published = false; posting.Active = false; posting.CreatedOn = DateTime.Now; return posting; }
public override void DoProcessRequest(IExecutionContext context) { posting = PostingHelper.Instance.LoadPosting(null, shortName); contentType = defaultContentType; }
private void InsertTestData() { Employee e = new Employee(); e.EmployeeID = "2"; e.FirstName = "Sam"; e.LastName = "Donaldson"; e.Title = "Director"; e.Salary = 70000; dataStore.Insert(e); e = new Employee(); e.EmployeeID = "3"; e.FirstName = "Dave"; e.LastName = "Donner"; e.Title = "Engineer"; e.Salary = 50000; dataStore.Insert(e); e = new Employee(); e.EmployeeID = "4"; e.FirstName = "Bill"; e.LastName = "Stevenson"; e.Title = "Analyst"; e.Salary = 40000; dataStore.Insert(e); Manager m = new Manager(); m.EmployeeID = "5"; m.FirstName = "Sam"; m.LastName = "Smith"; m.Certified = true; m.Title = "Director"; m.Salary = 90000; dataStore.Insert(m); Project p = new Project(); p.Name = "ProjectX"; p.ProjectID = "1"; p.ManagerID = "5"; dataStore.Insert(p); Task t = new Task(); t.ProjectID = p.ProjectID; t.Description = "Task 1"; dataStore.Insert(t); t.Description = "Task 2"; dataStore.Insert(t); Posting ps = new Posting(); ps.Topic = "Topic 1"; ps.Details = "Some details."; dataStore.Insert(ps); ps = new Posting(); ps.Topic = "Topic w"; ps.Details = "Some details."; dataStore.Insert(ps); }
public string GetTagsText(Posting posting) { StringBuilder tags = new StringBuilder(); foreach (Posting.tags_Node node in posting.tags) { if (tags.Length > 0) tags.Append(", "); tags.Append(node.TagText); } return tags.ToString(); }
/// <summary> /// This routine implements the primary functionality of this window. /// calls pickup.save(), ReFreshThisRoute() /// </summary> /// <remarks> /// triggered by CRLF in txtComment control /// </remarks> public void AddPickup() { //calls pu.save() string strCustomerName = null; string strComment = " "; string strCDPSyncID = null; int i = 0; lblCustomerName.Text =lblCustomerName.Text == null ? "" : lblCustomerName.Text; txtComment.Text =txtComment.Text == null ? "" : txtComment.Text; txtComment.Text =txtComment.Text == null ? "" : txtComment.Text; strComment =txtComment.Text; // force the comment to be only 30 chars long. // the database column is only that wide. if (strComment.Length > 30) { var sb = new StringBuilder(); sb.AppendLine("Only 30 characters allowed") sb.AppendLine("Discarding: " + strComment.Substring(31)); Strings.Mid(strComment, 31)); MessageBox.Show("Only 30 characters allowed" + Constants.vbCrLf + "Discarding: " + Strings.Mid(strComment, 31)); strComment = Strings.Mid(strComment, 1, 30); } intCDPSyncCount += 1; strCDPSyncID = Environment.MachineName + "_Pkp_" + intCDPSyncCount.ToString; CurrentDayPickup pu = new CurrentDayPickup(); pu.CDPSyncID = strCDPSyncID; pu.CDPCustomerName = strCustomerName; // use the hidden one here pu.CDPCustomerID = pnlCustomerDetails.Controls.Item("lblOrigCustID").Text; //pu.CDPCustomerID = txtCustomerID.Text pu.CDPComment = strComment; pu.CDPPickupDate = Today; pu.CDPDefaultRouteID = txtDefaultRoute.Text; pu.CDPDispatched = false; pu.CDPStation = Environment.MachineName; pu.CDPChecked = false; pu.UserName = Environment.UserName; pu.PostedCount = My.MySettings.Default.ActiveStations - 1; pu.Terminal = My.MySettings.Default.Terminal; pu.CDPCreatedBy = Environment.MachineName; pu.CDPCreatedTime = Now; pu.CDPEditedBy = ""; pu.Save(); // post it int pendingUpdates = My.MySettings.Default.ActiveStations - 1; string initiatingUser = Environment.UserName; Posting job = new Posting(pu, pendingUpdates, initiatingUser); job.Save(); //Me.ParentForm.MdiChildren(0).Tag frmRoute frm = default(frmRoute); for (i = 0; i <= this.ParentForm.MdiChildren.Length - 1; i++) { if (((this.ParentForm.MdiChildren(i)) is TabForm | (this.ParentForm.MdiChildren(i)) is InputForm)) { continue; } if ((txtDefaultRoute.Text == this.ParentForm.MdiChildren(i).Text.Substring(0, 2))) { frm = this.ParentForm.MdiChildren(i); frm.RefreshDynamicPickupControls(); //MainWindow.RefreshThisRoute(frm) ' sometimes threw an exception break; // TODO: might not be correct. Was : Exit For } } //ClearCustomerInfo() txtComment.Text = ""; txtCustomerID.Text = ""; txtCustomerID.Focus(); }
public void PostCustomerChange(ref int custtableId) { int pendingUpdates = My.MySettings.Default.ActiveStations - 1; string initiatingUser = Environment.UserName; Posting job = new Posting(custtableId, pendingUpdates, initiatingUser); job.Save(); }
public void PopulatePosting(string contents, string tags, Posting posting, ContentType contentType) { if (posting.IsNew) { posting.ContentType = contentType; posting.CreatedOn = DateTime.Now; // posting.User = Session.UserProfile; } if (posting.Contents == null) posting.Contents = (Contents)WSApplication.Application.ActivityRoot.GetDocumentFactory("Contents").CreateDocument(); posting.Contents.ContentsText = contents; if (contents != null) { string shortText = StripSummaryText(contents); posting.ShortText = shortText.Substring(0, Math.Min(shortTextLength, shortText.Length)); } else posting.ShortText = null; if (posting.Heading != null) { string salt = posting.LocalID.Substring(posting.LocalID.Length - 6); string shortName = posting.Heading.Replace(' ', '_'); posting.ShortName = shortName.Substring(0, Math.Min(shortNameLength - salt.Length, shortName.Length)) + salt; } posting.LastModifiedOn = DateTime.Now; TagHelper.Instance.LoadTags(posting, tags); }
public Posting[] getPostingsByTokenId(uint tokenId) { long indexOffset = (long)(tokenId * (sizeof(long) + sizeof(uint))); moveToOffset(postingsIndexReader, indexOffset); KeyValuePair<long, uint> indexIndic = readIndex(postingsIndexReader); Posting[] result = new Posting[indexIndic.Value]; if (indexIndic.Value == 0) return result; moveToOffset(postingsReader, indexIndic.Key); for (uint i = 0; i < indexIndic.Value; i++) { result[i] = readPosting(postingsReader); } return result; }
/// <summary> /// Zapisuje wystąpienie w pliku danych /// </summary> /// <param name="writer">Strumień binarny do zapisu danych</param> /// <param name="posting">Wystąpienie do zapisania</param> private void writePosting(BinaryWriter writer, Posting posting) { posting.writeInto(writer); }
public void InsertOrUpdate() { dataStore.Settings.AutoGenerate = true; dataStore.CreateStorage(typeof(Posting)); Posting posting = new Posting(); posting.Topic = "Insert"; posting.Details = "InsertOrUpdate"; dataStore.InsertOrUpdate(posting); int id = posting.ID; posting = (Posting)dataStore.FindByPrimaryKey(typeof(Posting), posting.ID); Assert.AreEqual("Insert", posting.Topic,"Check Topic"); posting.Topic = "Update"; dataStore.InsertOrUpdate(posting); posting = (Posting)dataStore.FindByPrimaryKey(typeof(Posting), posting.ID); Assert.AreEqual("Update", posting.Topic,"Check Topic"); Assert.AreEqual(id, posting.ID,"Check ID"); dataStore.DeleteStorage(typeof(Posting)); }