private void EditRentalForm_Load(object sender, EventArgs e) { using (CustomerService customerService = new CustomerService()) { cmbCustomer.DataSource = customerService.List(); cmbCustomer.DisplayMember = "FullName"; cmbCustomer.ValueMember = "CustomerId"; } using (MovieService movieService = new MovieService()) { cmbMovieName.DataSource = movieService.List(); cmbMovieName.DisplayMember = "MovieName"; cmbMovieName.ValueMember = "MovieId"; } using (RentalService movieService = new RentalService()) { lstBoxRental.DataSource = movieService.List(); lstBoxRental.DisplayMember = "Display"; lstBoxRental.ValueMember = "RentalId"; } using (DefinitionService definitionService = new DefinitionService()) { cbRecordStatus.DataSource = definitionService.GetRecordStatus(); cbRecordStatus.DisplayMember = "RecordStatusName"; cbRecordStatus.ValueMember = "RecordStatusId"; } }
public ActionResult Pieces(int id, string pieceData, string next) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); // do savey-type stuff if (next == "done") { return(RedirectToAction("Edit", "Variants", new { id = version.VariantID })); } else if (next == "prev") { return(RedirectToAction("References", new { id })); } else if (next == "next") { return(RedirectToAction("Layout", new { id })); } return(RedirectToAction("Pieces", new { id })); }
public ActionResult Groups(int id, string groupData, string next) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); definitions.SaveDirectionGroups(version, groupData); if (next == "done") { return(RedirectToAction("Edit", "Variants", new { id = version.VariantID })); } else if (next == "prev") { return(RedirectToAction("Relative", new { id })); } else if (next == "next") { return(RedirectToAction("References", new { id })); } return(RedirectToAction("Groups", new { id })); }
public ActionResult Shape(int id, string shapeData, string linkData, string next) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); definitions.SaveBoardData(version, shapeData, linkData); if (next == "done") { return(RedirectToAction("Edit", "Variants", new { id = version.VariantID })); } else if (next == "next") { return(RedirectToAction("Global", new { id })); } return(RedirectToAction("Shape", new { id })); }
public JsonResult GetTowns(int id) { using (DefinitionService service = new DefinitionService()) { var result = service.GetTownsByCity(id); return(Json(result, JsonRequestBehavior.AllowGet)); } }
public HotelController() { _attributeService = new AttributeService(); _definitionService = new DefinitionService(); _hotelTypeService = new HotelTypeService(); _hotelService = new HotelService(); _roomTypeService = new RoomTypeService(); }
public ActionResult Save() { using (DefinitionService service = new DefinitionService()) { var result = service.GetCities(); return(View(result)); } }
private void NewBookForm_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cbGenres.DataSource = definitionService.GetGenres(); cbGenres.DisplayMember = "GenreName"; cbGenres.ValueMember = "GenreId"; } }
public async Task Dictionary(CommandContext ctx, [RemainingText] string query) { if (string.IsNullOrWhiteSpace(query)) { await BotServices.SendErrorEmbedAsync(ctx, ":warning: A word or phrase is required!"); } else { var data = await DefinitionService.GetDefinitionForTermAsync(query); if (data.Results.Count == 0) { await BotServices.SendErrorEmbedAsync(ctx, ":mag: No results found!"); } else { for (var index = 0; index < data.Results.Count; index++) { foreach (var value in data.Results[index].Senses) { if (value.Definition != null) { await ctx.TriggerTypingAsync(); var definition = value.Definition.ToString(); if (!(value.Definition is string)) { definition = ((JArray)JToken.Parse(value.Definition.ToString())).First.ToString(); } var output = new DiscordEmbedBuilder() .WithTitle($"Dictionary definition for **{query}**") .WithDescription(definition.Length < 500 ? definition : definition.Take(500) + "...") .WithFooter("Type go for the next definition") .WithColor(DiscordColor.Blurple); if (value.Examples != null) { output.AddField("Example", value.Examples.First().text); } await ctx.RespondAsync(embed : output.Build()); var interactivity = await ctx.Client.GetInteractivity() .WaitForMessageAsync(m => m.Channel.Id == ctx.Channel.Id && m.Content.ToLower() == "go", TimeSpan.FromSeconds(10)); if (interactivity != null) { continue; } index = data.Results.Count; break; } } } } } }
private ChromelyResponse GetDefinitions(ChromelyRequest request) { DefinitionService definitionService = DefinitionService.getInstance(); Dictionary <string, List <Definition> > definitions = definitionService.LoadDefinitions(); string definitionsJson = JsonConvert.SerializeObject(definitions); ChromelyResponse response = new ChromelyResponse(); response.Data = definitionsJson; return(response); }
private void NewMovieForm_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cbRecordStatus.DataSource = definitionService.GetRecordStatus(); cbRecordStatus.DisplayMember = "RecordStatusName"; cbRecordStatus.ValueMember = "RecordStatusId"; cmbGenre.DataSource = definitionService.GetGenres(); cmbGenre.DisplayMember = "GenreName"; cmbGenre.ValueMember = "GenreId"; } }
public ActionResult Edit(int id) { using (DefinitionService service = new DefinitionService()) { ViewBag.RecordStatuses = service.GetRecordStatuses(); } using (CategoryService service = new CategoryService()) { var result = service.Get(id); return(View(result)); } }
public ActionResult _SideBar() { SidebarModel model = new SidebarModel(); using (DefinitionService service = new DefinitionService()) { model.CategoryList = service.GetCategories(); } using (BlogService service = new BlogService()) { model.BlogList = service.GetBlogs(); } return(PartialView(model)); }
private void NewBorrowForm_Load(object sender, EventArgs e) { using (StudentService studentService = new StudentService()) { cbStudents.DataSource = studentService.List(); cbStudents.DisplayMember = "FullName"; cbStudents.ValueMember = "StudentId"; } using (DefinitionService definitionService = new DefinitionService()) { cbGenres.DataSource = definitionService.GetGenres(); cbGenres.DisplayMember = "GenreName"; cbGenres.ValueMember = "GenreId"; } }
private void EditMovieForm_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cbRecordStatus.DataSource = definitionService.GetRecordStatus(); cbRecordStatus.DisplayMember = "RecordStatusName"; cbRecordStatus.ValueMember = "RecordStatusId"; } using (CustomerService customerService = new CustomerService()) { var customers = customerService.List(); lbCustomer.DataSource = customers; lbCustomer.DisplayMember = "DisplayString"; lbCustomer.ValueMember = "CustomerId"; } }
private void UpdateStudentForm_Load(object sender, EventArgs e) { using (StudentService studentService = new StudentService()) { var students = studentService.List(); lbStudents.DataSource = students; lbStudents.DisplayMember = "FullName"; lbStudents.ValueMember = "StudentId"; } using (DefinitionService definitionService = new DefinitionService()) { cbRecordStatus.DataSource = definitionService.GetRecordStatuses(); cbRecordStatus.DisplayMember = "RecordStatusName"; cbRecordStatus.ValueMember = "RecordStatusId"; } }
private void UpdateStudent_Load(object sender, EventArgs e) { using (DefinitionService service = new DefinitionService()) { cmbRecordStatus.DataSource = service.GetRecordStatuses(); cmbRecordStatus.DisplayMember = "RecordStatusName"; cmbRecordStatus.ValueMember = "RecordStatusId"; } using (StudentService service = new StudentService()) { listBox1.DataSource = service.List(); listBox1.DisplayMember = "FullName"; listBox1.ValueMember = "StudentId"; } }
private void EditUserForm_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cbRecordStatus.DataSource = definitionService.GetRecordStatus(); cbRecordStatus.DisplayMember = "RecordStatusName"; cbRecordStatus.ValueMember = "RecordStatusId"; } using (UserService userService = new UserService()) { var users = userService.List(); lbUsers.DataSource = users; lbUsers.DisplayMember = "DisplayString"; lbUsers.ValueMember = "UserId"; } }
public IHttpActionResult GetTownsByCity(int id) { using (DefinitionService service = new DefinitionService()) { var result = service.GetTownsByCity(id); if (result == null) { return(Content(HttpStatusCode.NotFound, "Verdiğiniz il kodu ile ilçe bulunamadı")); //return NotFound(); } return(Content(HttpStatusCode.OK, result)); //return Ok(result); } }
private void UpdateBookForm_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cmbRecordStatus.DataSource = definitionService.GetRecordStatuses(); cmbRecordStatus.DisplayMember = "RecordStatusName"; cmbRecordStatus.ValueMember = "RecordStatusId"; cmbGenres.DataSource = definitionService.GetGenres(); cmbGenres.DisplayMember = "GenreName"; cmbGenres.ValueMember = "GenreId"; } using (BookService bookService = new BookService()) { lbBooks.DataSource = bookService.List(); lbBooks.DisplayMember = "BookName"; lbBooks.ValueMember = "BookId"; } }
public ActionResult Shape(int id) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); var model = new BoardShapeModel(version, definitions.GetBoardSVG(version), definitions.GetCellLinks(version)); return(View(model)); }
private void EditMoviesForm_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cbRecordStatus.DataSource = definitionService.GetRecordStatus(); cbRecordStatus.DisplayMember = "RecordStatusName"; cbRecordStatus.ValueMember = "RecordStatusId"; cbGenre.DataSource = definitionService.GetGenres(); cbGenre.DisplayMember = "GenreName"; cbGenre.ValueMember = "GenreId"; } using (MovieService movieService = new MovieService()) { lbMovies.DataSource = movieService.List(); lbMovies.DisplayMember = "MovieName"; lbMovies.ValueMember = "MovieId"; } }
private void NewStudent_Load(object sender, EventArgs e) { using (DefinitionService definitionService = new DefinitionService()) { cmbBranch.DataSource = definitionService.GetBranches(); cmbBranch.DisplayMember = "BranchName"; cmbBranch.ValueMember = "BranchId"; } using (DefinitionService definitionService = new DefinitionService()) { cmbCourse.DataSource = definitionService.GetCourses(); cmbCourse.DisplayMember = "CourseName"; cmbCourse.ValueMember = "CourseId"; } using (DefinitionService definitionService = new DefinitionService()) { cmbFaculty.DataSource = definitionService.GetFaculties(); cmbFaculty.DisplayMember = "FacultyName"; cmbFaculty.ValueMember = "FacultyId"; } }
public ActionResult Relative(int id) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); var model = new RelativeDirectionsModel(version, definitions.CalculateGlobalDirectionDiagram(version), definitions.GetRelativeDirs(version)); return(View(model)); }
public ActionResult References(int id) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); var dirs = definitions.ListGlobalDirections(version); var model = new CellReferencesModel(version, definitions.GetBoardSVG(version, false, true), definitions.GetCellLinks(version), dirs); return(View(model)); }
/// <summary> /// Edit e gönnderilecek veriler tanımlandı /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int id) { if (Session["loginuser"] == null) { return(RedirectToAction("Index", "Account")); } using (CategoryService categoryService = new CategoryService()) { ViewBag.Categories = categoryService.GetCategories(); } using (DefinitionService definitionService = new DefinitionService()) { ViewBag.RecordStatuses = definitionService.GetRecordStatuses(); ///ViewBag ile Controllerdan veriler gönderiliyor } using (BlogService blogService = new BlogService()) { var result = blogService.Get(id); return(View(result)); } }
public ActionResult Raw(int id, string xmlData, string next) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); string errors; if (!definitions.ValidateXml(xmlData, out errors)) { ModelState.AddModelError("data", "Error validating XML data: " + errors); var model = new RawModel(version); model.XmlData = xmlData; return(View(model)); } version.Definition = xmlData; Entities().SaveChanges(); if (next == "done") { return(RedirectToAction("Edit", "Variants", new { id = version.VariantID })); } return(RedirectToAction("Raw", new { id })); }
public ActionResult Groups(int id) { var version = Entities().VariantVersions.Find(id); if (version == null) { return(HttpNotFound()); } UserService users = GetService <UserService>(); if (!users.IsAllowedToEdit(version.Variant, User.Identity.Name)) { return(new HttpUnauthorizedResult()); } DefinitionService definitions = GetService <DefinitionService>(); var global = definitions.ListGlobalDirections(version); var relative = definitions.ListRelativeDirections(version); var model = new DirectionGroupsModel(version, string.Join(";", global.Concat(relative)), definitions.GetDirectionGroups(version)); return(View(model)); }
private void NewBorrow_Load(object sender, EventArgs e) { using (StudentService service = new StudentService()) { cmbStudentName.DataSource = service.List(); cmbStudentName.DisplayMember = "FullName"; cmbStudentName.ValueMember = "StudentId"; } using (DefinitionService service = new DefinitionService()) { cmbGenres.DataSource = service.GetGenres(); cmbGenres.DisplayMember = "GenreName"; cmbGenres.ValueMember = "GenreId"; } using (BookService service = new BookService()) { var id = (cmbGenres.SelectedItem as GenreDTO).GenreId; lstBooks.DataSource = service.ListByGenre(id); lstBooks.DisplayMember = "Display"; lstBooks.ValueMember = "BookId"; } }
public void Setup() { service = new DefinitionService(); }