public MainControlArchive() { InitializeComponent(); viewSource.Source = EquipmentBidViewModel.instance().getCollectionByArchiveStatus(1); //Сортировка даты по убыванию viewSource.SortDescriptions.Add(new SortDescription("PlannedShipmentDate", ListSortDirection.Descending)); DataContext = new { EquipmentBidCollection = viewSource.View }; }
void Button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button == null) { return; } DataGridRow row = Classes.FindItem.FindParentItem <DataGridRow>(button); if (row == null) { return; } EquipmentBid equipmentBid = row.Item as EquipmentBid; if (equipmentBid == null) { return; } if (MessageBox.Show("Вернуть в работу?", "Вернуть в работу?", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return; } equipmentBid.Is_archive = 0; Bid bid = BidViewModel.instance().getById(equipmentBid.Id_bid); if (!equipmentBid.save()) { MessageBox.Show(equipmentBid.LastError); return; } else { if (bid != null) { bid.Guid = Guid.NewGuid().ToString(); if (!bid.save()) { MessageBox.Show("Не удалось обновить время модификации заявки!\nДругой специалист тех. отдела не увидит обновление\n" + bid.LastError); } } } EquipmentBidViewModel.instance().updateStatus(equipmentBid); }
public override void raiseAllProperties() { if (oldValues.ContainsKey("Is_archive") && (oldValues["Is_archive"] as int?) != null && Is_archive != (int)oldValues["Is_archive"]) { EquipmentBidViewModel.instance().updateStatus(this); } RaisePropertyChanged("Id_equipment", Id_equipment); RaisePropertyChanged("Id_modification", Id_modification); RaisePropertyChanged("Id_bid", Id_bid); RaisePropertyChanged("Serial_number", Serial_number); RaisePropertyChanged("Is_blank_print", Is_blank_print); RaisePropertyChanged("Is_archive", Is_archive); RaisePropertyChanged("EquipmentName", null); RaisePropertyChanged("ModificationName", null); RaisePropertyChanged("IsBlankPrint", null); }
public bool generateSerialNumber() { try { HTTPManager.HTTPRequest http = HTTPManager.HTTPRequest.Create(Settings.uri); http.UseCookie = true; http.addParameter("entity", "Bid/generateEquipmentBidSerialNumber"); http.addParameter("id", Id); if (!http.post()) { LastError = HTTPManager.HTTPRequest.LastError; return(false); } ResponseParser parser = ResponseParser.Parse(http.ResponseData); if (!parser.NoError) { LastError = parser.LastError; return(false); } if (parser.ServerErrorFlag != 0) { LastError = parser.ToObject <string>(); return(false); } List <TempEquipmentBid> updatedEquipmentBid = parser.ToObject <List <TempEquipmentBid> >(); for (int i = 0; i < updatedEquipmentBid.Count; i++) { EquipmentBid equipmentBid = EquipmentBidViewModel.instance().getById(updatedEquipmentBid[i].Id); if (equipmentBid == null) { continue; } equipmentBid.setSerialNumber(updatedEquipmentBid[i].SerialNumber); } return(true); } catch (Exception ex) { LastError = ex.ToString(); return(false); } }
//Фильтры отображени/сокрытия строк таблиц private void SetViewSources() { equipmentBidViewSource.Source = EquipmentBidViewModel.instance().Collection; equipmentBidViewSource.Filter += delegate(object sender, FilterEventArgs e) { EquipmentBid equipmentBid = e.Item as EquipmentBid; if (equipmentBid == null) { return; } Bid bid = dgvBid.SelectedItem as Bid; if (bid == null) { e.Accepted = false; return; } if (bid.Id == equipmentBid.Id_bid) { e.Accepted = true; } else { e.Accepted = false; } }; complectationViewSource.Source = ComplectationViewModel.instance().Collection; complectationViewSource.Filter += delegate(object sender, FilterEventArgs e) { Complectation complectation = e.Item as Complectation; if (complectation == null) { return; } EquipmentBid equipmentBid = dgvEquipmentBid.SelectedItem as EquipmentBid; if (equipmentBid == null) { e.Accepted = false; return; } if (complectation.Id_equipment_bid == equipmentBid.Id) { e.Accepted = true; } else { e.Accepted = false; } }; buyerViewSource.Source = BuyerViewModel.instance().Collection; buyerViewSource.Filter += delegate(object sender, FilterEventArgs e) { Buyer buyer = e.Item as Buyer; if (buyer == null) { return; } Bid bid = dgvBid.SelectedItem as Bid; if (bid == null) { e.Accepted = false; return; } if (buyer.Id == bid.Id_buyer) { e.Accepted = true; } else { e.Accepted = false; } }; }
//Фильтры отображени/сокрытия строк таблиц private void SetViewSources() { //Установка источника данных оборудования в заявке equipmentBidViewSource.Source = EquipmentBidViewModel.instance().Collection; //Установка фильтра equipmentBidViewSource.Filter += delegate(object sender, FilterEventArgs e) { EquipmentBid equipmentBid = e.Item as EquipmentBid; if (equipmentBid == null) { return; } Bid bid = dgvBid.SelectedItem as Bid; if (bid == null) { e.Accepted = false; return; } if (bid.Id == equipmentBid.Id_bid) { e.Accepted = true; } else { e.Accepted = false; } }; //Установка источника данных комплектация complectationViewSource.Source = ComplectationViewModel.instance().Collection; //Установка фильтра complectationViewSource.Filter += delegate(object sender, FilterEventArgs e) { Complectation complectation = e.Item as Complectation; if (complectation == null) { return; } EquipmentBid equipmentBid = dgvEquipmentBid.SelectedItem as EquipmentBid; if (equipmentBid == null) { e.Accepted = false; return; } if (complectation.Id_equipment_bid == equipmentBid.Id) { e.Accepted = true; } else { e.Accepted = false; } }; //Установка источника данных покупателей buyerViewSource.Source = BuyerViewModel.instance().Collection; //Установка фильтра buyerViewSource.Filter += delegate(object sender, FilterEventArgs e) { Buyer buyer = e.Item as Buyer; if (buyer == null) { return; } Bid bid = dgvBid.SelectedItem as Bid; if (bid == null) { e.Accepted = false; return; } if (buyer.Id == bid.Id_buyer) { e.Accepted = true; } else { e.Accepted = false; } }; }