public TestRTDViewModel() { Data = new ObservableCollectionCore <RTDItem>(); Data.Add(RTDItem.CreateItem()); Stations = new ObservableCollectionCore <RTDStation>(); Stations.Add(new RTDStation() { StationNo = "一工位", StationName = "尾气检测" }); Stations.Add(new RTDStation() { StationNo = "二工位", StationName = "测重检测" }); Stations.Add(new RTDStation() { StationNo = "三工位", StationName = "外廓检测" }); Stations.Add(new RTDStation() { StationNo = "四工位", StationName = "灯光检测" }); UpdataCP(CP); CPS.Add(CP); CP2 = new ControlParameter(); DI.Param1 = new Random(Guid.NewGuid().GetHashCode()).Next(0, 100).ToString(); DI.Param2 = new Random(Guid.NewGuid().GetHashCode()).Next(0, 100).ToString(); DI.Param3 = new Random(Guid.NewGuid().GetHashCode()).Next(0, 100).ToString(); }
public ObservableCollectionCore <Clients> Other(string name) { var ID = new List <string>(); var NAME = new List <string>(); var NUM = new List <Int64>(); DataTable dt = new DataTable(); var Getdata = new Assest.OrcDataAcess2(); Getdata.Show(dt); foreach (DataRow item in dt.Rows) { NAME.Add(item.Field <String>("NAME")); NUM.Add(item.Field <Int64>("NUM")); ID.Add(item.Field <String>("ID")); } ObservableCollectionCore <Clients> sales = new ObservableCollectionCore <Clients>(); for (int i = 0; i < NAME.Count; i++) { if (NAME[i].Contains(name)) { sales.Add(new Clients() { ID = ID[i], NAME = NAME[i], NUM = NUM[i] }); } } return(sales); }
private void Encode1_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) { var obr = new ObservableCollectionCore <Models.RepairView>(); var megaView = new MegaView(); foreach (DataRow item in megaView.GetAllItemsHasSold().Rows) { obr.Add(new Models.RepairView() { 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") == -1 ? true:false) }); } switch (Encode1.Text) { case "/m": { ZMounth(); break; } case "/d": { Zday(); break; } case "/y": { Zyear(); break; } default: { DDR.ItemsSource = obr; Resultpri_a.Text = Fos.sumPrice_a(); break; } } }
private void NewModel(type_of_date date) { if (date == type_of_date.day) { var obr = new ObservableCollectionCore <Models.RepairView>(); System.Windows.Forms.BindingSource BB = new System.Windows.Forms.BindingSource(); DataTable HGF = new DataTable(); var Repa = new RepairVIEW(); Repa.Create(TypeSearch.Day, obr); } else if (date == type_of_date.month) { var obr = new ObservableCollectionCore <Models.RepairView>(); System.Windows.Forms.BindingSource BB = new System.Windows.Forms.BindingSource(); DataTable HGF = new DataTable(); var Repa = new RepairVIEW(); Repa.Create(TypeSearch.Month, obr); } else if (date == type_of_date.year) { var obr = new ObservableCollectionCore <Models.RepairView>(); System.Windows.Forms.BindingSource BB = new System.Windows.Forms.BindingSource(); DataTable HGF = new DataTable(); var Repa = new RepairVIEW(); Repa.Create(TypeSearch.Year, obr); } }
public DXWindow1() { InitializeComponent(); MyProperty = new ObservableCollectionCore <Process>(); foreach (var item in (Process.GetProcesses().OrderBy(x => x.MainWindowTitle).ToList())) { MyProperty.Add(item); } MyProperty.OrderBy(x => x.MainWindowTitle); DataContext = this; }
private void Zyear() { var obr = new ObservableCollectionCore <Models.RepairView>(); System.Windows.Forms.BindingSource BB = new System.Windows.Forms.BindingSource(); var Repa = new RepairVIEW(); Repa.Create(TypeSearch.Year, obr); Resultpri.Text = Fos.sumPrice(obr); Resultpri_a.Text = "SAR 0.00"; DDR.ItemsSource = obr; mo.Delete1(); }
public ObservableCollectionCore <Models.RepairView> Sales_2(string name) { var ID = new List <string>(); var NAME = new List <string>(); var PRICE = new List <string>(); var conprou = new List <string>(); var DAT = new List <string>(); var datrec = new List <string>(); var typeprou = new List <string>(); var discouns = new List <string>(); var isdone = new List <bool>(); DataTable dt = new DataTable(); var Getdata = new ModelMega(); Getdata.show(dt); foreach (DataRow item in dt.Rows) { NAME.Add(item.Field <String>("NAME")); PRICE.Add(item.Field <String>("PRICE")); ID.Add(item.Field <String>("ID")); DAT.Add(item.Field <String>("DAT")); datrec.Add(item.Field <String>("datrec")); typeprou.Add(item.Field <String>("typeprou")); discouns.Add(item.Field <String>("discounts")); conprou.Add(item.Field <String>("conprou")); isdone.Add(item.Field <Int64>("isdone") == -1?true:false); } ObservableCollectionCore <Models.RepairView> sales = new ObservableCollectionCore <Models.RepairView>(); for (int i = 0; i < NAME.Count; i++) { if (NAME[i].Contains(name)) { sales.Add(new Models.RepairView() { conprou = conprou[i], DAT = DAT[i], datrec = datrec[i], discounts = discouns[i], ID = ID[i], NAME = NAME[i], PRICE = PRICE[i], typeprou = typeprou[i], isdone = isdone[i] ?false:true }); } } return(sales); }
public ObservableCollectionCore <Coustomer> Sales(string name) { var NAME = new List <string>(); var PRICE = new List <string>(); var PRICE_A = new List <string>(); var DAT = new List <string>(); var QUANTITY = new List <string>(); var BARCODE = new List <string>(); var Dis = new List <string>(); var Price_F = new List <string>(); var ID = new List <string>(); DataTable dt = new DataTable(); var Getdata = new Assest.OrcDataAcess(); Getdata.Show(dt); foreach (DataRow item in dt.Rows) { NAME.Add(item.Field <String>("NAME")); PRICE.Add(item.Field <String>("PRICE")); PRICE_A.Add(item.Field <String>("PRICE_A")); DAT.Add(item.Field <String>("DAT")); QUANTITY.Add(item.Field <String>("QUANTITY")); BARCODE.Add(item.Field <String>("BARCODE")); Dis.Add(item.Field <String>("Dis")); Price_F.Add(item.Field <String>("Price_F")); ID.Add(item.Field <String>("ID")); } ObservableCollectionCore <Coustomer> sales = new ObservableCollectionCore <Coustomer>(); for (int i = 0; i < NAME.Count; i++) { if (NAME[i].Contains(name)) { sales.Add(new Coustomer() { QUANTITY = QUANTITY[i], NAME = NAME[i], BARCODE = BARCODE[i], DAT = DAT[i], PRICE_A = PRICE_A[i], Dis = Dis[i], PRICE = PRICE[i], Price_F = Price_F[i], ID = ID[i], }); } } return(sales); }
private List <string> SaveDelete() { var result = new List <string>(); var obr = new ObservableCollectionCore <Models.RepairView>(); var megaView = new MegaView(); foreach (DataRow item in megaView.GetAllItemsHasSold().Rows) { if (item.Field <Int64>("isdone") != -1) { result.Add(item.Field <string>("ID")); } } return(result); }
private void AddBymounth() { try { var LiName = new List <string>(); var LiPrice = new List <string>(); var LiDate = new List <string>(); var SearchinProduct = new Assest.Capt2(); var IEnuDayList = new ObservableCollectionCore <Assest.SearchInProduct>(); var Datatable = new DataTable(); SearchinProduct.show(Datatable); foreach (DataRow datarow in Datatable.Rows) { if (datarow.Field <string>("MOUNTH") == DateTime.Now.Month.ToString()) { LiName.Add(datarow.Field <string>("NAME")); LiPrice.Add(datarow.Field <string>("PRICE")); LiDate.Add(datarow.Field <string>("YEAR") + "/" + datarow.Field <string>("MOUNTH") + "/" + datarow.Field <string>("DAY")); } } int if_can = 0; for (int i = 0; i < LiName.Count; i++) { if (name.Text == LiName[i]) { IEnuDayList.Add(new Assest.SearchInProduct() { Date = LiDate[i], name = LiName[i], price = LiPrice[i] }); if_can = 1; } } if (if_can != 1) { DXMessageBox.Show("لم يتم العثور على اي نتيجة", "خطأ", MessageBoxButton.OK, MessageBoxImage.Error); } GridData.ItemsSource = IEnuDayList; } catch (Exception ex) { } }
public BarCodeEmployeesViewModel() { Accounts = new ObservableCollectionCore <Employe>(); if (DesignMode.DesignModeEnabled) { Accounts.Add(new Employe(FeatureDemo.Data.DataStorage.Employees[0])); } else { for (int i = 0; i < 10; i++) { Accounts.Add(new Employe(FeatureDemo.Data.DataStorage.Employees[i])); } } SelectedEmploye = Accounts[0]; PrintCommand = new DevExpress.Mvvm.DelegateCommand(PrintDocument); }
public string sumPrice(ObservableCollectionCore <Models.RepairView> collection) { var megaview = new MegaView(); var listPrice = new List <string>(); foreach (DataRow item in megaview.GetAllItemsHasSold().Rows) { listPrice.Add(item.Field <string>("PRICE")); } double result = 0; for (int i = 0; i < listPrice.Count; i++) { result += double.Parse(listPrice[i].Replace("SAR", "").Replace(",", "")); } return("SAR " + result.ToString("N0")); }
private void Repair_Selected(object sender, RoutedEventArgs e) { var obr = new ObservableCollectionCore <Models.RepairView>(); var megaView = new MegaView(); foreach (DataRow item in megaView.GetAllItemsHasSold().Rows) { obr.Add(new Models.RepairView() { 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") == -1?true:false) }); } DDR.ItemsSource = obr; Resultpri_a.Text = Fos.sumPrice_a(); try { DDa.Visibility = Visibility.Hidden; DD.Visibility = Visibility.Hidden; DDR.Visibility = Visibility.Visible; Encode.IsEnabled = false; Encode.Visibility = Visibility.Hidden; Encode1.IsEnabled = true; Encode1.Visibility = Visibility.Visible; Encode.Clear(); IS_SELECTED = false; is_Repair_Selected = true; Delete.IsEnabled = true; } catch (Exception ex) { } }
private void Delete_click(object sender, RoutedEventArgs e) { /// if (DD.Visibility == Visibility.Visible) { #region DataGrid #1 DD.BeginSelection(); string index = ""; var acc = new Assest.OrcDataAcess(); int counting = 0; foreach (int handle in DD.GetSelectedRowHandles()) { if (counting == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع الفواتير المحدد عليها, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { index = (string)DD.GetCellValue(handle, "id"); acc.Delete3(index); break; } case MessageBoxResult.No: break; default: break; } } else if (counting >= 1) { index = (string)DD.GetCellValue(handle, "id"); acc.Delete3(index); } counting++; } if (counting == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع الفواتير, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { acc.Delete3(); break; } case MessageBoxResult.No: break; default: break; } } DD.EndSelection(); var datatablee = new DataTable(); show.show3(datatablee); System.Windows.Forms.BindingSource BindS = new System.Windows.Forms.BindingSource(); BindS.DataSource = datatablee; DD.ItemsSource = BindS; Resultpri.Text = Fos.sumPrice(); Resultpri_a.Text = Fos.sumPrice_a(); #endregion } else if (DDR.Visibility == Visibility.Visible) { #region Datagrid #2 DDR.BeginSelection(); var listU = new List <string>(); listU = SaveDelete(); string iindex = ""; int countingg = 0; var megav = new ModelMega(); foreach (int handle in DDR.GetSelectedRowHandles()) { if (countingg == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع البيانات المحدد عليها, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { iindex = (string)DDR.GetCellValue(handle, "رمز المنتج"); megav.Delete(iindex); break; } case MessageBoxResult.No: break; default: break; } } else if (countingg >= 1) { iindex = (string)DDR.GetCellValue(handle, "رمز المنتج"); megav.Delete(iindex); } countingg++; } if (countingg == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع البيانات, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { ///Need To Fix_+_+_+_+__++_+_+__+_+_++_+_+_+__+_+__+_ megav.Delete(); break; } case MessageBoxResult.No: break; default: break; } } DDR.EndSelection(); var obr = new ObservableCollectionCore <Models.RepairView>(); var megaView = new MegaView(); foreach (DataRow item in megaView.GetAllItemsHasSold().Rows) { obr.Add(new Models.RepairView() { 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") == -1?true:false) }); } DDR.ItemsSource = obr; Resultpri_a.Text = Fos.sumPrice_a(); #endregion } }
/* * * 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); } } } }