/// <summary> /// Вызывает сценарий удаления витрины /// </summary> /// <returns></returns> IResult ShowcaseRemoveAction() { _output.Clear(); _output.WriteLine("Удалить витрину", ConsoleColor.Cyan); if (ShowcaseRepository.ActivesCount() == 0) { return(new Result("Нет витрин для удаления")); } PrintShowcasesAction(false); _output.Write("\r\nВведите Id витрины для удаления: ", ConsoleColor.Yellow); if (!int.TryParse(_output.ReadLine(), out int id) || id > 0) { return(new Result("Идентификатор должен быть ценым положительным числом")); } Showcase showcase = ShowcaseRepository.GetById(id); if (showcase == null) { return(new Result("Витрина не найдена")); } if (ShowcaseRepository.GetShowcaseProductsIds(showcase).Count != 0) { return(new Result("Невозможно удалить витрину, на которой размещены товары")); } ShowcaseRepository.Remove(showcase.Id); return(new Result(true)); }
public ActionResult Create(FormCollection form, CreateEditViewModel model) { if (ModelState.IsValid) { try { var showcase = new Showcase(); showcase.Title = model.Title; showcase.Description = model.Description; showcase.Url = model.Url; showcase.ExtLinkType = model.ExtLinkType; showcase.ArticleId = model.ArticleId; showcase.FromDate = model.NoFromDate ? null : model.FromDate; showcase.ToDate = model.NoToDate ? null : model.ToDate; showcase.IsActive = model.IsActive; showcase.ImagePath = model.ImagePath; showcase.PriceImagePath = model.PriceImagePath; showcaseProvider.AddOrUpdateShowcase(showcase); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError(String.Empty, ex.Message); Logger.ErrorException(ex.Message, ex); } } return(RedirectToAction("Create")); }
/// <summary> /// Вызывает сценарий обновления витрины /// </summary> /// <returns></returns> IResult ShowcaseCreateAction() { var result = new Result(); _output.Clear(); _output.WriteLine("Добавить витрину", ConsoleColor.Yellow); Showcase showcase = new Showcase(); _output.Write("Наименование: "); showcase.Name = _output.ReadLine(); _output.Write("Максимально допустимый объем витрины: "); if (int.TryParse(_output.ReadLine(), out int maxCapacity)) { showcase.MaxCapacity = maxCapacity; } var validateResult = showcase.Validate(); if (!validateResult.Success) { return(validateResult); } ShowcaseRepository.Add(showcase); result.Success = true; return(result); }
public SiteResponse <object> Edit(Showcase show) { var response = new SiteResponse <object>(); response.Status = show == null; if (response.Status) { response.Message = "Düzenlemek istenen kategori tanımsız!"; return(response); } var oldshow = db.Showcases.Find(show.Id); response.Status = oldshow == null; if (response.Status) { response.Message = "Düzenlemek istenen kategori bulunamadı!"; return(response); } oldshow.Id = show.Id; oldshow.CompanyName = show.CompanyName; oldshow.ModifiedDate = DateTime.Now; oldshow.Companies_Id = show.Companies_Id; db.Entry(oldshow).State = EntityState.Modified; db.SaveChanges(); response.Status = true; return(response); }
private async void uploadpic() { try { if (!CrossMedia.Current.IsPickPhotoSupported) { await App.Current.MainPage.DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK"); return; } var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions { PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium, }); if (file == null) { return; } else { Showcase.Add(new ShowcaseListModel { ShowcaseImages = file.Path, }); } } catch (Exception ex) { } }
public override int GetHashCode() { unchecked { return((Showcase != null ? Showcase.GetHashCode() : 0) * 397 ^ (MissionIcon != null ? MissionIcon.GetHashCode() : 0)); } }
}//add showcase to shopping cart private void btnConfirm_Click(object sender, EventArgs e) { Boolean canConfirm = true; if (lstSelected.Items.Count == 0) { canConfirm = false; } if (canConfirm == true) { Showcase[] Arrayshowcase = new Showcase[lstSelected.Items.Count]; for (int i = 0; i < lstSelected.Items.Count; i++) { MySqlCommand cmd = new MySqlCommand("select * from showcase where showcaseid = '" + lstSelected.Items[i].ToString() + "'", FormContainer.conn); MySqlDataReader myData = cmd.ExecuteReader(); while (myData.Read()) { Arrayshowcase[i] = new Showcase(myData.GetString(0), myData.GetInt32(1));//Index:0 is ID, Index:1 is rent } myData.Close(); } FormContract frmContract = new FormContract(Arrayshowcase); frmContract.ShowDialog(); lstSelected.Items.Clear(); initializeAvailibility(); } }//click on confirm button to prepare contract
public static AppShowcaseView Create(Activity activity, Showcase showcase) { var showcaseView = Create(activity); showcaseView.CurrentShowcase = showcase; return(showcaseView); }
private void ShowcaseView_MouseDown(object sender, MouseButtonEventArgs e) { var showcaseView = sender as SkiaSharp.Views.WPF.SKElement; var position = DpiScaler.ScaleDown(e.GetPosition(showcaseView)); var map = Showcase.Maps[int.Parse(showcaseView.Tag.ToString())]; var hoveredLoc = GetHoveredLocation(map, position, true); if (hoveredLoc is null) { return; } var safeHoveredLoc = hoveredLoc.Value; var hoveredTile = map.GetTile(safeHoveredLoc); var figure = hoveredTile?.Parent; if (figure is null) { return; } Showcase.Pick(figure); showcaseView.InvalidateVisual(); Captured = new(figure); DraggingView.Visibility = Visibility.Visible; DraggingView.InvalidateVisual(); ShowcaseClickOffset = Point.Subtract(position, new Point()); DraggingView_MouseMove(sender, e); }
private ISample ResolveSample() { ISample sample; if (input.Arguments.Any()) { var inputName = input.Arguments.First(); sample = Assembly .GetExecutingAssembly() .ResolveSample(inputName); if (sample == null) { Console.WriteLine($"sample with name = '{inputName}' not found"); Console.WriteLine("sample generation was cancelled"); Console.WriteLine(); Console.WriteLine("See 'sample' command for a list of available samples"); } } else { sample = new Showcase(); } return(sample); }
public SiteResponse <object> Add(Showcase show) { //showcase ekleme var response = new SiteResponse <object>(); response.Status = show == null; if (response.Status) { response.Message = "Showcase tanımsız"; return(response); } var newShowcase = new Showcases(); newShowcase.AddedDate = DateTime.Now; newShowcase.Id = show.Id; newShowcase.CompanyName = show.CompanyName; newShowcase.Companies_Id = show.Companies_Id; db.Entry(newShowcase).State = EntityState.Added; db.SaveChanges(); response.Status = newShowcase.Id != 0; if (response.Status) { response.Message = "Showcase eklendi"; return(response); } else { response.Message = "Showcase id tanımsız"; return(response); } }
public ShowcaseViewModel(INetworkActivityService networkActivity, ShowcaseRepository showcaseRepository) { Title = "Showcase"; GoToRepositoryCommand = ReactiveCommand.Create(); GoToRepositoryCommand.OfType <Octokit.Repository>().Subscribe(x => { var vm = CreateViewModel <RepositoryViewModel>(); vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner.Login, x.Name); ShowViewModel(vm); }); var repositories = new ReactiveList <Octokit.Repository>(); Repositories = repositories; LoadCommand = ReactiveCommand.CreateAsyncTask(async t => { var showcaseRepos = await showcaseRepository.GetShowcaseRepositories(ShowcaseSlug); Title = showcaseRepos.Name; Showcase = new Showcase { Slug = showcaseRepos.Slug, Description = showcaseRepos.Description, Name = showcaseRepos.Name }; repositories.Reset(showcaseRepos.Repositories); }); LoadCommand.TriggerNetworkActivity(networkActivity); }
private void GetData() { Showcase.Add(new ShowcaseListModel { ShowcaseImages = "add_photo.png", FrameColor = Color.LightGray }); }
/// <summary> /// Вызывает сценарий обновления витрины /// </summary> /// <returns></returns> IResult ShowcaseUpdateAction() { PrintShowcasesAction(false); _output.Write("\r\nВведите Id витрины: ", ConsoleColor.Yellow); if (!int.TryParse(_output.ReadLine(), out int id)) { return(new Result("Идентификатор должен быть целым положительным числом")); } Showcase showcase = ShowcaseRepository.GetById(id); if (showcase == null || showcase.RemovedAt.HasValue) { return(new Result("Витрина с идентификатором " + id + " не найдена")); } _output.Write("Наименование (" + showcase.Name + "):"); string name = _output.ReadLine(); if (!string.IsNullOrWhiteSpace(name)) { showcase.Name = name; } _output.Write("Максимально допустимый объем витрины (" + showcase.MaxCapacity + "):"); //Если объем задан корректно, то применяем, в противном случае оставляем как было if (!int.TryParse(_output.ReadLine(), out int capacityInt)) { return(new Result("Объем должен быть целым положительным числом")); } //Чекаем изменение объема в меньшую сторону List <ProductShowcase> productShowcases = ShowcaseRepository.GetShowcaseProducts(showcase); int showcaseFullness = ProductRepository.ProductsCapacity(productShowcases); if (showcaseFullness > capacityInt) { return(new Result("Невозможно установить заданный объем, объем размещенного товара превышеает значение")); } showcase.MaxCapacity = capacityInt; var validateResult = showcase.Validate(); if (!validateResult.Success) { return(validateResult); } ShowcaseRepository.Update(showcase); return(new Result(true)); }
private void TryLoadFromSave() { if (Properties.Settings.Default.IsSaved) { Engine.Engine.Score = Properties.Settings.Default.SavedScore; Title = "Счёт: " + Engine.Engine.Score + " / " + Properties.Settings.Default.BestScore; if (Properties.Settings.Default.SavedShowcase0 != -1) { var figure = new Figure((FigureShape)Properties.Settings.Default.SavedShowcase0); Showcase.Pick(Showcase.Maps[0].Figure); figure.TryPutOnMap(Showcase.Maps[0], new Location(0, 0)); } else { Showcase.Maps[0].Figure = null; } if (Properties.Settings.Default.SavedShowcase1 != -1) { var figure = new Figure((FigureShape)Properties.Settings.Default.SavedShowcase1); Showcase.Pick(Showcase.Maps[1].Figure); figure.TryPutOnMap(Showcase.Maps[1], new Location(0, 0)); } else { Showcase.Maps[1].Figure = null; } if (Properties.Settings.Default.SavedShowcase2 != -1) { var figure = new Figure((FigureShape)Properties.Settings.Default.SavedShowcase2); Showcase.Pick(Showcase.Maps[2].Figure); figure.TryPutOnMap(Showcase.Maps[2], new Location(0, 0)); } else { Showcase.Maps[2].Figure = null; } var savedMap = Properties.Settings.Default.SavedMap; for (int x = 0; x < GameMap.Size; ++x) { for (int y = 0; y < GameMap.Size; ++y) { string tileStr = savedMap[x * 10 + y].ToString(); if (tileStr != "-") { FigureShape shape = (FigureShape)IntStringBaseConverter.BaseToLong(tileStr); Tile tile = new Tile(new Location(x, y), new Figure(shape)); GameMap.SetTile(x, y, tile); } } } } }
public void AddOrUpdateShowcase(Showcase showcase) { if (showcase.Id == 0) { context.Add(showcase); } SetAuditFields(showcase); context.SaveChanges(); }
private void DraggingView_MouseUp(object sender, MouseButtonEventArgs e) { if (Captured is null || Lost) { return; } var draggableLoc = GetHoveredLocation(GameMap, DpiScaler.ScaleDown(Captured.Point), false); if (draggableLoc is not null) { var safeDraggableLoc = draggableLoc.Value; if (Captured.Figure.TryPutOnMap(GameMap, safeDraggableLoc)) { Showcase.Update(); Engine.Engine.Score += Captured.Figure.GetTiles().Count(); if (Engine.Engine.Score > Properties.Settings.Default.BestScore) { Properties.Settings.Default.BestScore = Engine.Engine.Score; Properties.Settings.Default.Save(); } Title = "Счёт: " + Engine.Engine.Score + " / " + Properties.Settings.Default.BestScore; if (DidLose()) { Lost = true; Captured = null; MouseLocation = new(); MapView.InvalidateVisual(); DraggingView.InvalidateVisual(); Showcase1View.InvalidateVisual(); Showcase2View.InvalidateVisual(); Showcase3View.InvalidateVisual(); return; } } else { Showcase.Return(Captured.Figure); } } else { Showcase.Return(Captured.Figure); } Captured = null; MouseLocation = new(); DraggingView.Visibility = Visibility.Hidden; MapView.InvalidateVisual(); DraggingView.InvalidateVisual(); Showcase1View.InvalidateVisual(); Showcase2View.InvalidateVisual(); Showcase3View.InvalidateVisual(); }
/// <summary> /// Вызывает сценарий отображения всех товаров на витрине /// </summary> /// <returns></returns> void PrintShowcaseProductsAction(bool waitPressKey = true) { if (ShowcaseRepository.ActivesCount() == 0 || ProductRepository.Count() == 0) { _output.Clear(); _output.WriteLine("Нет товаров и витрин для отображения"); _output.ReadKey(); return; } PrintShowcasesAction(false); _output.Write("\r\nВведите Id витрины: ", ConsoleColor.Yellow); if (int.TryParse(_output.ReadLine(), out int id)) { Showcase showcase = ShowcaseRepository.GetById(id); if (showcase == null || showcase.RemovedAt.HasValue) { _output.WriteLine("Нет витрин с указанным идентификатором"); return; } _output.Write("\r\nТовары на витрине "); _output.WriteLine(showcase.Name + ":", ConsoleColor.Cyan); List <int> ids = ShowcaseRepository.GetShowcaseProductsIds(showcase); if (ids.Count == 0) { _output.WriteLine("Нет товаров для отображения"); return; } foreach (int pId in ids) { var product = ProductRepository.GetById(pId); if (product != null) { _output.WriteLine(product.ToString()); } } } else { _output.WriteLine("Нет витрин с указанным идентификатором"); } if (waitPressKey) { _output.ReadKey(); } }
public JsonResult DeleteShowcase(int id) { Showcase firstbrand = showcaseRepo.SelectById(id); if (firstbrand == null) { return(Json(new { success = false, responseText = "Vitrin silinemedi!" }, JsonRequestBehavior.AllowGet)); } showcaseRepo.Delete(firstbrand); return(Json(new { success = true, responseText = "Vitrin Silme işlemi gerçekleşmiştir." }, JsonRequestBehavior.AllowGet)); }
private void AddDocuments() { using (var session = _store.OpenSession()) { var school1 = new School() { SchoolDistrictName = "School District for School 1" }; session.Store(school1); var school2 = new School() { SchoolDistrictName = "School District for School 2" }; session.Store(school2); var comm1 = new Community() { Name = "Community 1", SchoolIds = new[] { school1.Id, school2.Id } }; session.Store(comm1); var fp1 = new FloorPlan() { Community = comm1, Name = "Floor Plan 1" }; session.Store(fp1); var fp2 = new FloorPlan() { Community = comm1, Name = "Floor Plan 2" }; session.Store(fp2); var sc1 = new Showcase() { Community = comm1, Name = "Showcase 1" }; session.Store(sc1); var sc2 = new Showcase() { Community = comm1, Name = "Showcase 2" }; session.Store(sc2); session.SaveChanges(); } }
public ActionResult Create(ShowcaseModel showcasemodel) { Showcase showcase = new Showcase() { ShowcaseName = showcasemodel.ShowcaseName, ShowcaseSortNumber = showcasemodel.ShowcaseSortNumber }; showcaseRepo.Insert(showcase); return(RedirectToAction("Index")); }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public void Update(Showcase entity) { for (int i = 0; i < _items.Count; i++) { if (_items[i].Id.Equals(entity.Id)) { _items[i] = entity; break; } } }
public async Task <HttpResponse> GetShowcases(string slug) { var builder = new QueryBuilder <ContentfulShowcase>().ContentTypeIs("showcase").FieldEquals("fields.slug", slug).Include(3); var entries = await _client.GetEntries(builder); var entry = entries.FirstOrDefault(); if (entry == null) { return(HttpResponse.Failure(HttpStatusCode.NotFound, "No Showcase found")); } Showcase showcase = new Showcase(); try { showcase = _contentfulFactory.ToModel(entry); } catch (Exception ex) { _logger.LogError(ex, $"Unable to serialize Showcase {slug}: {ex.Message}"); } if (showcase.EventCategory != string.Empty) { var events = await _eventRepository.GetEventsByCategory(showcase.EventCategory, true); if (!events.Any()) { events = await _eventRepository.GetEventsByTag(showcase.EventCategory, true); if (events.Any()) { showcase.EventsCategoryOrTag = "T"; } } showcase.Events = events.Take(3); } var news = await PopulateNews(showcase.NewsCategoryTag); if (news != null) { showcase.NewsArticle = news.News; showcase.NewsCategoryOrTag = news.Type; } return(showcase.GetType() == typeof(NullHomepage) ? HttpResponse.Failure(HttpStatusCode.NotFound, "No Showcase found") : HttpResponse.Successful(showcase)); }
public ActionResult Edit(ShowcaseModel showcasemodel, int id) { Showcase showcase = new Showcase() { ShowcaseId = id, ShowcaseName = showcasemodel.ShowcaseName, ShowcaseSortNumber = showcasemodel.ShowcaseSortNumber }; showcaseRepo.Update(showcase); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { Showcase showcase = showcaseRepo.SelectById(id); ShowcaseModel showcasemodel = new ShowcaseModel() { ShowcaseId = showcase.ShowcaseId, ShowcaseName = showcase.ShowcaseName, ShowcaseSortNumber = showcase.ShowcaseSortNumber }; return(View(showcasemodel)); }
public List <int> GetShowcaseProductsIds(Showcase showcase) { var ids = new List <int>(); foreach (var psc in _products) { if (showcase.Id == psc.ShowcaseId) { ids.Add(psc.ProductId); } } return(ids); }
public List <ProductShowcase> GetShowcaseProducts(Showcase showcase) { var result = new List <ProductShowcase>(); foreach (var psc in _products) { if (showcase.Id == psc.ShowcaseId) { result.Add(psc); } } return(result); }
private void DisplayShowcase() { var showcase = new Showcase(ShowcaseId); // highlight an action bar using a resource ID var actionBarStep = showcase.AddStep(Activity, Resource.Id.addMenuItem, "This button was added by the Activity.", "GOT IT"); var fragmentActionBarStep = showcase.AddStep(Activity, Resource.Id.closeMenuItem, "This is button was added by the fragment.", "GOT IT"); // a normal steps for a view reference var dialogStep = showcase.AddStep(customizedButton, "This button will display a showcase that has customizations.", "GOT IT"); var resetStep = showcase.AddStep(resetButton, "This button will reset the showcases so that they will appear again.", "GOT IT"); var showcaseView = AppShowcaseView.Create(Activity, showcase); // show with a delay so the app UI can finish rendering showcaseView.Show(500); }
private void DisplayCustomizedShowcase() { // no ID means that we won't know if we have already launched this showcase var showcase = new Showcase(); // highlight an action bar using a resource ID var actionBarStep = showcase.AddStep(Activity, Resource.Id.addMenuItem, "Tapping anywhere will dismiss this step.", null); actionBarStep.DismissOnTouch = true; // a customized mask var dialogStep = showcase.AddStep(customizedButton, "This step uses different colors for the text.", "GOT IT"); dialogStep.ContentTextColor = Resources.GetColor(Resource.Color.green); dialogStep.DismissTextColor = Resources.GetColor(Resource.Color.orange); // a normal step for a view reference var resetStep = showcase.AddStep(resetButton, "This step has a different mask color.", "GOT IT"); resetStep.MaskColor = Resources.GetColor(Resource.Color.purple); var showcaseView = AppShowcaseView.Create(Activity, showcase); // use a bouncy animation showcaseView.Animation = new AnticipateOvershootRenderer(); // show events showcaseView.ShowcaseStarted += delegate { Toast.MakeText(Activity, "Showcase started", ToastLength.Short).Show(); }; showcaseView.StepDisplayed += (sender, e) => { Toast.MakeText(Activity, "Showing step: " + e.StepIndex, ToastLength.Short).Show(); }; showcaseView.StepDismissed += (sender, e) => { Toast.MakeText(Activity, "Hiding step: " + e.StepIndex, ToastLength.Short).Show(); }; showcaseView.ShowcaseCompleted += delegate { Toast.MakeText(Activity, "Showcase completed", ToastLength.Short).Show(); }; // no need for the delay as everything is done showcaseView.Show(); }