/// <summary> /// ForFiltring Days And Months and years /// </summary> /// <param name="Typesearch"></param> /// <returns></returns> public void FieldDataTables(TypeSearch Typesearch, DataTable data) { List <string> Name = new List <string>(); List <string> NUMF = new List <string>(); List <string> Price = new List <string>(); List <string> Price_a = new List <string>(); List <string> DOW = new List <string>(); List <string> Barcode = new List <string>(); List <string> DAT = new List <string>(); //-=-=- List <string> Name_ = new List <string>(); List <string> NUMF_ = new List <string>(); List <string> Price_ = new List <string>(); List <string> Price_a_ = new List <string>(); List <string> DOW_ = new List <string>(); List <string> Barcode_ = new List <string>(); List <string> DAT_ = new List <string>(); BindingSource Bind = new BindingSource(); if (Typesearch == TypeSearch.Day) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var DayList = new List <string>(); foreach (var item in SealsFunction.GetDays()) { DayList.Add(item);//Add Days For Compairing. } for (int i = 0; i < DayList.Count; i++) { if (SealsFunction.ExtractDaysFromDate() == DayList[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } PrintHelper.Print.Datatable_ = data; PrintHelper.Print.IsDay_ = true; PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsYear_ = false; } else if (Typesearch == TypeSearch.Month) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var Monthlist = new List <string>(); foreach (var item in SealsFunction.GetMonths()) { Monthlist.Add(item);//Add Days For Compairing. } for (int i = 0; i < Monthlist.Count; i++) { if (SealsFunction.ExtractmonthsFromDate() == Monthlist[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } PrintHelper.Print.Datatable_ = data; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsMounth_ = true; PrintHelper.Print.IsYear_ = false; } else if (Typesearch == TypeSearch.SquareYear) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var MonthList = new List <string>(); foreach (var item in SealsFunction.GetMonths()) { MonthList.Add(item);//Add Days For Compairing. } for (int i = 0; i < MonthList.Count; i++) { if (DateTime.Now.Day.ToString() == MonthList[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } } else if (Typesearch == TypeSearch.Year) { DataTable dt = new DataTable(); var GetTables = new OrcDataAcess(); GetTables.show3(dt); foreach (DataRow item in dt.Rows) { Name.Add(item.Field <string>("NAME")); NUMF.Add(item.Field <string>("NUMF")); Price.Add(item.Field <string>("PRICE")); Price_a.Add(item.Field <string>("PRICE_A")); DOW.Add(item.Field <string>("DOW")); Barcode.Add(item.Field <string>("BARCODE")); DAT.Add(item.Field <string>("DAT")); } var yearlist = new List <string>(); foreach (var item in SealsFunction.GetYears()) { yearlist.Add(item);//Add Days For Compairing. } for (int i = 0; i < yearlist.Count; i++) { if (SealsFunction.ExtractyearsFromDate() == yearlist[i]) { Name_.Add(Name[i]); Barcode_.Add(Barcode[i]); Price_.Add(Price[i]); Price_a_.Add(Price_a[i]); DOW_.Add(DOW[i]); DAT_.Add(DAT[i]); NUMF_.Add(NUMF[i]); } } data.Columns.Add("NAME"); data.Columns.Add("NUMF"); data.Columns.Add("PRICE"); data.Columns.Add("PRICE_A"); data.Columns.Add("DOW"); data.Columns.Add("BARCODE"); data.Columns.Add("DAT"); for (int ii = 0; ii < Name_.Count; ii++) { DataRow datarow = data.NewRow(); datarow["NAME"] = Name_[ii]; datarow["NUMF"] = NUMF_[ii]; datarow["PRICE"] = Price_[ii]; datarow["PRICE_A"] = Price_a_[ii]; datarow["DOW"] = DOW_[ii]; datarow["BARCODE"] = Barcode_[ii]; datarow["DAT"] = DAT_[ii]; data.Rows.Add(datarow); } PrintHelper.Print.Datatable_ = data; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsYear_ = true; } }
/* * * ID = item.Field<string>("ID"), * conprou = item.Field<string>("conprou"), * PRICE = item.Field<string>("PRICE"), * DAT = item.Field<string>("DAT"), * NAME = item.Field<string>("NAME"), * datrec = item.Field<string>("datrec"), * discounts = item.Field<string>("discounts"), * typeprou = item.Field<string>("typeprou"), * isdone = (item.Field<Int64>("isdone")) ? GetImage(@"/images/ionicons_2-0-1_ios-timer_23_0_27ae60_none.png") : GetImage(@"/images/material-icons_3-0-1_done_23_0_27ae60_none.png") * * */ public void Create(TypeSearch Type, ObservableCollectionCore <Models.RepairView> data) { var ID = new List <string>(); var conprou = new List <string>(); var PRICE = new List <string>(); var DAT = new List <string>(); var NAME = new List <string>(); var datrec = new List <string>(); var discounts = new List <string>(); var typeprou = new List <string>(); var isdone = new List <bool>(); var ID_ = new List <string>(); var conprou_ = new List <string>(); var PRICE_ = new List <string>(); var DAT_ = new List <string>(); var NAME_ = new List <string>(); var datrec_ = new List <string>(); var discounts_ = new List <string>(); var typeprou_ = new List <string>(); var isdone_ = new List <bool>(); BindingSource bind = new BindingSource(); if (Type == TypeSearch.Day) { DataTable dt = new DataTable(); var gettables = new ModelMega(); gettables.show(dt); foreach (DataRow item in dt.Rows) { ID.Add(item.Field <string>("ID")); conprou.Add(item.Field <string>("conprou")); PRICE.Add(item.Field <string>("PRICE")); DAT.Add(item.Field <string>("DAT")); NAME.Add(item.Field <string>("NAME")); datrec.Add(item.Field <string>("datrec")); discounts.Add(item.Field <string>("discounts")); typeprou.Add(item.Field <string>("typeprou")); isdone.Add(item.Field <Int64>("isdone") == -1); } var daylist = new List <string>(); foreach (var item in GetDays()) { daylist.Add(item); } for (int i = 0; i < daylist.Count; i++) { if (SealsFunction.ExtractDaysFromDate() == daylist[i]) { ID_.Add(ID[i]); conprou_.Add(conprou[i]); PRICE_.Add(PRICE[i]); DAT_.Add(DAT[i]); NAME_.Add(NAME[i]); datrec_.Add(datrec[i]); discounts_.Add(discounts[i]); typeprou_.Add(typeprou[i]); isdone_.Add(isdone[i]); } } var modelmega = new ModelMega(); for (int ii = 0; ii < NAME_.Count; ii++) { //ID_.Add(ID[i]); //conprou_.Add(conprou[i]); //PRICE_.Add(PRICE[i]); //DAT_.Add(DAT[i]); //NAME_.Add(NAME[i]); //datrec_.Add(datrec[i]); //discounts_.Add(discounts[i]); //typeprou_.Add(typeprou[i]); //isdone_.Add(isdone[i]); if (isdone_[ii]) { data.Add(new Models.RepairView() { ID = ID_[ii], conprou = conprou_[ii], DAT = DAT_[ii], datrec = datrec_[ii], discounts = discounts_[ii], isdone = isdone_[ii] , NAME = NAME_[ii], PRICE = PRICE_[ii], typeprou = typeprou_[ii] }); modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii])?-1:0); } //datarow["ID"] = ID_[ii]; //datarow["NAME"] = NAME_[ii]; //datarow["DAT"] = DAT_[ii]; //datarow["datrec"] = datrec_[ii]; //datarow["typeprou"] = typeprou_[ii]; //datarow["PRICE"] = PRICE_[ii]; //datarow["discounts"] = discounts_[ii]; //datarow["conprou"] = conprou_[ii]; //datarow["isdone"] = isdone_[ii]; } } else if (Type == TypeSearch.Year) { DataTable dt = new DataTable(); var gettables = new ModelMega(); gettables.show(dt); foreach (DataRow item in dt.Rows) { ID.Add(item.Field <string>("ID")); conprou.Add(item.Field <string>("conprou")); PRICE.Add(item.Field <string>("PRICE")); DAT.Add(item.Field <string>("DAT")); NAME.Add(item.Field <string>("NAME")); datrec.Add(item.Field <string>("datrec")); discounts.Add(item.Field <string>("discounts")); typeprou.Add(item.Field <string>("typeprou")); isdone.Add(item.Field <Int64>("isdone") == -1); } var daylist = new List <string>(); foreach (var item in GetYears()) { daylist.Add(item); } for (int i = 0; i < daylist.Count; i++) { if (SealsFunction.ExtractyearsFromDate() == daylist[i]) { ID_.Add(ID[i]); conprou_.Add(conprou[i]); PRICE_.Add(PRICE[i]); DAT_.Add(DAT[i]); NAME_.Add(NAME[i]); datrec_.Add(datrec[i]); discounts_.Add(discounts[i]); typeprou_.Add(typeprou[i]); isdone_.Add(isdone[i]); } } var modelmega = new ModelMega(); for (int ii = 0; ii < NAME_.Count; ii++) { if (isdone_[ii]) { data.Add(new Models.RepairView() { ID = ID_[ii], conprou = conprou_[ii], DAT = DAT_[ii], datrec = datrec_[ii], discounts = discounts_[ii], isdone = isdone_[ii] , NAME = NAME_[ii], PRICE = PRICE_[ii], typeprou = typeprou_[ii] }); modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii]) ? -1 : 0); } } } else if (Type == TypeSearch.Month) { DataTable dt = new DataTable(); var gettables = new ModelMega(); gettables.show(dt); foreach (DataRow item in dt.Rows) { ID.Add(item.Field <string>("ID")); conprou.Add(item.Field <string>("conprou")); PRICE.Add(item.Field <string>("PRICE")); DAT.Add(item.Field <string>("DAT")); NAME.Add(item.Field <string>("NAME")); datrec.Add(item.Field <string>("datrec")); discounts.Add(item.Field <string>("discounts")); typeprou.Add(item.Field <string>("typeprou")); isdone.Add(item.Field <Int64>("isdone") == -1); } var daylist = new List <string>(); foreach (var item in GetMonths()) { daylist.Add(item); } for (int i = 0; i < daylist.Count; i++) { if (SealsFunction.ExtractmonthsFromDate() == daylist[i]) { ID_.Add(ID[i]); conprou_.Add(conprou[i]); PRICE_.Add(PRICE[i]); DAT_.Add(DAT[i]); NAME_.Add(NAME[i]); datrec_.Add(datrec[i]); discounts_.Add(discounts[i]); typeprou_.Add(typeprou[i]); isdone_.Add(isdone[i]); } } var modelmega = new ModelMega(); for (int ii = 0; ii < NAME_.Count; ii++) { if (isdone_[ii]) { data.Add(new Models.RepairView() { ID = ID_[ii], conprou = conprou_[ii], DAT = DAT_[ii], datrec = datrec_[ii], discounts = discounts_[ii], isdone = isdone_[ii] , NAME = NAME_[ii], PRICE = PRICE_[ii], typeprou = typeprou_[ii] }); modelmega.add1(ID_[ii], NAME_[ii], PRICE_[ii], DAT[ii], datrec_[ii], conprou_[ii], typeprou_[ii], discounts_[ii], (isdone_[ii]) ? -1 : 0); } } } }