Ejemplo n.º 1
0
        private void ModIcon_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }

            this.RealViewModel.Image = RealViewModel.GetImage();
        }
Ejemplo n.º 2
0
        public ActionResult RealEdit(RealViewModel f, HttpPostedFileBase image)
        {
            var r = _db.tblLand.Find(f.Id);

            if (r == null)
            {
                return(HttpNotFound());
            }

            if (!ModelState.IsValid)
            {
                return(View(f));
            }

            r.Address    = f.Address;
            r.Area       = f.Area;
            r.Code       = f.BlockCode;
            r.Content    = f.Content;
            r.CustomerId = Auth.User.UserId;
            r.ProjectId  = f.ProjectId;
            r.Price      = f.Price;
            r.ProvinceId = f.ProvinceId;
            r.DistrictId = f.DistrictId;
            r.Title      = f.Title;
            r.Email      = f.ClientEmail;
            r.Phone      = f.ClientCellPhone;
            r.Road       = f.Facede;

            r.CategoryId  = f.CategoryId;
            r.TypeId      = f.TypeId;
            r.RuleId      = f.RuleId;
            r.UnitId      = f.UnitId;
            r.DirectionId = f.DirectionId;

            if (image.AllowFile())
            {
                if (r.Image != null)
                {
                    FileExtensions.DeleteFile(r.Image.Split('/').Last(), "~/Uploads/Reals/");
                }
                var newName = image.GetNewFileName();
                image.SaveFileToFolder("/Uploads/Reals/", newName);
                r.Image = "/Uploads/Reals/" + newName;
            }

            _db.Entry(r).State = EntityState.Modified;
            _db.SaveChanges();
            TempData["Update"] = "Cập nhật thành công";
            return(RedirectToAction("RealEdit", new { Id = r.Id }));
        }
Ejemplo n.º 3
0
        public ActionResult RealAdd()
        {
            var model = new RealViewModel
            {
                Projects   = new SelectList(_db.tblProject, "Id", "Title"),
                Provinces  = new SelectList(_db.tblProvince, "Id", "Name"),
                Districts  = new SelectList(_db.tblDistrict, "Id", "Name"),
                Types      = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.LoaiGd), "Id", "Title"),
                Categories = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.LoaiBds), "Id", "Title"),
                Units      = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.GiaCa), "Id", "Title"),
                Rules      = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.PhapLy), "Id", "Title"),
                Directions = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.HuongNha), "Id", "Title"),
            };

            return(View(model));
        }
Ejemplo n.º 4
0
        private void Save_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }

            if (!IsUnique())
            {
                return;
            }

            RealViewModel.Save();
            var window = Window.GetWindow((DependencyObject)sender);

            window.Close();
        }
Ejemplo n.º 5
0
        public ActionResult RealEdit(int id)
        {
            var r = _db.tblLand.Find(id);

            if (r == null)
            {
                return(HttpNotFound());
            }

            var model = new RealViewModel
            {
                Id         = r.Id,
                ProjectId  = r.ProjectId ?? default(int),
                Title      = r.Title,
                Area       = r.Area,
                Content    = r.Content,
                Address    = r.Address,
                ProvinceId = r.ProvinceId ?? default(int),
                Image      = r.Image,
                DistrictId = r.DirectionId ?? default(int),
                Price      = r.Price ?? default(decimal),
                BlockCode  = r.Code,
                Facede     = r.Road,

                CategoryId  = r.CategoryId ?? default(int),
                RuleId      = r.RuleId ?? default(int),
                UnitId      = r.UnitId ?? default(int),
                TypeId      = r.TypeId ?? default(int),
                DirectionId = r.DirectionId ?? default(int),

                Projects   = new SelectList(_db.tblProject, "Id", "Title", r.ProjectId),
                Provinces  = new SelectList(_db.tblProvince, "Id", "Name", r.ProvinceId),
                Districts  = new SelectList(_db.tblDistrict.Where(t => t.ProvinceId == r.ProvinceId), "Id", "Name", r.DistrictId),
                Categories = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.LoaiBds), "Id", "Title", r.CategoryId),
                Types      = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.LoaiGd), "Id", "Title", r.TypeId),
                Units      = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.GiaCa), "Id", "Title", r.UnitId),
                Rules      = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.PhapLy), "Id", "Title", r.RuleId),
                Directions = new SelectList(_db.tblDictionary.Where(m => m.CategoryId == (int)EnumCategory.HuongNha), "Id", "Title")
            };

            return(View(model));
        }
Ejemplo n.º 6
0
        public ActionResult RealAdd(RealViewModel f, HttpPostedFileBase image)
        {
            if (!ModelState.IsValid)
            {
                return(View(f));
            }

            var land = new tblLand
            {
                Address     = f.Address,
                Area        = f.Area,
                Code        = f.BlockCode,
                Content     = f.Content,
                CreateDate  = DateTime.Now,
                CustomerId  = Auth.User.UserId,
                DirectionId = f.DirectionId,
                ProjectId   = f.ProjectId,
                TypeId      = f.TypeId,
                Price       = f.Price,
                ProvinceId  = f.ProvinceId,
                DistrictId  = f.DistrictId,
                UnitId      = f.UnitId,
                Title       = f.Title,
                Email       = f.ClientEmail,
                Phone       = f.ClientCellPhone,
                Road        = f.Facede,
                RuleId      = f.RuleId,
            };

            if (image.AllowFile())
            {
                var newName = image.GetNewFileName();
                image.SaveFileToFolder("/Uploads/Reals/", newName);
                land.Image = "/Uploads/Reals/" + newName;
            }

            _db.tblLand.Add(land);
            _db.SaveChanges();

            return(RedirectToAction("RealIndex"));
        }
Ejemplo n.º 7
0
 private void ModsFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) => RealViewModel.RefreshModList();
 private void OpenHeroesPhysicsMapping(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     IoC.Kernel.Rebind(typeof(MappingEditorParameters <,>)).ToConstant(new MappingEditorParameters <HeroesCharacter, AllCharacters>(Config.HeroesMapping, enums => Config.HeroesMapping = enums));
     RealViewModel.ForceSwitchToPage(ApplicationPage.HeroesMappingEditor);
 }