Ejemplo n.º 1
0
        /// <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
            }
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
 }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        public IHttpActionResult GetLocationCategory(int id)
        {
            LocationCategory locationCategory = db.LocationCategories.Find(id);

            if (locationCategory == null)
            {
                return(NotFound());
            }

            return(Ok(locationCategory));
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 12
0
        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)));
        }
Ejemplo n.º 14
0
        /// <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;
                        }
                    }
                }
            }));
        }
Ejemplo n.º 15
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)]);
        }
Ejemplo n.º 16
0
 public bool InsertLocationCategory(LocationCategory locationCategory)
 {
     try
     {
         _contextUow.LocationCategoryRepository.Insert(locationCategory);
         _contextUow.Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 17
0
 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));
 }
Ejemplo n.º 18
0
        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));
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        /// <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);
        }
Ejemplo n.º 22
0
 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));
 }
Ejemplo n.º 23
0
        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 }));
        }
Ejemplo n.º 24
0
        /// <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);
        }
Ejemplo n.º 25
0
        /// <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);
            }
        }
Ejemplo n.º 26
0
 public ItemPoolAttribute(ItemCategory itemCategory, LocationCategory locationCategory)
 {
     ItemCategory     = itemCategory;
     LocationCategory = locationCategory;
 }
Ejemplo n.º 27
0
        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));
 }
Ejemplo n.º 29
0
        /// <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();
                }
            }));
        }
Ejemplo n.º 30
0
        /// <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);
        }
Ejemplo n.º 31
0
        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;
            }
        }