//--- Загрузка элемента ----------------------------------------------- void uc_TTN_item_Loaded(object sender, RoutedEventArgs e) { mc.srv_select_ConsignmentExCompleted += new EventHandler<srv_select_ConsignmentExCompletedEventArgs>(proxy_srv_select_ConsignmentExCompleted); TTN = new cConsignmentEx(); resultWindow = new cwnd_Message(); mc.srv_select_ConsignmentExAsync(ucFilter.ID); }
//--- Обработчики событий ---------------------------------------------- void proxy_srv_select_ConsignmentExCompleted(object sender, srv_select_ConsignmentExCompletedEventArgs e) { if (e.Result != null) { TTN = e.Result; TTN.setMode(ucFilter.ItemMode); TTN_collection = new ObservableCollection<cConsignmentEx>(); TTN_collection.Add(TTN); dg_Root.ItemsSource = TTN_collection; dg_TTNbase.DataContext = TTN_collection[0]; } else { cwnd_Err w = new cwnd_Err("Ошибка SELECT TTN", e.OpStatus); w.Show(); } }
static void Main(string[] args) { string OpStatus; int id = 152; cConsignmentEx C_Ex = new cConsignmentEx(); try { C_Ex.list_BacterialInsiminateClass = DataManager.sel_DatFromLists("BacterialInsiminateClassList"); C_Ex.list_Contractor = DataManager.sel_DatFromLists("ContractorList"); C_Ex.list_PurityGroup = DataManager.sel_DatFromLists("PurityGroupList"); C_Ex.list_Sort = DataManager.sel_DatFromLists("SortList"); C_Ex.list_Status = DataManager.sel_DatFromLists("StatusList"); if (id != null) { cFilterList filter = new cFilterList(); filter.ConsignmentNoteID = id; C_Ex.CNote = DataManager.sel_ConsignmentNote(filter).ToList()[0]; C_Ex.setCurrentItemsIndexes(); } else { C_Ex.CNote = new cConsignmentItem(); C_Ex.CNote.item_BacterialInsiminateClass = C_Ex.list_BacterialInsiminateClass[0]; C_Ex.CNote.item_Contractor = C_Ex.list_Contractor[0]; C_Ex.CNote.item_PurityGroup = C_Ex.list_PurityGroup[0]; C_Ex.CNote.item_Sort = C_Ex.list_Sort[0]; C_Ex.CNote.item_Status = C_Ex.list_Status[0]; } OpStatus = "Операция выполнена успешно"; } catch (Exception err) { OpStatus = err.ToString(); } }
//---- SELECT накладной расширенный public cConsignmentEx srv_select_ConsignmentEx(int? id, out string OpStatus) { cConsignmentEx C_Ex = new cConsignmentEx(); try { C_Ex.list_BacterialInsiminateClass = DataManager.sel_DatFromLists("BacterialInsiminateClassList"); C_Ex.list_Contractor = DataManager.sel_DatFromLists("ContractorList"); C_Ex.list_PurityGroup = DataManager.sel_DatFromLists("PurityGroupList"); C_Ex.list_Sort = DataManager.sel_DatFromLists("SortList"); C_Ex.list_Status = DataManager.sel_DatFromLists("StatusList"); if (id != null) { cFilter filter = new cFilter(); filter.ConsignmentNoteID = id; C_Ex.CNote = DataManager.sel_ConsignmentNote(filter).ToList()[0]; } else { C_Ex.CNote = new cConsignmentItem(); C_Ex.CNote.item_BacterialInsiminateClass = C_Ex.list_BacterialInsiminateClass[0]; C_Ex.CNote.item_Contractor = C_Ex.list_Contractor[0]; C_Ex.CNote.item_PurityGroup = C_Ex.list_PurityGroup[0]; C_Ex.CNote.item_Sort = C_Ex.list_Sort[0]; C_Ex.CNote.item_Status = C_Ex.list_Status[0]; } OpStatus = "Операция выполнена успешно"; return C_Ex; } catch (Exception err) { OpStatus = err.ToString(); return null; } }