public string getFilterExpression() { string retVal = ""; retVal = FirstField.ToString(); switch (Operator) { case Operators.Equals: retVal += " = "; break; case Operators.Like: retVal += " LIKE "; break; case Operators.Diferent: retVal += " != "; break; case Operators.BiggerThan: retVal += " > "; break; case Operators.LowerThan: retVal += " < "; break; default: retVal += " = "; break; } retVal += SeccondField.ToString(); return(retVal); }
private CreateResult TestRepoGeneration(MovieRepoFactory.Type rt, FirstField ff, List <Movie> movieList) { return((CreateResult)ExecuteTest(MovieRepoFactory.Repo(rt), new RepoGenerationTest() { MovieList = movieList, Field = ff })); }
public void Init(ICollection <Movie> movies, FirstField ff) { Field = ff; if (Field == FirstField.Year) { SearchTreeByYearByGenre = new c5T.TreeDictionary <long, Dictionary <string, List <Movie> > >(); List <c5T.KeyValuePair <long, Dictionary <string, List <Movie> > > > KVPList = new List <c5T.KeyValuePair <long, Dictionary <string, List <Movie> > > >(); foreach (var YearGrp in movies.GroupBy(m => m.Year)) { long year = YearGrp.Key; Dictionary <string, List <Movie> > genreDict = new Dictionary <string, List <Movie> >(); foreach (var genreGrp in YearGrp.GroupBy(m => m.Genre)) { genreDict.Add(genreGrp.Key, genreGrp.ToList()); } KVPList.Add(new c5T.KeyValuePair <long, Dictionary <string, List <Movie> > >(year, genreDict)); } SearchTreeByYearByGenre.AddAll(KVPList); } else { SearchTreeByGenreByYear = new Dictionary <string, c5T.TreeDictionary <long, List <Movie> > >(); throw new Exception("Not Implemented"); } }
public void Init(ICollection <Movie> movies, FirstField ff) { Field = ff; InitDataStructure(); if (Field == FirstField.Year) { foreach (var YearGrp in movies.GroupBy(m => m.Year)) { Dictionary <string, IList <Movie> > genreDict = new Dictionary <string, IList <Movie> >(); foreach (var genreGrp in YearGrp.GroupBy(m => m.Genre)) { genreDict.Add(genreGrp.Key, genreGrp.ToList()); } long year = YearGrp.Key; BinaryTreeByYearByGenre.Add(year, genreDict); } } else { foreach (var genreGrp in movies.GroupBy(m => m.Genre)) { BinaryTree <long, IList <Movie> > yearTree; if (BinaryTreeType.BinaryTree == TreeType) { yearTree = new BinaryTree <long, IList <Movie> >(); } else { yearTree = new RedBlackTree <long, IList <Movie> >(); } foreach (var YearGrp in genreGrp.GroupBy(m => m.Year)) { long year = YearGrp.Key; yearTree.Add(year, YearGrp.ToList()); } BinaryTreeByGenreByYear.Add(genreGrp.Key, yearTree); } } if (BinaryTreeType.BinaryTree == TreeType) { MoneyGrossBinaryTree = new BinaryTree <long, IList <Movie> >(); } else { MoneyGrossBinaryTree = new RedBlackTree <long, IList <Movie> >(); } foreach (var grossGrp in movies.GroupBy(m => m.Gross)) { MoneyGrossBinaryTree.Add(grossGrp.Key, grossGrp.ToList()); } }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Selects the first control with the tab stop. /// </summary> /// private void FocusOnFirstTabStop() { if (FirstField.TabStop) { FirstField.Focus(); } else { MdiForm.SelectNextControl(FirstField, /*forward*/ true, /*tabStopOnly*/ true, /*nested*/ true, /*wrap*/ true); } }
public void Init(ICollection <Movie> movieList, FirstField FF) { Field = FF; if (FF == FirstField.Year) { MovieList.AddRange(movieList.OrderBy(ml => ml.Year).ThenBy(ml => ml.Genre)); } if (FF == FirstField.Genre) { MovieList.AddRange(movieList.OrderBy(ml => ml.Genre).ThenBy(ml => ml.Year)); } }
public void Init(ICollection <Movie> movies, FirstField ff) { Field = ff; if (FirstField.Year == Field) { LookupByYearByGenre = movies.GroupBy(m => m.Year) .ToLookup(t => t.Key, t => t.ToLookup(m => m.Genre, m => m)); } else { LookupByGenreByYear = movies.GroupBy(m => m.Genre) .ToLookup(t => t.Key, t => t.ToLookup(m => m.Year, m => m)); } }
public void Init(ICollection <Movie> movies, FirstField ff) { Field = ff; if (FirstField.Year == Field) { DictionaryByYearThenGenre = movies.GroupBy(m => m.Year) .ToDictionary(t => t.Key, t => t.GroupBy(x => x.Genre).ToDictionary(x => x.Key, x => x.ToList())); } else { DictionaryByGenreThenYear = movies.GroupBy(m => m.Genre) .ToDictionary(t => t.Key, t => t.GroupBy(x => x.Year).ToDictionary(x => x.Key, x => x.ToList())); } MoneyGrossDictionary = movies.GroupBy(m => m.Gross) .ToDictionary(t => t.Key, t => t.ToList()); }
public void Init(ICollection <Movie> movies, FirstField ff) { Field = ff; if (FirstField.Year == Field) { SortedDictByYearByGenre = new SortedDictionary <long, Dictionary <string, List <Movie> > >(movies.GroupBy(m => m.Year) .ToDictionary(t => t.Key, t => t.GroupBy(x => x.Genre).ToDictionary(x => x.Key, x => x.ToList()))); } else { SortedDictByGenreByYear = movies.GroupBy(m => m.Genre) .ToDictionary(t => t.Key, t => new SortedDictionary <long, List <Movie> >(t.GroupBy(x => x.Year).ToDictionary(x => x.Key, x => x.ToList())) ); } MoneyGrossSearchTree = new SortedDictionary <long, List <Movie> >(movies.GroupBy(m => m.Gross) .ToDictionary(t => t.Key, t => t.ToList())); }
/// <summary> /// Sets the ReadOnly property of the form. /// </summary> /// <remarks> /// Configures whether membership, priceClass and minQuantity fields are /// enabled. /// </remarks> /// protected override void SetReadOnly(bool readOnly) { base.SetReadOnly(readOnly); ///////////////////////////////////////////////////////////////////////////////// this.membership.TabStop = IsAddNew; this.membership.ReadOnly = readOnly || !IsAddNew; this.priceClass.TabStop = IsAddNew; this.priceClass.ReadOnly = readOnly || !IsAddNew; this.textMinQuantity.TabStop = IsAddNew; this.textMinQuantity.ReadOnly = readOnly || !IsAddNew; FirstField = IsAddNew ? (Control)this.membership : this.textRentalFee; if (MdiForm.ActiveChild == null || !MdiForm.ActiveChild.TabStop) { FirstField.Focus(); } }
/// <summary> /// Sets the ReadOnly property of the form. /// </summary> /// <remarks> /// Configures whether locker-button is visible. /// </remarks> /// protected override void SetReadOnly(bool readOnly) { readOnly = readOnly || this.Movie == null; ///////////////////////////////////////////////////////////////////////////////// base.SetReadOnly(readOnly); ///////////////////////////////////////////////////////////////////////////////// FirstField = this.media; if (MdiForm.ActiveChild == null || !MdiForm.ActiveChild.TabStop) { FirstField.Focus(); } if (this.Movie == null && IsAddNew) { Button_Locker.TabStop = false; Button_Locker.Enabled = false; } }
/// <summary> /// Sets the ReadOnly property of the form. /// </summary> /// <remarks> /// Configures buttons' text and whether exemplarSelect field is enabled. /// </remarks> /// protected override void SetReadOnly(bool readOnly) { base.SetReadOnly(readOnly); ///////////////////////////////////////////////////////////////////////////////// Button_OK.Text = ReadOnly ? "Cl&ose" : IsAddNew ? "&Rent Item" : "&Update"; Button_Delete.Text = "&Return Item"; LayoutButtonPanel(); ///////////////////////////////////////////////////////////////////////////////// this.exemplarSelect.TabStop = !ReadOnly && IsAddNew; this.exemplarSelect.Enabled = !ReadOnly && IsAddNew; this.exemplarSelect.Visible = this.exemplarSelect.Enabled; FirstField = IsAddNew ? this.exemplarSelect : (Control)this.dueDate; if (MdiForm.ActiveChild != null && !MdiForm.ActiveChild.TabStop) { FirstField.Focus(); } }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes UI components of the DetailsForm. /// </summary> /// <remarks> /// Sets the FirstField control and creates ButtonPanel. /// </remarks> /// protected override void InitializeComponents() { FirstField = MdiForm.Children[0] as Control; foreach (var child in MdiForm.Children) { Control ctrl = child as Control; if (ctrl != null && ctrl.TabStop) { FirstField = ctrl; break; } } FirstField.Focus(); ///////////////////////////////////////////////////////////////////////////////// if (Em.IsTextUI) { MdiForm.ForeColor = Color.DarkCyan; } ///////////////////////////////////////////////////////////////////////////////// // Buttons Button_OK = new MyButton() { AutoSize = true, TabStop = false }; Button_Locker = new MyButton() { AutoSize = true, TabStop = false }; Button_Delete = new MyButton() { AutoSize = true, TabStop = false }; Button_Link = new MyButton() { AutoSize = true, TabStop = false }; Button_Info = new MyButton() { AutoSize = true, TabStop = false }; Button_Cancel = new MyButton() { AutoSize = true, TabStop = false }; ///////////////////////////////////////////////////////////////////////////////// Button_OK.Click += delegate { if (ReadOnly) { QuitForm(); } else { SaveAndLock(); } }; Button_Locker.Click += (sender, e) => ToggleReadOnlyMode(); Button_Delete.Click += (sender, e) => RaiseDeleteClick(); Button_Link.Click += (sender, e) => RaiseLinkClick(); Button_Info.Click += (sender, e) => RaiseInfoClick(); Button_Cancel.Click += (sender, e) => QuitForm(); ///////////////////////////////////////////////////////////////////////////////// buttonCollection = new MyButton[] { Button_OK, Button_Locker, Button_Delete, Button_Link, Button_Info, Button_Cancel, }; ///////////////////////////////////////////////////////////////////////////////// #if TEXTUI MdiForm.DrawFrame(1, MdiForm.Height - 4, MdiForm.Width - 2, 1); #else MdiForm.Controls.Add(new MyLineSeparator() { Dock = DockStyle.Bottom }); ButtonPanel = new FlowLayoutPanel() { Dock = DockStyle.Bottom, AutoSize = true, Padding = new Padding(2 * Em.Width, Em.Height / 2, 0, Em.Height / 2), TabStop = false, TabIndex = 10000, }; MdiForm.Controls.Add(ButtonPanel); #endif ///////////////////////////////////////////////////////////////////////////////// base.InitializeComponents(); }