public CustomizableFieldsControl(OCustomizableFieldEntities entity, int?linkId, bool showUpdateButton) { InitializeComponent(); _entity = entity; if (linkId.HasValue) { _linkId = linkId.Value; panelUpdate.Visible = showUpdateButton; } switch (_entity) { case OCustomizableFieldEntities.Loan: _entityType = 'L'; break; case OCustomizableFieldEntities.Savings: _entityType = 'S'; break; default: _entityType = 'C'; break; } _advancedFields = new CustomClass(); _advancedFieldsCollections = new CollectionList(); LoanAdvancedCustomizableFields(); }
protected void Page_Load(object sender, EventArgs e) { //every time the page is processed (submitted to the // web server) this method is the FIRST event // that is processed that you can easily see and // interaction with. //this is a great place to do common code that is // required on each process of the page //Example: empty out old messages //every control on your web form is a class instance //every control has an ID property //every control must have a unique name //the ID value is used to reference the control in // your code behind //since controls are instances of a class, all rules // of OOP apply MessageLabel.Text = ""; //the web page has a flag that can be checked to see // if the web page is posting back if (!Page.IsPostBack) { //if the page is not PostBack, it means that this // is the first time the page has been displayed //you can do page initialization by testing the // IsPostBack //Create a List<T> where T is a class that has // 2 columns: a value and a text display List <DDLData> DataCollection = new List <DDLData>(); DataCollection.Add(new DDLData(1, "COMP1008")); DataCollection.Add(new DDLData(3, "DMIT1508")); DataCollection.Add(new DDLData(4, "DMIT2018")); DataCollection.Add(new DDLData(2, "CPSC1517")); //sorting a List<T> // (x,y) are placeholders for 2 records at any given time in the sort // => (lamda symbol) is part of the delegate syntax, read as "do the following" // comparing x to y is ascending // comparing y to x is descendinng DataCollection.Sort((x, y) => x.displayField.CompareTo(y.displayField)); //place the data into the dropdownlist control //a) assign the data collection to the "list" control CollectionList.DataSource = DataCollection; //b) this step is required for specific "list" controls //indicate which data value is to be assigned to the Value field and the Display text field //there are different styles in assigning this information CollectionList.DataValueField = "valueField"; CollectionList.DataTextField = nameof(DDLData.displayField); //don's preference //c)bind your data to the actual control CollectionList.DataBind(); //d)OPTIONALLY you can place a prompt line on your control CollectionList.Items.Insert(0, new ListItem("select....", "0")); } }
public StaticPagedList <CollectionList> CollectionGridList(int?page, String Name = "", int Paid = 0) { FinanceDbContext _db = new FinanceDbContext(); var pageIndex = (page ?? 1); const int pageSize = 10; int totalCount = 10; CollectionList clist = new CollectionList(); IEnumerable <CollectionList> result = _db.CollectionList.SqlQuery(@"exec GetCollectionList @pPageIndex, @pPageSize,@Name,@paidStatus", new SqlParameter("@pPageIndex", pageIndex), new SqlParameter("@pPageSize", pageSize), new SqlParameter("@Name", Name == null ? (object)DBNull.Value : Name), new SqlParameter("@paidStatus", Paid) ).ToList <CollectionList>(); totalCount = 0; if (result.Count() > 0) { totalCount = Convert.ToInt32(result.FirstOrDefault().TotalRows); } var itemsAsIPagedList = new StaticPagedList <CollectionList>(result, pageIndex, pageSize, totalCount); return(itemsAsIPagedList); }
/// <summary> /// 全削除コマンドを実行する /// </summary> /// <param name="someBook"></param> private void DelAllCommandExecute() { books.DelAll(); DataBaseManager.DelAllDataBase(); CollectionList.Clear(); }
/// <summary> /// 追加コマンドを実行する /// </summary> private void AddCommandExecute() { Book addBook = new Book(books.GetList().Count + 1, Book.Title, Book.Author, Book.Price); books.Add(addBook); CollectionList.Add(addBook); }
protected void Page_Load(object sender, EventArgs e) { //this method will execute on EACH and EVERY post back //to this page. //this method will execute on the first display of this page //To determine if the page is new or postback use IsPostBack property //this method is often used as a general method to reset //fields or controls at the start of the page processing //The label MessageLabel is used to display messages to the user //Old messages should be remove from this control on each pass //How does one reference a control on the .aspx form //To reference a form control, use the control ID name //EACH control is an object. THEREFORE alter a PROPERTY value. MessageLabel.Text = ""; //Determine if this is the first display of the page // and if so, load data into the dropdownlist if (!Page.IsPostBack) { //Create an instance of List<T> for my "fake database" data DataCollection = new List <DDLClass>(); //add data to the collection, one entry at a time DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "DMIT1508")); DataCollection.Add(new DDLClass(3, "CPSC1517")); DataCollection.Add(new DDLClass(4, "DMIT2018")); //usually lists are sorted //The List<T> has a .Sort() behaviour (method) //(x,y) represents any two entries in the data collection at any point in time // the lamda symbol => basically means "do the following" //.CompareTo() is a method that will compare to items and return the result // of comparing two items. The result is interpreted by the Sort() to // to determine if the order needs to be changed. // x vs y is ascending // y vs x is descending DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //place the collection into the dropdownlist //a) assign the collection to the control (ID=CollectionList) CollectionList.DataSource = DataCollection; //b)assign the value and display portions of the dropdownlist // to specify properties of the data class CollectionList.DataTextField = nameof(DDLClass.DisplayField); CollectionList.DataValueField = nameof(DDLClass.ValueField); //c)Bind the data to the collection (physical attachment) CollectionList.DataBind(); //d)You may wish to add a prompt line at the beginning of the // list of data within the dropdownlist CollectionList.Items.Insert(0, "select..."); } }
protected void Page_Load(object sender, EventArgs e) { //this method executes BEFORE any event method on EACH processing of this web page //this is a great place to do common code that is required on EACH process of the page //Example: empty out old messages Messagelabel.Text = ""; //this is an excellent place to do page initilization of controls for the first time //checking the first time for the page uses the post back flag //IsPostBack is a boolean value (true or false) if (!Page.IsPostBack) { //if the page if not PostBack, it meanss that this if the first time the page has been displayed //you can do page initalization //create a collection of instances (class objects) that will be used to load the dropdownlist //this will simulate the loading control as if the data can from a databases table //each instance would represent a record on the database dataset //to acomplish this simulation List <DDLData> DDLCollection = new List <DDLData>(); DDLCollection.Add(new DDLData(1, "COMP1008")); DDLCollection.Add(new DDLData(3, "DMIT1508")); DDLCollection.Add(new DDLData(4, "DMIT2018")); DDLCollection.Add(new DDLData(2, "CPSC1517")); //place the data into the dropdownlist control //4 steps to this process //1) assign the data collection to the contorl CollectionList.DataSource = DDLCollection; //2) in this step, you will assign the value that will be displayed to the user and the value that will be associated //and return from the control when the user picks a particular selection //in the <select> control, this data was setup using the <option> // <option value = "xxx"> display string </option> //2 styles in setting up the control values //A) a physical string of the field name CollectionList.DataValueField = "ValueID"; //B) OOP style coding CollectionList.DataTextField = nameof(DDLData.DisplayText); //3) bind your data source to your control CollectionList.DataBind(); //4) optional is to add a prompt list to your dropdownlist CollectionList.Items.Insert(0, new ListItem("select...", "0")); //sorting a List<T> //(x,y) are place holder representing any 2 records at any given time druing the sort //=> (lamda symbol) is part of the delegate syntax, I suggest that you read this symbol as "do the following" //comparing x to y is ascending //comparing y to x is descending DDLCollection.Sort((x, y) => x.DisplayText.CompareTo(y.DisplayText)); } }
private void Remove_Click(object sender, RoutedEventArgs e) { var i = ListVeiw.SelectedItem as int?; if (i.HasValue) { CollectionList.Remove(i.Value); } }
private void ClearCollectionsProc() { CollectionList.Clear(); Points.Clear(); TrapList[0].NoOfCaughtMosquitoes = 0; TrapList[1].NoOfCaughtMosquitoes = 0; TrapList[2].NoOfCaughtMosquitoes = 0; TotalMales = 0; TotalFemales = 0; }
/// <summary> /// 追加コマンドを実行する /// </summary> private void AddCommandExecute() { Book addBook = new Book(DataBaseManager.GetIDNextData(), Book.Title, Book.Author, Book.Price); books.Add(addBook); DataBaseManager.AddDataBase(addBook); CollectionList.Add(addBook); }
protected void Page_Load(object sender, EventArgs e) { //this method is excuted automatically on each and every pass of the page (~kinda like IsPost) //this method is executed BEFORE any event method on this page //clear any old messages OutputMessage.Text = ""; //this method is an excellant place to do page initialization //you can test to post back on the page (IsPost) // by checking Page.IsPostBack property if (!Page.IsPostBack) { //the first time the page is processed //create an intance of out list<t> DataCollection = new List <DDLClass>(); //load the collection with a series of DDLCLASS instances //create the instances using the greedy constuctor DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(3, "DMIT2018")); DataCollection.Add(new DDLClass(4, "DMIT1508")); //use the list<t> method called .Sort to sort the contents of the list // (x,y) the x and y represent two instances at any time in your collection // x.field compared to y.field (ascending) // y.field compared to x.field (decending) DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //load the datacollection to the asp control you are interested in // we are using the DropDownList //a) assign you DataCollection to the control CollectionList.DataSource = DataCollection; //b) setup any necessary properties on your ASP control that are required to work //the dropdown list will generate the html select tag code // thus we need two properties to be set // i)the value property DataValueField // ii)the display property DataTextField // the properties are set up by assigning the dataCollection field name to teh control property CollectionList.DataValueField = "ValueField"; CollectionList.DataTextField = nameof(DDLClass.DisplayField); // C) BIND your data to the control CollectionList.DataBind(); // what about prompts? // manually place a line item at the beginning of your control CollectionList.Items.Insert(0, "select..."); } }
public IActionResult GetCollectionListHistoricoPedidos([FromBody] List <FilterCriteria> filter, [FromQuery(Name = "pi")] int pageIndex, [FromQuery(Name = "ps")] int pageSize, [FromQuery(Name = "sn")] string sortName, [FromQuery(Name = "sd")] bool sortDescending) { var result = hBS.GetCollectionList(filterArr: filter, pageIndex: pageIndex, pagesize: pageSize, sortName: sortName, sortDescending: sortDescending); CollectionList <HistoricoPedido_View> lista = new CollectionList <HistoricoPedido_View>() { Total = result.Total, Items = result.Items.Select(o => new HistoricoPedido_View(o)) }; return(Ok(lista)); }
public IActionResult GetCollectionListCustomerRates([FromBody] List <FilterCriteria> filter, [FromQuery(Name = "pi")] int pageIndex, [FromQuery(Name = "ps")] int pageSize, [FromQuery(Name = "sn")] string sortName, [FromQuery(Name = "sd")] bool sortDescending) { CollectionList <CustomerRate> lista = cBS.GetCollectionList(filterArr: filter, pageIndex: pageIndex, pagesize: pageSize, sortName: sortName, sortDescending: sortDescending); CollectionList <CustomerRate_View> result = new CollectionList <CustomerRate_View>() { Items = lista.Items.Select(o => new CustomerRate_View(o)), Total = lista.Total }; return(Ok(result)); }
public IActionResult GetCollectionListAlmacenZPs([FromBody] List <FilterCriteria> filter, [FromQuery(Name = "pi")] int pageIndex, [FromQuery(Name = "ps")] int pageSize, [FromQuery(Name = "sn")] string sortName, [FromQuery(Name = "sd")] bool sortDescending, [FromQuery] string almacen, [FromQuery] string zona) { var result = aBS.GetCollectionListAlmacenes(almacen: almacen, zona: zona, filterArr: filter, pageIndex: pageIndex, pagesize: pageSize, sortName: sortName, sortDescending: sortDescending); CollectionList <AlmacenZP_View> lista = new CollectionList <AlmacenZP_View>() { Items = result.Items.Select(o => new AlmacenZP_View(o)), Total = result.Total }; return(Ok(lista)); }
/// <summary> /// 削除コマンドを実行する /// </summary> /// <param name="someBook"></param> private void DelCommandExecute(Book someBook) { books.Del(someBook); CollectionList.Clear(); foreach (var book in books.GetList()) { CollectionList.Add(book); } }
public IActionResult GetCollectionListPedVentaCabsReadingDate([FromBody] List <FilterCriteria> filter, [FromQuery(Name = "pi")] int pageIndex, [FromQuery(Name = "ps")] int pageSize, [FromQuery(Name = "sn")] string sortName, [FromQuery(Name = "sd")] bool sortDescending, [FromQuery(Name = "rd")] DateTimeOffset readingDate, [FromQuery(Name = "rdf")] string readingDateFilter) { var result = pBS.GetCollectionListReadingDate(filterArr: filter, pageIndex: pageIndex, pagesize: pageSize, sortName: sortName, sortDescending: sortDescending, readingDate: readingDate, filterReadingDate: readingDateFilter); CollectionList <PedVentaCab_View> lista = new CollectionList <PedVentaCab_View>() { Total = result.Total, Items = result.Items.Select(o => new PedVentaCab_View(o)) }; return(Ok(lista)); }
protected void Page_Load(object sender, EventArgs e) { //this event method is executed EACH and EVERY time // this page is processed //this event method is executed BEFORE ANY EVENT method is processed //clear out all old message OutputMessage.Text = ""; //this page is an excellent place to do page initialization // of your controls. //there is a property to test for post back of your // page called Page.IsPostBack (Razor: IsPost) if (!Page.IsPostBack) { //do 1st page initialization processing //create an instance of the data collection list DataCollection = new List <DDLClass>(); //load the data collection with dummy data //normally this data would come from your database DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(3, "DMIT2018")); DataCollection.Add(new DDLClass(4, "DMIT1508")); //to sort a List<T> use the method .Sort() //(x,y) x and y represent any two instances in your list at any time //x.field compared to y.field : ascending //y.field compared to x.field : descending DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //setup the dropdownlist (radiobuttonlist, checkboxlist) //a) assign your data to the control CollectionList.DataSource = DataCollection; //b) assign the data list field names to // the appropriate control properties // i) .DataValueField this is the value of the select option // ii) .DataTextField this is the display of the select option CollectionList.DataValueField = "ValueField"; CollectionList.DataTextField = nameof(DDLClass.DisplayField); //c) phyiscally bind the data to the control for show CollectionList.DataBind(); //what about a prompt? //one can add a prompt to the start of the BOUND control list //one will use the index 0 to position the prompt CollectionList.Items.Insert(0, "select ...."); } }
public Task <Library.Models.Pagination.PagedResult <CollectionList> > List(User roadieUser, PagedRequest request, bool?doRandomize = false, Guid?releaseId = null, Guid?artistId = null) { var sw = new Stopwatch(); sw.Start(); IQueryable <data.Collection> collections = null; if (artistId.HasValue) { var sql = @"select DISTINCT c.* from `collectionrelease` cr join `collection` c on c.id = cr.collectionId join `release` r on r.id = cr.releaseId join `artist` a on r.artistId = a.id where a.roadieId = {0}"; collections = this.DbContext.Collections.FromSql(sql, artistId); } else if (releaseId.HasValue) { var sql = @"select DISTINCT c.* from `collectionrelease` cr join `collection` c on c.id = cr.collectionId join `release` r on r.id = cr.releaseId where r.roadieId = {0}"; collections = this.DbContext.Collections.FromSql(sql, releaseId); } else { collections = this.DbContext.Collections; } var result = (from c in collections where (request.FilterValue.Length == 0 || (request.FilterValue.Length > 0 && c.Name.Contains(request.Filter))) select CollectionList.FromDataCollection(c, (from crc in this.DbContext.CollectionReleases where crc.CollectionId == c.Id select crc.Id).Count(), this.MakeCollectionThumbnailImage(c.RoadieId))); var sortBy = string.IsNullOrEmpty(request.Sort) ? request.OrderValue(new Dictionary <string, string> { { "Collection.Text", "ASC" } }) : request.OrderValue(null); var rowCount = result.Count(); var rows = result.OrderBy(sortBy).Skip(request.SkipValue).Take(request.LimitValue).ToArray(); sw.Stop(); return(Task.FromResult(new Library.Models.Pagination.PagedResult <CollectionList> { TotalCount = rowCount, CurrentPage = request.PageValue, TotalPages = (int)Math.Ceiling((double)rowCount / request.LimitValue), OperationTime = sw.ElapsedMilliseconds, Rows = rows })); }
protected void Page_Load(object sender, EventArgs e) { //This method is executed automatically on EACH and EVERY pass of the page. //This method is executed BEFORE ANY EVENT method on this page. //clear any old messages OutputMessage.Text = ""; //This method is an excellent place to do page initialization. //You can test the postback of the page (Razor IsPost) by checking the Page.IsPostBack property. if (!Page.IsPostBack) { //The first time the page is proccessed. //Create an instance of the list of T. DataCollection = new List <DDLClass>(); //Load the collection with a series of DDLClass instances. Create the instances using the greedy constructor. DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(3, "DMIT2018")); DataCollection.Add(new DDLClass(4, "DMIT1508")); //When we use db's, this is the only thing that will be replaced. //Use the List<T> method called .Sort to sort the contents of the list. //(x,y) the x and y represent any 2 instances at any time in your collection. //x.field compared to y.field (ascending) //y.field compared to x.field (descending) DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //=> is a Lambda expression, don't mix it up with >=! //=> Means for X and Y, /do the following/, then specify what you want done. //Load your data collection to the ASP control you are interested in: DropDownList //Could also be done to a radio button list dynamically. //A) Assign your data collection to the control. CollectionList.DataSource = DataCollection; //B) Setup any neccessary properties on your ASP control that are required to properly work. //The dropdownlist will generate the HTML select tag code. Thus we need 2 properties to be set. //i) Value property (DataValueField) //ii) Display property (DataTextField) //The properties are set up by assigning the data collection field name to the control property. CollectionList.DataValueField = "ValueField"; CollectionList.DataTextField = nameof(DDLClass.DisplayField); //A way to do it without hardcoding the value. //C) Bind your data to the control. CollectionList.DataBind(); //What about prompts? Manually place a line item at the beginning of your control. CollectionList.Items.Insert(0, "select ..."); } }
private async void SetupRealm() { _realm = await NoInternetVM.IsConnectedOnMainPage("matches"); EventList = _realm.All <EventModel>().Where(data => data.MatchId == Match.Id); CommentList = _realm.All <CommentModel>().Where(data => data.MatchId == Match.Id); CollectionList.Add(new ObservableCollectionsVM { CollectionList = EventList, ListSwitch = true }); CollectionList.Add(new ObservableCollectionsVM { CollectionList = CommentList, ListSwitch = false }); }
protected void Page_Load(object sender, EventArgs e) { //This method will execute on each and every Postback to this page. //This menthod will execute on the first display of this page //To determine if the page is new or postback, use PostBack Property. //This method is often used as a general method to reset fields or controls at the start of the page processing. //E.g. The label MessageLabel is used to display messages to the user. Old messages should be removed from this control on each pass // How does one reference a control on the .aspx form? //To reference a form control, use the control ID name //EACH CONTROL IS AN OBJECT. Therefore, ALTER A PROPERTY VALUE MessageLabel.Text = ""; //Determine if this is the first display of the page, and if so, load data into the dropdownlist if (!Page.IsPostBack) { //Create an instance of List<T> for my "Fake Database Data" DataCollection = new List <DDLClass>(); //Add data to the collection, one entry at a time DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(3, "DMIT1508")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(4, "DMIT2018")); //usually lists are sorted //The List<T> has a .Sort() behavior (method) //(x,y) represent any two entries in the data collection at any point in time //The landa symbol "=>" : basically means do the following //.CompareTo() : is a method that would compare 2 items and return the result of the comparison. //The result is interpreted by the Sort() to determine if the order needs to be changed. // x vs y is ascending // y vs x is descending DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //Place the collection into the dropdown list //a) assign the collection to the control (CollectionList) CollectionList.DataSource = DataCollection; //b) assign the value and display portions of the dropdownlist to specific properties of the data class CollectionList.DataTextField = nameof(DDLClass.DisplayField); CollectionList.DataValueField = nameof(DDLClass.ValueField); //c) Bind the data to the collection (physical attachment) CollectionList.DataBind(); //d) you may wish to add a prompt line at the beginning of the list of data within the dropdownlist CollectionList.Items.Insert(0, "Select..."); } }
protected void Page_Load(object sender, EventArgs e) { //Page_Load executes EACH AND EVERY time there is a posting // to this page //Page_Load is executed before any submit events //this method is an excellent place to do form initialization //you can test your postings using Page.IsPostBack //IsPostBack is the same item as IsPost in our Razor forms if (!Page.IsPostBack) { //this code will be executed only on the first pass // to this page //create an instance for the static data collection DataCollection = new List <DDLClass>(); //Add instances to this collection using the DDLClass // greedy constructor DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(3, "DMIT2018")); DataCollection.Add(new DDLClass(4, "DMIT1508")); //sorting a list<t> //use the .Sort() method //(x,y) this represents any two items in your list //compare x.Field to y.Field, ascending order //compare y.Field to x.Field, descending order DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //put the data collection into the drop down list //a) assign the collection to the controls dataSource CollectionList.DataSource = DataCollection; //b) assign the field names to the properties of the // drop down list for data association //DataValueField represents the value of the item //DataTextField represents the display of the line item CollectionList.DataValueField = "ValueField"; CollectionList.DataTextField = nameof(DDLClass.DisplayField); //c) bind the data to the web control CollectionList.DataBind(); //can one put a prompt on the drop down list control? // short answer: yes CollectionList.Items.Insert(0, "select..."); } }
private bool RemoveCollection() { //todo: change location string path = RetroFE.GetAbsolutePath() + "/Launchers/" + SelectedCollection.Name + ".conf"; if (File.Exists(path)) { File.Delete(path); } CollectionList.Remove(SelectedCollection); return(true); }
protected void Page_Load(object sender, EventArgs e) { //if you need to reset fields on each pass (process) of the page // you can do it here //page initialization can be done here under the IsPostBack flag //the ID= attribute on your control is the name that is use in // your code to reference the control //the ID= name is unique to the form //each control is an object and behaves as an object MessageLabel.Text = ""; //the test for posting a form back to the web server is IsPostBack if (!Page.IsPostBack) { //load the DropDownList (DDL) only on the first pass of the page //In this example a locally create List<T> will act // as the data source for the DDL DataCollection = new List <DDLClass>(); //add instances to the list DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "DMIT1508")); DataCollection.Add(new DDLClass(3, "CPSC1517")); DataCollection.Add(new DDLClass(4, "DMIT2018")); //place the data in the DDL in alphabetic order (ascending) //(x,y) represent any two rows in the collection DataCollection //Compare x.DisplayField to y.DisplayField, ascending //Compare y.DisplayField to x.DisplayField, descending DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //to place a collection into the DDL control we need to do 4 steps //a) assign the collection to the control's DataSource property CollectionList.DataSource = DataCollection; //b) assign field names to the properties DataTextField and DataValueField //the DataTextField contents the data seen by the user //the DataValueField is the data returned by the control on access* CollectionList.DataTextField = "DisplayField"; CollectionList.DataValueField = "ValueField"; //c) Bind the information and data to your control CollectionList.DataBind(); //d) optional, assign a prompt to your control //such that it appears before the data CollectionList.Items.Insert(0, "select...."); } }
void AddCollection() { Collection collection = new() { Title = "New friggin collection", Type = "Game" }; CollectionList.Add(collection); } bool AddCollectionCanExecute() { return(MainBigSelection == CollectionList); }
protected void Page_Load(object sender, EventArgs e) { //this method is executed each and every time you process this webpage //this method executes before the event method //this method is an excellent place to do initial form setup //this method is an excellent place to change any control that may need to be done for the same action under all events //example - clearing old messages // a control is referenced in the code-behind by using its ID="controlname" //Control names are global to all events MessageLabel.Text = ""; //Assume you wish to do page intialization of some type but only one when the page is first loaded if (!Page.IsPostBack) { DataCollection = new List <DDLClass>(); //load collection using greedy constructor and load to the list DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(3, "DMIT1508")); DataCollection.Add(new DDLClass(4, "DMIT2018")); //List<T> can be sorted using .Sort(Delegate) Depending on your method, the delegate will be different. //syntax for delegate // (x,y) => x.PropertyName.CompareTo(y.PropertyName) DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //attach the data to the dropdownlist control //attach data CollectionList.DataSource = DataCollection; //assign the display text property to the ddl control - there are a couple of ways //way THE FIRST CollectionList.DataTextField = "DisplayField"; //WAY THE SECOND //assign the value data property to the ddl control CollectionList.DataValueField = nameof(DDLClass.ValueField); //then do the databind thing CollectionList.DataBind(); //optionally add a prompt line CollectionList.Items.Insert(0, "Select ..."); } }
protected void Page_Load(object sender, EventArgs e) { //page load executes each and every time there is a posting to this page //page load is executed before any submit events //this method is and exelent place to do form initialization // you can test your postings using Page.IsPostBack //page.IsPostBack is the same as IsPost in our razor if (!Page.IsPostBack) { //this code will be executed only on the first pass to this page //create an instance for the static data collection DataCollection = new List <DDLClass>(); //Add instances to this collection using the DDL gready constructor DataCollection.Add(new DDLClass(1, "COMP1008")); DataCollection.Add(new DDLClass(2, "CPSC1517")); DataCollection.Add(new DDLClass(3, "DMIT2018")); DataCollection.Add(new DDLClass(4, "DMIT1508")); //Sorting a list of <T> //using the .Sort() method //(x,y) this represents any two items in your list //Compare x.Field to y.Field; acending //Compare y.field to x.field; decending DataCollection.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //put the data collection into the dropdown list //a) assign the collection to the controls DataSource CollectionList.DataSource = DataCollection; //b) assign the field names to the properties of the drop down list for data association //data value field represents the value of the item //data text value represents the display value of the line item CollectionList.DataValueField = "ValueField"; CollectionList.DataTextField = "DisplayField"; //CollectionList.DataTextField = nameof(DDLClass.DisplayField); //c) bind the data to the web control //NOTE: this statment is NOT required in a windows form application CollectionList.DataBind(); //Can one put a promt on their drop down list control //yes CollectionList.Items.Insert(0, "select ..."); } }
public void Load() { Debug.Log("CERN archive loading from path: " + jsonPath); if (loadImages) { images = LoadJson <ImageList>(jsonPath + "/files.json"); images.PrepareData(); Debug.Log("CERN Images loaded: " + images.items.Length); } if (loadRecords) { records = LoadJson <RecordList>(jsonPath + "/records.json"); records.PrepareData(); Debug.Log("CERN Records loaded: " + records.items.Length); } if (loadAuthors) { authors = LoadJson <AuthorList>(jsonPath + "/authors.json"); authors.PrepareData(); Debug.Log("CERN Authors loaded: " + authors.items.Length); } if (loadKeywords) { keywords = LoadJson <KeywordList>(jsonPath + "/keywords.json"); keywords.PrepareData(); Debug.Log("CERN Keywords loaded: " + keywords.items.Length); } if (loadSubjects) { subjects = LoadJson <SubjectList>(jsonPath + "/subjects.json"); subjects.PrepareData(); Debug.Log("CERN Subjects loaded: " + subjects.items.Length); } if (loadCopyrightHolders) { copyrightHolders = LoadJson <CopyrightHolderList>(jsonPath + "/copyright.json"); copyrightHolders.PrepareData(); Debug.Log("CERN CopyrightHolders loaded: " + copyrightHolders.items.Length); } if (loadCollections) { collections = LoadJson <CollectionList>(jsonPath + "/collections.json"); collections.PrepareData(); Debug.Log("CERN Collections loaded: " + collections.items.Length); } dataLoaded = true; }
public MainWindowViewModel() { Stopwatch watch = Stopwatch.StartNew(); MainBigList = new ObservableCollection <object> { (releaseCollection = new AutoFilterReleases(R.Data.Releases.Local, "Releases")), (gameCollection = new AutoFilterGames(R.Data.Games.Local, "Games")), (platformCollection = new AutoFilterPlatforms(R.Data.Platforms.Local, "Platforms")), (emulatorCollection = new AutoFilterEmulators(R.Data.Emulators.Local, "Emulators")), (CollectionList = new CollectionList("Collections")) }; Reporter.Report($"Filters created: {watch.Elapsed.TotalSeconds:f1}"); InitializeCommands(); }
public void Test_employee_iteartor_list() { ICollectionEmployee collection = new CollectionList(); collection.AddEmployee(new Employee(name: "Anurag", id: 100)); collection.AddEmployee(new Employee(name: "Pranaya", id: 101)); collection.AddEmployee(new Employee(name: "Santosh", id: 102)); collection.AddEmployee(new Employee(name: "Priyanka", id: 103)); collection.AddEmployee(new Employee(name: "Abinash", id: 104)); collection.AddEmployee(new Employee(name: "Preety", id: 105)); collection.AddEmployee(new Employee(name: "Kappaa", id: 106)); Assert.That(collection.Count() == 7); IIteratorEmployee iterator = collection.CreateIterator(); Employee employee = null; { employee = iterator.First(); Assert.That(employee.Name, Is.EqualTo("Anurag")); Assert.That(employee.ID, Is.EqualTo(100)); } { employee = iterator.Next(); Assert.That(employee.Name, Is.EqualTo("Pranaya")); Assert.That(employee.ID, Is.EqualTo(101)); employee = iterator.Next(); Assert.That(employee.Name, Is.EqualTo("Santosh")); Assert.That(employee.ID, Is.EqualTo(102)); employee = iterator.Next(); employee = iterator.Next(); employee = iterator.Next(); Assert.That(employee.Name, Is.EqualTo("Preety")); Assert.That(employee.ID, Is.EqualTo(105)); } { employee = iterator.First(); Assert.That(employee.Name, Is.EqualTo("Anurag")); Assert.That(employee.ID, Is.EqualTo(100)); } }
public ContractCollateralForm(CollateralProduct product, IExtensionActivator extensionActivator) { _extensionActivator = extensionActivator; this.product = product; contractCollateral = new ContractCollateral(); myProperties = new CustomClass(); collections = new CollectionList(); InitializeComponent(); FillCollateralProperties(); }
public CollectionListTests() { var mongoDatabaseMock = new Mocks.MongoDatabase("DATABASENAME"); CollectionList = new CollectionList(mongoDatabaseMock); }
public ContractCollateralForm(CollateralProduct product) { this.product = product; contractCollateral = new ContractCollateral(); myProperties = new CustomClass(); collections = new CollectionList(); InitializeComponent(); FillCollateralProperties(); }
public ContractCollateralForm(CollateralProduct product, ContractCollateral contractCollateral, bool isView) { this.product = product; this.contractCollateral = contractCollateral; myProperties = new CustomClass(); collections = new CollectionList(); InitializeComponent(); FillCollateralPropertyValues(contractCollateral); if(isView) { propertyGrid.Enabled = false; groupBoxOwnerDetails.Enabled = false; buttonSave.Enabled = false; } }