コード例 #1
0
        public EmployeeAddEdit(Employee selectedEmployee, ManagerForm form)
        {
            inputHandler = new FormInputHandler();
            parent       = form;

            InitializeComponent();
            if (selectedEmployee == null)
            {
                return;
            }
            AddUserButton.Text = "Edit";
            employee           = selectedEmployee;
            FillTextBoxes();
        }
コード例 #2
0
        public ActorAddEdit(AddMovieForm parent, Actor actor)
        {
            this.parent = parent;
            this.actor  = actor;
            validator   = new FormInputHandler();
            InitializeComponent();
            if (actor == null)
            {
                return;
            }


            fillFormData();
            AddEdit.Text = "Edit";
        }
コード例 #3
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            FormInputHandler inputcleaner = new FormInputHandler();

            List <String> queryList = new List <String>();

            if (!inputcleaner.doesNotContainSemiColonOrSingleQuote(TitleBox.Text))
            {
                return;
            }

            String q = "Select * from movie where [name] like '%" + TitleBox.Text + "%' ";

            if (!inputcleaner.doesNotContainSemiColonOrSingleQuote(GenreComboBox.Text))
            {
                return;
            }

            if (GenreComboBox.Text != "")
            {
                queryList.Add("genre like '" + GenreComboBox.Text + "'");
            }


            if (movieActors.Count != 0)
            {
                string actors = "";
                foreach (Actor actor in movieActors)
                {
                    actors += actor.Id.ToString() + ", ";
                }
                //remove the last 2 characters
                actors = actors.Remove(actors.Length - 2);
                queryList.Add("mid in (select mid from starred where aid in (" + actors + "))");
            }

            foreach (string s in queryList)
            {
                q += "and " + s;
            }
            parent.fillSearch(DBEnvironment.searchForMovies(q));
        }