public UMLParameter(string name, UMLDataType type, ListTypes listTypes = ListTypes.None) { Name = name; ListType = listTypes; ObjectType = type; }
internal List <SRL_Ingredient> GetGeneralList(int userId, ListTypes listType) { using (DataContext) { try { GeneralList generalList = (from p in DataContext.GeneralLists where p.CREATED_BY == userId && p.ACTIVE == true && p.LIST_TYPE == (int)listType select p).Single(); if (generalList != null) { List <SRL_Ingredient> ingredients = (from p in DataContext.GeneralListDetails where p.LIST_ID == generalList.ID select new SRL_Ingredient { IngredientId = p.ID, FoodName = p.ITEM_NAME, CompleteValue = p.COMPLETE_QUANTITY, Quantity = decimal.Parse(p.COMPLETE_QUANTITY), MeasurementUnitId = p.MEASUREMENT_UNIT_ID, MeasurementUnitName = p.MEASUREMENT_UNIT }).ToList(); return(ingredients); } return(null); } catch (Exception) { return(null); } } }
public IEnumerable <(int, string)> GetTargetList(ListTypes type) { List <(int, string)> _list = new List <(int, string)>(); switch (type) { case ListTypes.Income: _list.AddRange(_walletRepository .GetAll() .Select(x => (x.Id, x.Name))); break; case ListTypes.Expences: _list.AddRange(_categoryRepository .GetAll() .Select(x => (x.Id, x.Name))); break; case ListTypes.Transfer: _list.AddRange(_walletRepository .GetAll() .Select(x => (x.Id, x.Name))); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(_list); }
public Lists(ListTypes listType) { ListViewModel.Errors = 0; InitializeComponent(); Messenger.Default.Send <ListTypes>(listType); Messenger.Reset(); }
public object Get(Type itemType) { object item; var elementType = itemType.GetCompatibleArrayItemType(); if (elementType != null) { item = GetArray(itemType, elementType); } else if (itemType.IsGenericType && ListTypes.Contains(itemType.GetGenericTypeDefinition())) { item = GetList(itemType); } else { item = _items.Where(itemType.IsInstanceOfType).FirstOrDefault(); if (item == null && _parentScope != null) { item = _parentScope.Get(itemType); } } if (item == null && _clear.Any(itemType.IsAssignableFrom)) { return(Null); } return(item); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="newChapter">The chapter</param> /// ------------------------------------------------------------------------------------ private void InternalChapterSelected(int newChapter) { // If the user picked a different chapter then set the verse to 1. if (m_scRef.Chapter != newChapter) { m_scRef.Chapter = newChapter; m_scRef.Verse = 1; ScrPassageControl.Reference = m_scRef.AsString; } List <int> verseList = new List <int>(); for (int i = 1; i <= m_scRef.LastVerse; i++) { verseList.Add(i); } if (ChapterSelected != null) { ChapterSelected(m_scRef.Book, m_scRef.Chapter); } m_nowShowing = ListTypes.Verses; LoadCVButtons(verseList, m_scRef.Verse); }
public UMLProperty(string name, UMLDataType type, UMLVisibility visibility, ListTypes listType, bool isStatic, bool isAbstract, bool drawnWithLine) : base(name, type, listType) { Visibility = visibility; IsStatic = isStatic; IsAbstract = isAbstract; DrawnWithLine = drawnWithLine; }
public static void NullCull_ListType_InitialzedCorrectly() { var lt = new ListTypes(); lt.NullCull(); Assert.NotNull(lt.List); Assert.That(lt.List.GetType(), Is.EqualTo(typeof(List <string>))); }
public ContentResult Rows(string TableName, ListTypes ListType, string ListName) { MetadataTable mt = SqlBuilder.DefaultMetadata.FindTable(TableName); SqlBuilder Builder = mt.ToSqlBuilder(ListType != ListTypes.Custom ? ListType.ToString() : ListName); ResultTable result = Builder.Execute(30, false, ResultTable.DateHandlingEnum.ConvertToDate); return(Content(SerializationExtensions.ToJson <dynamic>(result), "application/json")); }
private void AlbumsButton_Click(object sender, EventArgs e) { MusicDisplayListBox.Items.Clear(); foreach (Album album in TracksList.Albums) { MusicDisplayListBox.Items.Add(album.Name); } currentListType = ListTypes.Album; }
private void SongsButton_Click(object sender, EventArgs e) { MusicDisplayListBox.Items.Clear(); foreach (Song song in TracksList.Songs) { MusicDisplayListBox.Items.Add(song.Name); } currentListType = ListTypes.Song; }
private void PlaylistsButton_Click(object sender, EventArgs e) { MusicDisplayListBox.Items.Clear(); foreach (Playlist playlist in TracksList.Playlists) { MusicDisplayListBox.Items.Add(playlist.Name); } currentListType = ListTypes.Playlist; }
public static void WriteJsonFile(this string json, ListTypes listType) { try { File.WriteAllText(GetNameForJson(listType), json); } catch (Exception ex) { return; } }
private static T ReadJsonFile <T>(ListTypes listType) { try { return(JsonConvert.DeserializeObject <T>(File.ReadAllText(GetNameForJson(listType)))); } catch (Exception ex) { return(default(T)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { List <int> chapterList; // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new ScrReference(button.BCVValue, 1, 1, m_versification); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) { BookSelected(m_scRef.Book); } if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } if (ScrPassageControl.MulScrBooks is DBMultilingScrBooks) { // Get the number of chapters from cache. chapterList = LoadChapterListFromCache(); } else { // Get the number of chapters based on the versification scheme. chapterList = new List <int>(); for (int i = 1; i <= m_scRef.LastChapter; i++) { chapterList.Add(i); } } // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) { InternalChapterSelected(chapterList[0]); } else { // Show the list of chapters. m_nowShowing = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }
public PartialViewResult Edit(string Id, string Table, ListTypes ListType, string ListName) { MetadataTable table = SqlBuilder.DefaultMetadata.FindTable(Table); // SqlBuilder builder = table.ToSqlBuilder(ListType != ListTypes.Custom ? ListType.ToString() : ListName); SqlBuilder builder = table.ToSqlBuilder(""); builder.BaseTable().WithMetadata().WherePrimaryKey(new object[] { (object)Id }); ResultTable result = builder.Execute(); Form model = FormFactory.Default.BuildForm(builder); model.Initialize(result.First()); return PartialView(model.EditDialogViewUrl,model); }
public PartialViewResult Edit(string Id, string Table, ListTypes ListType, string ListName) { MetadataTable table = SqlBuilder.DefaultMetadata.FindTable(Table); // SqlBuilder builder = table.ToSqlBuilder(ListType != ListTypes.Custom ? ListType.ToString() : ListName); SqlBuilder builder = table.ToSqlBuilder(""); builder.BaseTable().WithMetadata().WherePrimaryKey(new object[] { (object)Id }); ResultTable result = builder.Execute(); Form model = FormFactory.Default.BuildForm(builder); model.Initialize(result.First()); return(PartialView(model.EditDialogViewUrl, model)); }
public List(ListTypes type) { switch (type) { case ListTypes.None: internalList = new System.Windows.Documents.List(); break; case ListTypes.Unordered: internalList = new UnorderedList(); break; } this.InitializeComponent(); this.Blocks.Add(internalList); }
private Type LoadListTypeForProperty(string fullPropName) { string listTypeName; Type listType = null; if (ListTypes.TryGetValue(fullPropName, out listTypeName)) { listType = AppDomain.CurrentDomain.GetAssemblies().Select((asm) => (asm.GetType(listTypeName))) .Where(t => t != null).FirstOrDefault(); if (listType == null) Console.WriteLine("Warning: Unable to load type " + listTypeName); } return listType; }
public void testRemoteListTypes() { log.info("testRemoteListTypes("); ListTypes obj = new ListTypes(); obj.Boolean1 = new List <bool>(new bool[] { true, false }); obj.Byte1 = new List <byte>(new byte[] { (byte)1, (byte)2, (byte)3 }); obj.Char1 = new List <char>(new char [] { 'a', 'b' }); obj.Double1 = new List <double>(new double[] { 0.0, 0.1, 0.2 }); obj.Float1 = new List <float>(new float[] { 1f, 2f, 3f, 4f }); obj.Int1 = new List <int>(new int[] { 1, 2, 3, 4, 5 }); obj.Long1 = new List <long>(new long[] { 1L, 2L, 3L, 4L, 5L, 6L }); obj.PrimitiveTypes1 = new List <PrimitiveTypes>(new PrimitiveTypes[] { TestUtils.createObjectPrimitiveTypes() }); obj.Short1 = new List <short>(new short[] { (short)1 }); obj.String1 = new List <String>(new String[] { "a", "b", "c" }); obj.Date1 = new List <DateTime>(new DateTime[] { new DateTime(), new DateTime(1999, 11, 22, 23, 33, 33, 333) }); obj.Obj1 = new List <Object>(); obj.Obj1.Add(TestUtils.createObjectPrimitiveTypes()); remote.SetBoolean1(obj.Boolean1); TestUtils.assertEquals(log, "boolean1", obj.Boolean1, remote.GetBoolean1()); remote.SetByte1(obj.Byte1); TestUtils.assertEquals(log, "byte1", obj.Byte1, remote.GetByte1()); remote.SetChar1(obj.Char1); TestUtils.assertEquals(log, "char1", obj.Char1, remote.GetChar1()); remote.SetDouble1(obj.Double1); TestUtils.assertEquals(log, "double1", obj.Double1, remote.GetDouble1()); remote.SetFloat1(obj.Float1); TestUtils.assertEquals(log, "float1", obj.Float1, remote.GetFloat1()); remote.SetInt1(obj.Int1); TestUtils.assertEquals(log, "int1", obj.Int1, remote.GetInt1()); remote.SetLong1(obj.Long1); TestUtils.assertEquals(log, "long1", obj.Long1, remote.GetLong1()); remote.SetPrimitiveTypes1(obj.PrimitiveTypes1); TestUtils.assertEquals(log, "primitiveTypes1", obj.PrimitiveTypes1, remote.GetPrimitiveTypes1()); remote.SetShort1(obj.Short1); TestUtils.assertEquals(log, "short1", obj.Short1, remote.GetShort1()); remote.SetString1(obj.String1); TestUtils.assertEquals(log, "string1", obj.String1, remote.GetString1()); remote.SetDate1(obj.Date1); TestUtils.assertEquals(log, "date1", obj.Date1, remote.GetDate1()); remote.SetObj1(obj.Obj1); TestUtils.assertEquals(log, "obj1", obj.Obj1, remote.GetObj1()); log.info(")testRemoteListTypes"); }
public static SelectList GetListData(ListTypes listType) { List <SelectListItem> list = new List <SelectListItem>(); using (StudentDB2Context db = new StudentDB2Context()) { list = db.ListTypesDatas.Where(x => x.ListTypeId == (int)listType).Select(x => new SelectListItem { Text = x.Description, Value = x.ListTypeDataId.ToString() }).ToList(); } SelectList lst = new SelectList(list.AsEnumerable(), "Value", "Text"); return(lst); }
public bool Contains(Type itemType) { if (_clear.Any(itemType.IsAssignableFrom)) { return(true); } var elementType = itemType.GetCompatibleArrayItemType(); if (elementType != null) { itemType = elementType; } else if (itemType.IsGenericType && ListTypes.Contains(itemType.GetGenericTypeDefinition())) { itemType = itemType.GetGenericArguments()[0]; } return(_items.Any(itemType.IsInstanceOfType) || ((_parentScope != null) && _parentScope.Contains(itemType))); }
internal int AddGeneralList(int userId, ListTypes listType) { using (DataContext) { try { int i = (from p in DataContext.GeneralLists where p.CREATED_BY == userId && p.LIST_TYPE == (int)listType && p.ACTIVE == true select p). Count(); GeneralList generalList; if (i == 0) { generalList = new GeneralList { CREATED_BY = userId, CREATE_DATE = DateTime.Today, ACTIVE = true, LIST_TYPE = (int)listType }; DataContext.GeneralLists.InsertOnSubmit(generalList); DataContext.SubmitChanges(); } else { generalList = (from p in DataContext.GeneralLists where p.CREATED_BY == userId && p.ACTIVE == true && p.LIST_TYPE == (int)listType select p). Single(); } return(generalList.ID); } catch { return(-1); } } }
public bool ToCache(ListBuilder list, ListTypes ListType, string CustomListName = null) { switch (ListType) { case ListTypes.Primary: return(PrimaryLists.TryAdd(list.TableName, list)); case ListTypes.Secondary: return(SecondaryLists.TryAdd(list.TableName, list)); case ListTypes.Integrated: return(IntegratedLists.TryAdd(list.TableName, list)); case ListTypes.Lookup: return(LookupLists.TryAdd(list.TableName, list)); case ListTypes.Custom: if (string.IsNullOrEmpty(CustomListName)) { throw new ArgumentException("Custom List name must be specified to load a custom list", "CustomListName"); } List <ListBuilder> custom = null; if (CustomLists.TryGetValue(list.TableName, out custom)) { if (custom.Any(x => x.CustomName.Equals(CustomListName, StringComparison.OrdinalIgnoreCase))) { return(false); } custom.Add(list); return(true); } else { return(false); } default: return(false); } }
public bool ToCache(ListBuilder list, ListTypes ListType, string CustomListName = null) { switch (ListType) { case ListTypes.Primary: return PrimaryLists.TryAdd(list.TableName, list); case ListTypes.Secondary: return SecondaryLists.TryAdd(list.TableName, list); case ListTypes.Integrated: return IntegratedLists.TryAdd(list.TableName, list); case ListTypes.Lookup: return LookupLists.TryAdd(list.TableName, list); case ListTypes.Custom: if (string.IsNullOrEmpty(CustomListName)) { throw new ArgumentException("Custom List name must be specified to load a custom list", "CustomListName"); } List<ListBuilder> custom = null; if (CustomLists.TryGetValue(list.TableName, out custom)) { if (custom.Any(x => x.CustomName.Equals(CustomListName, StringComparison.OrdinalIgnoreCase))) { return false; } custom.Add(list); return true; } else { return false; } default: return false; } }
private void HideTextboxNewType() { NewTypeTextBox.Text = ""; ListTypes.BeginAnimation(HeightProperty, new DoubleAnimation(ListTypes.ActualHeight, ListHeight, TimeSpan.FromMilliseconds(400), FillBehavior.Stop) { EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut } }); Storyboard sb = new Storyboard(); TypeAnimTriggerd = false; var fade = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromMilliseconds(300), FillBehavior = FillBehavior.Stop }; Storyboard.SetTarget(fade, SaveNewTypeButton); Storyboard.SetTargetProperty(fade, new PropertyPath(OpacityProperty)); sb.Completed += (s, e) => { SaveNewTypeButton.Visibility = Visibility.Collapsed; NewTypeButton.Visibility = Visibility.Visible; NewTypeTextBox.Visibility = Visibility.Collapsed; }; sb.Children.Add(fade); sb.Begin(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new BCVRef(button.BCVValue, 1, 1); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) { BookSelected(m_scRef.Book); } if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } List <int> chapterList = CurrentChapterList; // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) { InternalChapterSelected(chapterList[0]); } else { // Show the list of chapters. CurrentListType = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }
/// <summary> /// Initialises a new instance of the ListXmlCodeElement class. /// </summary> /// <param name="node">The node the list is based on.</param> internal ListXmlCodeElement(XmlNode node) : base(XmlCodeElements.List) { Elements = Parse(node); IsBlock = true; _listType = ListTypes.Bullet; // default // the node should have a type attribute, if not default to bullet list XmlAttribute typeAttribute = node.Attributes["type"]; if (typeAttribute != null) { switch (typeAttribute.Value.ToLower()) { case "table": _listType = ListTypes.Table; break; case "number": _listType = ListTypes.Number; break; } } }
private void NewTypeButton_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { NewTypeButton.Visibility = Visibility.Collapsed; NewTypeTextBox.Visibility = Visibility.Visible; SaveNewTypeButton.Opacity = 1; SaveNewTypeButton.Visibility = Visibility.Visible; NewTypeTextBox.Focus(); NewTypeTextBox.Select(NewTypeTextBox.Text.Length, 1); if (!TypeAnimTriggerd) { ListTypes.BeginAnimation(HeightProperty, new DoubleAnimation(ListHeight, ListHeight - 50, TimeSpan.FromMilliseconds(400), FillBehavior.HoldEnd) { EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut } }); } TypeAnimTriggerd = true; }
public PartialViewResult List(string TableName, ListTypes ListType, string ListName) { ListBuilder model = ListFactory.Default.BuildList(TableName, ListType, null, ListName); return PartialView(model.ListViewUrl, model); }
public ContentResult Rows(string TableName, ListTypes ListType, string ListName) { MetadataTable mt = SqlBuilder.DefaultMetadata.FindTable(TableName); SqlBuilder Builder = mt.ToSqlBuilder(ListType != ListTypes.Custom ? ListType.ToString() : ListName); ResultTable result = Builder.Execute(30, false, ResultTable.DateHandlingEnum.ConvertToDate); return Content(SerializationExtensions.ToJson<dynamic>(result), "application/json"); }
public List <SRL_Ingredient> GetGeneralList(int userId, ListTypes listType) { return(new GeneralListDA().GetGeneralList(userId, listType)); }
public int AddGeneralList(int userId, ListTypes listType) { return(new GeneralListDA().AddGeneralList(userId, listType)); }
public ProductComparer(ListTypes listToFill) { lists = listToFill; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new ScrReference(button.BCVValue, 1, 1, m_versification); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) BookSelected(m_scRef.Book); if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } List<int> chapterList = CurrentChapterList; // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) InternalChapterSelected(chapterList[0]); else { // Show the list of chapters. CurrentListType = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void LoadBooksButtons() { int numberOfButtons = ScrPassageControl.BookLabels.Length; if (numberOfButtons == 0) return; int buttonWidth; int numberRows; SuspendLayout(); Controls.Clear(); ResetPointersToSurroundingButtons(); CurrentListType = ListTypes.Books; PrepareLayout(numberOfButtons, BookButtonPreferredWidth, out numberRows, out buttonWidth); Point pt = new Point(1, 1); int row = 0; for (int i = 0; i < numberOfButtons; i++) { m_buttons[i].Text = ScrPassageControl.BookLabels[i].ToString(); m_buttons[i].Size = new Size(buttonWidth, ButtonHeight); m_buttons[i].Location = pt; m_buttons[i].State = ButtonState.Normal; m_buttons[i].BCVValue = ScrPassageControl.BookLabels[i].BookNum; m_buttons[i].TextFormat.Alignment = StringAlignment.Near; m_buttons[i].TextLeadingMargin = 3; Controls.Add(m_buttons[i]); pt.Y += ButtonHeight + 1; row++; if (i > 0) m_buttons[i].ButtonAbove = i - 1; if (i < numberOfButtons - 1) m_buttons[i].ButtonBelow = i + 1; if (i - numberRows >= 0) m_buttons[i].ButtonLeft = i - numberRows; if (i + numberRows < numberOfButtons) m_buttons[i].ButtonRight = i + numberRows; if (row == numberRows) { pt.Y = 1; pt.X += buttonWidth + 1; row = 0; } } m_saveMousePos = Point.Empty; ResumeLayout(false); }
public ListBuilder BuildList(string TableName, ListTypes ListType, string ListTitle = null, string CustomListName = null) { ListBuilder list = null; bool InCache = false; MetadataTable Table = SqlBuilder.DefaultMetadata.FindTable(TableName); if (Table == null) { throw new ArgumentException(string.Format("The table '{0}' was not found in metadata", TableName), "TableName"); } switch (ListType) { case ListTypes.Primary: InCache = PrimaryLists.TryGetValue(Table.Fullname, out list); break; case ListTypes.Secondary: InCache = SecondaryLists.TryGetValue(Table.Fullname, out list); break; case ListTypes.Integrated: InCache = IntegratedLists.TryGetValue(Table.Fullname, out list); break; case ListTypes.Lookup: InCache = LookupLists.TryGetValue(Table.Fullname, out list); break; case ListTypes.Custom: if (string.IsNullOrEmpty(CustomListName)) { throw new ArgumentException("Custom List name must be specified to load a custom list", "CustomListName"); } List<ListBuilder> custom = null; if (CustomLists.TryGetValue(Table.Fullname, out custom)) { InCache = custom.Any(x => x.CustomName.Equals(CustomListName, StringComparison.OrdinalIgnoreCase)); if (InCache) { list = custom.First(x => x.CustomName.Equals(CustomListName, StringComparison.OrdinalIgnoreCase)); } } break; default: break; } if (list != null) { return list; } list = new ListBuilder() { ListType = ListType, TableName = Table.Fullname, Title = string.IsNullOrEmpty(ListTitle) ? Table.DisplayName : ListTitle, CustomName = CustomListName, }; list.AllowNew = list.AllowEdit = list.AllowDelete = ListType != ListTypes.Lookup; string ListName = ListType != ListTypes.Custom ? ListType.ToString() : CustomListName; List<MetadataColumn> columns = new List<MetadataColumn>(Table.PrimaryKey.Columns); List<string> columnDef = null; if (!Table.ListDefinitions.TryGetValue(ListName, out columnDef)) { // No standard specified columnDef = new List<string>(Table.Columns.Values.Where(x => x.IsPrimaryKey == false && x.IsRowGuid == false).Select(x => x.Name)); } foreach (MetadataColumn column in columns) { list.Columns.Add(new ListColumn() { ColumnName = column.Name, DisplayName = column.DisplayName, IsVisible = true, ColumnDataType = ListColumn.GetColumnDataType(column.SqlDataType) }); } list.Builder = Table.ToSqlBuilder(list.ListType != ListTypes.Custom ? list.ListType.ToString() : CustomListName); foreach (string cdef in columnDef) { MetadataColumn mc; SqlDbType type = SqlDbType.NVarChar; string Display = cdef; string ColName = cdef; if (cdef.IndexOf('=') > 0) { ColName = cdef.Split('=')[0]; Display = cdef.Split('=')[1]; } if (!Table.Columns.TryGetValue(ColName, out mc)) { Field f = list.Builder.Tables.SelectMany(x => x.FieldList).FirstOrDefault(x => x.Alias != null && x.Alias.Equals(ColName)); if (f != null) { type = f.SqlDataType; //MetadataTable mtRelated = SqlBuilder.DefaultMetadata.FindTable((f.Table.Schema != null ? f.Table.Schema + "." : "") + f.Table.Name); //MetadataColumn mcRelated; //if (mtRelated.Columns.TryGetValue(f.Name, out mcRelated)) //{ // Display = mcRelated.DisplayName; //} } } else { Display = mc.DisplayName; ColName = mc.Name; type = mc.SqlDataType; } list.Columns.Add(new ListColumn() { ColumnName = ColName, DisplayName = Display, IsVisible = mc != null ? !mc.IsForeignKey : true, ColumnDataType = ListColumn.GetColumnDataType(type) }); } //columns.AddRange( // Table.Columns.Values.Where(x => columnDef.Contains(x.Name)) // ); ToCache(list, ListType, CustomListName); return list; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="newChapter">The chapter</param> /// ------------------------------------------------------------------------------------ private void InternalChapterSelected(int newChapter) { // If the user picked a different chapter then set the verse to 1. if (m_scRef.Chapter != newChapter) { m_scRef.Chapter = newChapter; m_scRef.Verse = 1; ScrPassageControl.Reference = m_scRef.AsString; } List<int> verseList = new List<int>(); for (int i = 1; i <= m_scRef.LastVerse; i++) verseList.Add(i); if (ChapterSelected != null) ChapterSelected(m_scRef.Book, m_scRef.Chapter); m_nowShowing = ListTypes.Verses; LoadCVButtons(verseList, m_scRef.Verse); }
public Object searchListByID(string id, ListTypes lt) { switch (lt) { case (ListTypes.Weapons): foreach (Weapon weapon in this.weapons) { if (weapon.ID.Equals(id)) { return weapon; } } break; case (ListTypes.Armours): foreach (Armour armour in this.armours) { if (armour.ID.Equals(id)) { return armour; } } break; case (ListTypes.Units): foreach (Unit unit in this.attackerunits) { if (unit.ID.Equals(id)) { return unit; } } break; case (ListTypes.Stats): foreach (Stat stat in this.stats) { if (stat.ID.Equals(id)) { return stat; } } break; case (ListTypes.PlayerStats): foreach (PlayerStat stat in this.pstats) { if (stat.ID.Equals(id)) { return stat; } } break; default: this.logger.logBoth(String.Format("Searching for id: {0}, type: {1}", id, lt.ToString())); break; } return null; }
//public ContentResult Save(FormCollection Model, string Table, ListTypes ListType, string ListName) // public ContentResult Save(SaveModel Model) public ContentResult Save(string rowData, string Table, ListTypes ListType, string ListName) { RowData row = SerializationExtensions.FromJson<RowData>(rowData); row.LoadMetadata(); row.LoadMissingColumns<bool>(); SqlBuilder builder = row.Update(false, true); ResultTable result = builder.Execute(); if (result.Count == 1) { builder = row.Select(ListType != ListTypes.Custom ? ListType.ToString() : ListName); //builder = row.Metadata.ToSqlBuilder(ListType != ListTypes.Custom ? ListType.ToString() : ListName); //builder.WhereConditions = row.PrimaryKey(builder); result = builder.Execute(30, false, ResultTable.DateHandlingEnum.ConvertToDate); if (result.Count == 1) { return Content(SerializationExtensions.ToJson<dynamic>(result.First()), "application/json"); } //// object PK = result.First().Column(mt.PrimaryKey.Columns.First().Name); //Builder.BaseTable().WithMetadata().WherePrimaryKey(new object[] { (object)PK }); //ResultTable updated = Builder.Execute(30, false, ResultTable.DateHandlingEnum.ConvertToDate); //if (updated.Count == 1) //{ // return Content(SerializationExtensions.ToJson<dynamic>(updated.First()), "application/json"); //} } //// Retrieve by Primary key //MetadataTable mt = SqlBuilder.DefaultMetadata.FindTable(Table); //List<object> PKs = new List<object>(); //foreach (MetadataColumn mc in mt.PrimaryKey.Columns) //{ // PKs.Add(Model[Table + "_" + mc.Name]); //} //// Create an empty row with the primary key set //RowData row = RowData.Create(mt, true, PKs.ToArray()); //// Change the row //foreach (string key in Model.Keys) //{ // if (!key.StartsWith("__")) // { // string ColumnName = key.Replace(Table, "").Replace("_", ""); // MetadataColumn mc; // if (mt.Columns.TryGetValue(ColumnName, out mc)) // { // if (!mc.IsReadOnly) // { // // row.Column(mc.Name, (object)Model[key]); // row.Column(mc.Name, Model[key]); // } // } // } //} //// Build SQL and update //SqlBuilder builder = row.Update(true, true); //ResultTable result = builder.Execute(30, false); //if (result.Count == 1) //{ // object PK = result.First().Column(mt.PrimaryKey.Columns.First().Name); // SqlBuilder Builder = mt.ToSqlBuilder(ListType != ListTypes.Custom ? ListType.ToString() : ListName); // Builder.BaseTable().WithMetadata().WherePrimaryKey(new object[] { (object)PK }); // ResultTable updated = Builder.Execute(30, false, ResultTable.DateHandlingEnum.ConvertToDate); // if (updated.Count == 1) // { // return Content(SerializationExtensions.ToJson<dynamic>(updated.First()), "application/json"); // } //} return Content(""); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { List<int> chapterList; // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new ScrReference(button.BCVValue, 1, 1, m_versification); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) BookSelected(m_scRef.Book); if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } if (ScrPassageControl.MulScrBooks is DBMultilingScrBooks) { // Get the number of chapters from cache. chapterList = LoadChapterListFromCache(); } else { // Get the number of chapters based on the versification scheme. chapterList = new List<int>(); for (int i = 1; i <= m_scRef.LastChapter; i++) chapterList.Add(i); } // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) InternalChapterSelected(chapterList[0]); else { // Show the list of chapters. m_nowShowing = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }