示例#1
0
        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";
            }
        }
示例#2
0
        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 }));
        }
示例#3
0
        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 }));
        }
示例#4
0
        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));
     }
 }
示例#6
0
 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));
     }
 }
示例#8
0
 private void NewBookForm_Load(object sender, EventArgs e)
 {
     using (DefinitionService definitionService = new DefinitionService())
     {
         cbGenres.DataSource    = definitionService.GetGenres();
         cbGenres.DisplayMember = "GenreName";
         cbGenres.ValueMember   = "GenreId";
     }
 }
示例#9
0
        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);
        }
示例#11
0
        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";
            }
        }
示例#12
0
        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));
            }
        }
示例#13
0
        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));
        }
示例#14
0
        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";
            }
        }
示例#15
0
        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";
            }
        }
示例#16
0
        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";
            }
        }
示例#17
0
        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";
            }
        }
示例#18
0
        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";
            }
        }
示例#19
0
        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);
            }
        }
示例#20
0
        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";
            }
        }
示例#21
0
        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));
        }
示例#22
0
        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";
            }
        }
示例#23
0
 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";
     }
 }
示例#24
0
        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));
        }
示例#25
0
        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));
        }
示例#26
0
        /// <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));
            }
        }
示例#27
0
        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 }));
        }
示例#28
0
        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));
        }
示例#29
0
        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";
            }
        }
示例#30
0
 public void Setup()
 {
     service = new DefinitionService();
 }