/// <summary> /// Abre la ventana detalle en modo "detalle" o "edición" dependiendo de sus permisos /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 17/05/2016 /// </history> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { LocationCategory locationCategory = (LocationCategory)dgrLocationCategories.SelectedItem; frmLocationCategoryDetail frmLocationCategoryDetail = new frmLocationCategoryDetail(); frmLocationCategoryDetail.Owner = this; frmLocationCategoryDetail.enumMode = EnumMode.Edit; frmLocationCategoryDetail.oldLocationCategory = locationCategory; if (frmLocationCategoryDetail.ShowDialog() == true) { List <LocationCategory> lstLocationCategory = (List <LocationCategory>)dgrLocationCategories.ItemsSource; int nIndex = 0; if (ValidateFilter(frmLocationCategoryDetail.locationCategory)) //Verificamos que cumpla con los filtros { ObjectHelper.CopyProperties(locationCategory, frmLocationCategoryDetail.locationCategory); //Actualizamos los datos lstLocationCategory.Sort((x, y) => string.Compare(x.lcN, y.lcN)); //ordenamos la lista nIndex = lstLocationCategory.IndexOf(locationCategory); //Obtenemos la posición del registro } else { lstLocationCategory.Remove(locationCategory); //Quitamos el registro } dgrLocationCategories.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrLocationCategories, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstLocationCategory.Count + " Location categories."; //Actualizamos el contador } }
/// <summary> /// Valida que un registro cumpla con los filtros del grid /// </summary> /// <param name="locationCategory">Objeto a validar</param> /// <returns>True. Si cumple | False. No cumple</returns> /// <history> /// [emoguel] created 17/05/2016 /// </history> private bool ValidateFilter(LocationCategory locationCategory) { if (_nStatus != -1)//Filtro po estatus { if (locationCategory.lcA != Convert.ToBoolean(_nStatus)) { return(false); } } if (!string.IsNullOrWhiteSpace(_locationCatFilter.lcID))//Filtro por ID { if (_locationCatFilter.lcID != locationCategory.lcID) { return(false); } } if (!string.IsNullOrWhiteSpace(_locationCatFilter.lcN))//Filtro por descripción { if (!locationCategory.lcN.Contains(_locationCatFilter.lcN, StringComparison.OrdinalIgnoreCase)) { return(false); } } return(true); }
public IHttpActionResult PutLocationCategory(int id, LocationCategory locationCategory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != locationCategory.id) { return(BadRequest()); } db.Entry(locationCategory).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LocationCategoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public override void Populate() { IsSelectAll = false; SelectedCategory = null; Table.Clear(); foreach (var cat in LocationCategoryDirectory.Instance.AllItems) { var item = Table.AddItem(ItemPrefab); item.SetText(item.Text, cat.Title); item.SetText(item.Description, cat.Description); // Local reference var _cat = cat; item.OnSelected.AddListener(() => { SelectedCategory = _cat; Back(); }); } base.Populate(); }
public ActionResult DeleteConfirmed(int id) { LocationCategory locationCategory = db.LocationCategorys.Find(id); db.LocationCategorys.Remove(locationCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Inequivalence() { var left = new LocationCategory() { Name = "Categoria1" }; var right = new LocationCategory() { Name = "Categoria2" }; Assert.IsFalse(left.BusinessEquals(right)); Assert.IsFalse(right.BusinessEquals(left)); Assert.IsFalse(left.Equals(right)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description")] LocationCategory locationCategory) { if (ModelState.IsValid) { db.Entry(locationCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locationCategory)); }
internal static LocationCategory GetFindRefLocations(VsProjectAnalyzer analyzer, IServiceProvider serviceProvider, string expr, IReadOnlyList<AnalysisVariable> analysis) { Dictionary<AnalysisLocation, SimpleLocationInfo> references, definitions, values; GetDefsRefsAndValues(analyzer, serviceProvider, expr, analysis, out definitions, out references, out values); var locations = new LocationCategory("Find All References", new SymbolList("Definitions", StandardGlyphGroup.GlyphLibrary, definitions.Values), new SymbolList("Values", StandardGlyphGroup.GlyphForwardType, values.Values), new SymbolList("References", StandardGlyphGroup.GlyphReference, references.Values) ); return locations; }
public IHttpActionResult GetLocationCategory(int id) { LocationCategory locationCategory = db.LocationCategories.Find(id); if (locationCategory == null) { return(NotFound()); } return(Ok(locationCategory)); }
internal static LocationCategory GetFindRefLocations(IServiceProvider serviceProvider, ExpressionAnalysis analysis) { Dictionary<LocationInfo, SimpleLocationInfo> references, definitions, values; GetDefsRefsAndValues(serviceProvider, analysis, out definitions, out references, out values); var locations = new LocationCategory("Find All References", new SymbolList("Definitions", StandardGlyphGroup.GlyphLibrary, definitions.Values), new SymbolList("Values", StandardGlyphGroup.GlyphForwardType, values.Values), new SymbolList("References", StandardGlyphGroup.GlyphReference, references.Values) ); return locations; }
public ActionResult Create([Bind(Include = "Id,Name,Description")] LocationCategory locationCategory) { if (ModelState.IsValid) { db.LocationCategorys.Add(locationCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locationCategory)); }
public IHttpActionResult PostLocationCategory(LocationCategory locationCategory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LocationCategories.Add(locationCategory); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = locationCategory.id }, locationCategory)); }
public ActionResult BrowseJobs(string profession, int?LocationCategoryId, int?page) { ViewBag.Locations = this.db.Locations.OrderBy(e => e.LocationName); ViewBag.JobTypes = this.db.JobTypes.OrderBy(e => e.JobTypeName); ViewBag.LocationCategoryId = new SelectList(db.Locations, "LocationCategoryId", "LocationName"); // Pagination Search Values ViewBag.SearchFilter = profession; ViewBag.DatePosted = 0; ViewBag.JobTypeName = "All"; ViewBag.pay = 0; ViewBag.LocationName = "All Locations"; var advertisements = this.db.Advertisements .OrderByDescending(e => e.DateCreated) .Where(e => e.IsPublic && e.IsPositionFilled == false); // Default value for professio, set in the browse jobs view, is "Search by Profession" // If the value is no longer "Search by Profession" then the user has inputted a value if (!profession.Equals("Search by Profession")) { advertisements = advertisements.Where(s => s.JobTitle.Contains(profession) || s.CompanyName.Contains(profession)); } // if the user selected a location form the list of locations if (LocationCategoryId != null) { // Find the location using LocationId LocationCategory location = db.Locations.Find(LocationCategoryId); ViewBag.LocationName = location.LocationName; // Filter advertisements using user search criteria from Home/Index advertisements = advertisements .Where(e => e.LocationCategoryId == (LocationCategoryId)); } else // If location == null, give a default value of "All Locations" { ViewBag.LocationName = "All Locations"; } ViewBag.FilteredJobsCount = advertisements.Count(); int pageSize = 8; int pageNumber = (page ?? 1); return(View(advertisements.ToPagedList(pageNumber, pageSize))); }
/// <summary> /// Guarda|Actualiza un registro en el catalogo LocationsCategories /// Asigna|desasigna locations de loa¿cationscategories /// </summary> /// <param name="locationCategory">Objeto a guardar</param> /// <param name="lstAdd">Locations a asignar</param> /// <param name="lstDel">Locations a desasignar</param> /// <param name="blnUpdate">True. Actualiza | False. Agrega</param> /// <returns>-1. Existe un registro con el mismo ID | 0. No se guardó | >0. Se guardó correctamente</returns> /// <history> /// [emoguel] created 18/05/2016 /// [emoguel] modified 29/07/2016 se volvió async /// </history> public static async Task <int> SaveLocationCategories(LocationCategory locationCategory, List <Location> lstAdd, List <Location> lstDel, bool blnUpdate) { return(await Task.Run(() => { using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString())) { using (var transacction = dbContext.Database.BeginTransaction(System.Data.IsolationLevel.Serializable)) { try { if (blnUpdate) { dbContext.Entry(locationCategory).State = EntityState.Modified; } else { var locationVal = dbContext.LocationsCategories.Where(lc => lc.lcID == locationCategory.lcID).FirstOrDefault(); if (locationVal != null) { return -1; } else { dbContext.LocationsCategories.Add(locationCategory); } } #region Locations dbContext.Locations.AsEnumerable().Where(lo => lstAdd.Any(loo => loo.loID == lo.loID)).ToList().ForEach(lo => {//Agresignar locaciones lo.lolc = locationCategory.lcID; }); dbContext.Locations.AsEnumerable().Where(lo => lstDel.Any(loo => loo.loID == lo.loID)).ToList().ForEach(lo => {//Agresignar locaciones lo.lolc = null; }); #endregion int nRes = dbContext.SaveChanges(); transacction.Commit(); return nRes; } catch { transacction.Rollback(); return 0; } } } })); }
/// <summary> /// returns a random unoccupied sublocation /// </summary> public Location GetSubLocation(LocationCategory c) { List <Location> sublocations = new List <Location>(); foreach (var item in gameObject.GetComponentsInChildren <Location>()) { if (!item.isOccupied && item.category == c) { sublocations.Add(item); } } return(sublocations[UnityEngine.Random.Range(0, sublocations.Count)]); }
public bool InsertLocationCategory(LocationCategory locationCategory) { try { _contextUow.LocationCategoryRepository.Insert(locationCategory); _contextUow.Save(); return(true); } catch (Exception) { return(false); } }
public IActionResult EditCategory(EditCategoryViewModel model) { if (ModelState.IsValid) { LocationCategory category = categoryRepository.GetById(model.Id); category.Title = model.Title; categoryRepository.Update(category); categoryRepository.Save(); TempData["edited_category"] = $"Location Category { model.Title }, was successfully updated."; return(Json(new { success = true })); } return(PartialView(model)); }
public IHttpActionResult DeleteLocationCategory(int id) { LocationCategory locationCategory = db.LocationCategories.Find(id); if (locationCategory == null) { return(NotFound()); } db.LocationCategories.Remove(locationCategory); db.SaveChanges(); return(Ok(locationCategory)); }
// GET: LocationCategories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocationCategory locationCategory = db.LocationCategorys.Find(id); if (locationCategory == null) { return(HttpNotFound()); } return(View(locationCategory)); }
internal static LocationCategory GetFindRefLocations(ExpressionAnalysis analysis, GeneroLanguageVersion languageVersion) { Dictionary <LocationInfo, SimpleLocationInfo> references, definitions, values; GetDefsRefsAndValues(analysis, languageVersion, out definitions, out references, out values); var locations = new LocationCategory("Find All References", new SymbolList("Definitions", StandardGlyphGroup.GlyphLibrary, definitions.Values), new SymbolList("Values", StandardGlyphGroup.GlyphForwardType, values.Values), new SymbolList("References", StandardGlyphGroup.GlyphReference, references.Values) ); return(locations); }
/// <summary> /// Implements Find All References. Called when the user selects Find All References from /// the context menu or hits the hotkey associated with find all references. /// /// Always opens the Find Symbol Results box to display the results. /// </summary> private int FindAllReferences() { UpdateStatusForIncompleteAnalysis(); var analysis = _textView.GetExpressionAnalysis(_functionProvider, _databaseProvider, _programFileProvider); LocationCategory locations = null; if (analysis != null) { locations = GetFindRefLocations(analysis, _textView.GetLanguageVersion(_programFileProvider)); } ShowFindSymbolsDialog(analysis, locations); return(VSConstants.S_OK); }
public IActionResult AddNewCategory(AddNewCategoryViewModel model) { if (ModelState.IsValid) { LocationCategory category = new LocationCategory { Title = model.Title }; categoryRepository.Insert(category); categoryRepository.Save(); TempData["created_category"] = $"New Location Category { model.Title }, was created successfully."; return(Redirect("allcategories")); } return(View(model)); }
public IActionResult DeleteCategory(long Id) { if (Id.Equals(0)) { ViewBag.ErrorMessage = $"The location Resource with Id = { Id } could not be found"; return(View("NotFound")); } LocationCategory category = categoryRepository.GetById(Id); if (category == null) { ViewBag.ErrorMessage = $"The category Resource with Id = { Id } could not be found"; return(View("NotFound")); } string category_title = category.Title; categoryRepository.Delete(category.Id); categoryRepository.Save(); TempData["deleted_category"] = $"The Location Category{ category_title }, was successfully deleted."; return(Json(new { success = true })); }
/// <summary> /// Returns a random unoccupied location of category /// </summary> /// <returns></returns> public static Location GetRandUnoccupied(LocationCategory t) { List <Location> rLocations = new List <Location>(); // Get all locations of a particular type foreach (var item in locations.Values) { if (item.category == t && !item.isOccupied) { rLocations.Add(item); // Add if type matches } } // meaning no location is available if (rLocations.Count == 0) { return(null); } Location rLocation = rLocations[UnityEngine.Random.Range(0, rLocations.Count)]; return(rLocation); }
/// <summary> /// Llena el grid de location categories /// </summary> /// <param name="locationCategory">Objeto a seleccionar</param> /// <history> /// [emoguel] created 17/05/2016 /// </history> private async void LoadLocationCategories(LocationCategory locationCategory = null) { try { status.Visibility = Visibility.Visible; List <LocationCategory> lstLocationCategories = await BRLocationsCategories.GetLocationsCategories(_nStatus, _locationCatFilter); dgrLocationCategories.ItemsSource = lstLocationCategories; int nIndex = 0; if (lstLocationCategories.Count > 0 && locationCategory != null) { locationCategory = lstLocationCategories.Where(lc => lc.lcID == locationCategory.lcID).FirstOrDefault(); nIndex = lstLocationCategories.IndexOf(locationCategory); } GridHelper.SelectRow(dgrLocationCategories, nIndex); StatusBarReg.Content = lstLocationCategories.Count + " Location Categories."; status.Visibility = Visibility.Collapsed; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
public ItemPoolAttribute(ItemCategory itemCategory, LocationCategory locationCategory) { ItemCategory = itemCategory; LocationCategory = locationCategory; }
public IActionResult LocationCategoryInUse(string Title) { LocationCategory category = locationRepository.GetCategoryByTitle(Title); return(category == null?Json(true) : Json($"The category { Title } is already registered")); }
public void AddCategoryAction() { var category = new LocationCategory() { Name = "Category" }; SelectedLocation.Categories.Add(category); Messenger.Default.Send(new AddCategoryDialogMessage(category)); }
/// <summary> /// Obtiene registros de LocationCategories /// </summary> /// <param name="nStatus">-1. Todos los registros | 0. registros inactivos | 1. Registros activos</param> /// <param name="locationCategory">objeto con los filtros adicionales</param> /// <returns>Lista tipo Location category</returns> /// <history> /// [emoguel] created 01/04/2016 /// [emoguel] modified 28/06/2016 --- Se volvió async /// </history> public async static Task <List <LocationCategory> > GetLocationsCategories(int nStatus = -1, LocationCategory locationCategory = null) { return(await Task.Run(() => { using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString())) { var query = from lc in dbContext.LocationsCategories select lc; if (nStatus != -1)//Filtro por estatus { bool blnEstatus = Convert.ToBoolean(nStatus); query = query.Where(lc => lc.lcA == blnEstatus); } if (locationCategory != null) //Verificamos si se tiene un objeto { if (!string.IsNullOrWhiteSpace(locationCategory.lcID)) //Filtro por ID { query = query.Where(lc => lc.lcID == locationCategory.lcID); } if (!string.IsNullOrWhiteSpace(locationCategory.lcN))//Filtro por descripcion { query = query.Where(lc => lc.lcN.Contains(locationCategory.lcN)); } } return query.OrderBy(lc => lc.lcN).ToList(); } })); }
/// <summary> /// Actualiza los registros de la lista /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 17/05/2016 /// </history> private void btnRef_Click(object sender, RoutedEventArgs e) { LocationCategory locationCategory = (LocationCategory)dgrLocationCategories.SelectedItem; LoadLocationCategories(locationCategory); }
public ActionResult Create(LocationCategory locationCategory) { var entitySaved = _locationCategoryService.InsertLocationCategory(locationCategory); return(View()); }
/// <summary> /// Send confirmation that the job vacancy has benn applied to. /// </summary> /// <param name="applicantEmail"></param> /// <param name="systemEmail"></param> /// <param name="id">Advertisement Id</param> public void SendEmailToApplicant(string applicantEmail, string systemEmail, int id) { // If advertisement using parameter Id var advertisement = db.Advertisements.Find(id); try { string currentUserId = User.Identity.GetUserId(); Applicant applicant = db.Applicants.Find(currentUserId); // will be testing with: // Recruiter Email == "*****@*****.**" -- Send to // System Email == "*****@*****.**" -- Sent from // Applicant Email = "*****@*****.**" // Create a new instance of message which will have parameters: (from, to, subject, message) MailMessage message = new MailMessage(systemEmail, applicantEmail, ("AllJobs.com: " + advertisement.JobTitle + " Confirmation"), "<body><br />Hello " + applicant.Forename + ",<br /><br />You have Successfully Applied to the " + advertisement.JobTitle + " job advertisement at <a style=\"color: #ff7473; text-decoration: none; \" href=\"" + "http://*****:*****@gmail.com", "Bingospoon1994"); client.Send(message); } catch (Exception ex) { string errorMessage = ex.StackTrace; } }