public BindableCollection <FactureModel> GetMyUnClearedFacturesWithOldCleared(int id) { BindableCollection <FactureModel> factures = new BindableCollection <FactureModel>(); if (this.Id == 0) { return(null); } else { FactureModel fm = new FactureModel(); string[] value = new string[2] { "number", Id.ToString() }; List <KeyValuePair <string, string[]> > Data = new List <KeyValuePair <string, string[]> > { new KeyValuePair <string, string[]>("customer_id", value) }; value = new string[2] { "number", "0" }; Data.Add(new KeyValuePair <string, string[]>("cleared", value)); List <KeyValuePair <string, string[]> > Union = new List <KeyValuePair <string, string[]> >(); value = new string[2] { "number", id.ToString() }; Union.Add(new KeyValuePair <string, string[]>("id", value)); DataTable full_table = fm.FindByParameters(Data, Union); factures = fm.GiveCollection(full_table); } return(factures); }
/** * Get All factures for this customers if season is null * Get All factures for this customers that have a season if season is -1 * Get All factures in specific season for this customers if season.Id is not 0 * Get All factures that don't belong to a seson for this customers if season.Id is 0 */ public BindableCollection <FactureModel> GetMyFactures(int?season = null) { BindableCollection <FactureModel> factures = new BindableCollection <FactureModel>(); if (this.Id == 0) { return(null); } else { FactureModel fm = new FactureModel(); string[] value = new string[2] { "number", Id.ToString() }; List <KeyValuePair <string, string[]> > Data = new List <KeyValuePair <string, string[]> > { new KeyValuePair <string, string[]>("customer_id", value) }; if (season != null) { switch (season) { case 0: value = new string[2] { "number", "NULL" }; break; case -1: value = new string[2] { "number", "NOT-NULL" }; break; default: value = new string[2] { "number", season.ToString() }; break; } Data.Add(new KeyValuePair <string, string[]>("season_id", value)); } factures = fm.GiveCollection(fm.FindByParameters(Data)); } return(factures); }
/** * Get Un-Clearerd factures for this customers if season is null * Get Un-Clearerd factures in specific season for this customers if season.Id is not 0 * Get Un-Clearerd factures that don't belong to a seson for this customers if season.Id is 0 */ public BindableCollection <FactureModel> GetMyUnClearedFactures(int?season = null) { BindableCollection <FactureModel> factures = new BindableCollection <FactureModel>(); if (this.Id == 0) { return(null); } else { FactureModel fm = new FactureModel(); string[] value = new string[2] { "number", Id.ToString() }; List <KeyValuePair <string, string[]> > Data = new List <KeyValuePair <string, string[]> > { new KeyValuePair <string, string[]>("customer_id", value) }; value = new string[2] { "number", "0" }; Data.Add(new KeyValuePair <string, string[]>("cleared", value)); if (season != null) { if (season != 0) { value = new string[2] { "number", season.ToString() } } ; else { value = new string[2] { "number", "NULL" } }; Data.Add(new KeyValuePair <string, string[]>("season_id", value)); } factures = fm.GiveCollection(fm.FindByParameters(Data)); } return(factures); }