示例#1
0
        public bool SelectWhereID(int ID, out DealerInfo dealerInfo)
        {
            Dealers dealer = new Dealers();

            dealerInfo = new DealerInfo();

            //Get dealer
            if (!dealersTable.SelectRecord(ID, out dealer))
            {
                MessageBoxes.ShowError(MessageBoxes.LoadDataErrorMessage);
                return(false);
            }

            //Get drug info list
            List <DrugsInfo.DrugsInfo> drugsInfoList = new List <DrugsInfo.DrugsInfo>();

            if (!SelectAllDrugsInfo(drugsInfoList, ID))
            {
                MessageBoxes.ShowError(MessageBoxes.LoadDataErrorMessage);
                return(false);
            }

            //Get drugs list
            List <Drugs.Drugs> drugsList = new List <Drugs.Drugs>();

            for (int i = 0; i < drugsInfoList.Count; i++)
            {
                Drugs.Drugs drug = new Drugs.Drugs();
                if (!drugsData.SelectWhereID(drugsInfoList[i].DrugID, out drug))
                {
                    MessageBoxes.ShowError(MessageBoxes.LoadDataErrorMessage);
                    return(false);
                }
                drugsList.Add(drug);
            }


            dealerInfo.dealer        = dealer;
            dealerInfo.drugsInfoList = drugsInfoList;
            dealerInfo.drugsList     = drugsList;

            return(true);
        }
示例#2
0
        protected override void OnDeleteClick(object sender, RoutedEventArgs e)
        {
            if (SelectedItems.Count != 1)
            {
                return;
            }

            MessageBoxResult result = MessageBoxes.MessageBoxShowDeleteMessage();

            if (result == MessageBoxResult.No)
            {
                return;
            }

            Dealers dealer = (Dealers)SelectedItem;

            if (!dealersData.DeleteWhereID(dealer.ID))
            {
                MessageBoxes.ShowError(MessageBoxes.DeleteErrorMessage);
                return;
            }

            itemsSource.RemoveAt(SelectedIndex);
        }
示例#3
0
 public bool Insert(Dealers delaer)
 {
     return(dealersTable.InsertRecord(delaer));
 }
示例#4
0
 public DealerInfo(Dealers dealer, List <Drugs.Drugs> drugsList, List <DrugsInfo.DrugsInfo> drugsInfoList)
 {
     this.dealer        = dealer;
     this.drugsList     = drugsList;
     this.drugsInfoList = drugsInfoList;
 }
示例#5
0
 public DealerInfo()
 {
     dealer        = new Dealers();
     drugsList     = new List <Drugs.Drugs>();
     drugsInfoList = new List <DrugsInfo.DrugsInfo>();
 }