private void ButtonClick(object sender, RoutedEventArgs e) { int indx = Snp.FindIndex(l => l.CustomerId == CustomerId); if (indx != -1) { RepositoryStatPlaceArrond.Delete(Snp[indx]); Snp.RemoveAt(indx); } else { FunctionsService.ShowMessageTime("Erroer "); } CollectionViewSource.GetDefaultView(((WGrid)Owner).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(WStat)) { WStat w = (window as WStat); w.Reload(); } } Close(); }
private void OkClick(object sender, RoutedEventArgs e) { string sia = (string)xNation.SelectedItem; string namea = sia.Substring(0, sia.IndexOf("..") - 1); StatNationPopup fa = A.Find(l => l.NameNation == namea); if (fa != null) { fa.Qty += 1; RepositoryStatNationPopup.Update(fa); } string sib = (string)xPlaceArround.SelectedItem; string nameb = sib.Substring(0, sib.IndexOf("..") - 1); StatPlaceArrond fb = B.Find(l => l.NamePlaceArrond == nameb); if (fb != null) { fb.Qty += 1; RepositoryStatPlaceArrond.Update(fb); } StatNation sn = new StatNation(Guid.NewGuid(), DateTime.Now, Global.Config.CustomerId, fa != null ? fa.CustomerId : Guid.Empty, fb != null ? fb.CustomerId : Guid.Empty); RepositoryStatNation.Add(sn); Close(); }
public void Reload() { RepositoryStatNationPopup.Sync(); A = RepositoryStatNationPopup.StatNationPopups.OrderByDescending(l => l.Qty).ToList(); RepositoryStatPlaceArrond.Sync(); B = RepositoryStatPlaceArrond.StatPlaceArronds.OrderByDescending(l => l.Qty).ToList(); xNation.Items.Clear(); xPlaceArround.Items.Clear(); foreach (var elm in A) { xNation.Items.Add(elm.NameNation + " ... " + elm.Qty); } foreach (var elm in B) { xPlaceArround.Items.Add(elm.NamePlaceArrond + " ... " + elm.Qty); } xNation.SelectedIndex = 0; xPlaceArround.SelectedIndex = 0; }
private void ButtonClick(object sender, RoutedEventArgs e) { string name = xNamePlaceArrond.Text; string QTY = xQTY.Text; if (name.Length == 0) { FunctionsService.ShowMessageTime("Пустое знаение "); } else { if (Snp.FindAll(l => l.NamePlaceArrond == name).Count > 0) { FunctionsService.ShowMessageTime("Такое имя сущ-ет "); } else { int qty; if (int.TryParse(QTY, out qty)) { int indx = Snp.FindIndex(l => l.CustomerId == this.CustomerId); if (indx != -1) { Snp[indx].NamePlaceArrond = name; Snp[indx].Qty = qty; RepositoryStatPlaceArrond.Update(Snp[indx]); } else { FunctionsService.ShowMessageTime("Erroer "); } CollectionViewSource.GetDefaultView(((WGrid)Owner).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(WStat)) { WStat w = (window as WStat); w.Reload(); } } Close(); } else { FunctionsService.ShowMessageTime("Неверое значние поля QTY "); } } } }
public static void MegaSync() { // check tables var syncTask = Task <bool> .Factory.StartNew( () => { RepositoryActionHashBox.Sync(); //RepositoryCheck RepositoryCheckTicket.Sync(); RepositoryCheckTicketTmp.Sync(); RepositoryPro.Sync(); RepositoryClientInfo.Sync(); RepositoryCloseTicket.Sync(); RepositoryCloseTicketCheckDiscount.Sync(); RepositoryCloseTicketG.Sync(); RepositoryCloseTicketTmp.Sync(); RepositoryCountry.Sync(); RepositoryCurrency.Sync(); //RepositoryCurrencyRelations RepositoryDevisId.Sync(); RepositoryDevisWeb.Sync(); //RepositoryDiscount RepositoryDiscountCard.Sync(); RepositoryEstablishment.Sync(); RepositoryGeneral.Sync(); RepositoryGroupProduct.Sync(); //RepositoryHistoryChangeProduct RepositoryInfoClientsDiscountsType.Sync(); RepositoryLastUpdate.Sync(); RepositoryOpenTicketWindow.Sync(); RepositoryPayProduct.Sync(); RepositoryPayProductTmp.Sync(); //RepositoryPriceGros RepositoryProduct.Sync(); RepositoryProductBc.Sync(); RepositoryStatNation.Sync(); RepositoryStatNationPopup.Sync(); RepositoryStatPlaceArrond.Sync(); //RepositoryStockLogs RepositoryStockReal.Sync(); RepositorySyncPlus.Sync(); RepositorySyncPlusProduct.Sync(); //RepositoryTes RepositoryTva.Sync(); RepositoryTypePay.Sync(); //RepositoryXmlFile return(true); }); syncTask.ContinueWith( s => { }); }
private void ButtonClick(object sender, RoutedEventArgs e) { string name = xNamePlaceArrond.Text; string qtyText = xQTY.Text; if (name.Length == 0) { FunctionsService.ShowMessageTime("Пустое знаение "); } else { if (Snp.Find(l => l.NamePlaceArrond == name) != null) { FunctionsService.ShowMessageTime("Такое имя сущ-ет "); } else { int qty; if (int.TryParse(qtyText, out qty)) { var sn = new StatPlaceArrond(Guid.NewGuid(), name, qty); RepositoryStatPlaceArrond.Add(sn); Snp.Add(sn); CollectionViewSource.GetDefaultView((this.Owner as WGrid).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(WStat)) { WStat w = (window as WStat); w.Reload(); } } Close(); } else { FunctionsService.ShowMessageTime("Неверое значние поля QTY "); } } } }