コード例 #1
0
ファイル: Factory.cs プロジェクト: netthanhhung/Medical
 public static void PopulateTreatmentMedicine(TreatmentMedicine input, System.Data.IDataReader reader)
 {
     PopulateRecord(input, reader);
     input.RecordId = input.TreatmentMedicineId = Utilities.ToInt(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.TreatmentMedicineId]);
     input.TreatmentId = Utilities.ToInt(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.TreatmentId]);
     input.MedicineId = Utilities.ToInt(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.MedicineId]);
     input.Medicine = Utilities.ToString(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.Medicine]);
     input.Quantity = Utilities.ToNDecimal(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.Quantity]);
     input.Unit = Utilities.ToString(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.Unit]);
     input.Price = Utilities.ToNDecimal(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.Price]);
     input.TotalPrice = Utilities.ToNDecimal(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.TotalPrice]);
     input.Description = Utilities.ToString(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.Description]);
     input.BasePrice = Utilities.ToNDecimal(reader[Medical.Apartment.Common.TreatmentMedicine.ColumnNames.BasePrice]);
 }
コード例 #2
0
 void btnInsertTreatmentMedicine_Click(object sender, RoutedEventArgs e)
 {
     Medicine medicine = uiMedicineList.SelectedItem as Medicine;
     if (medicine != null && _selectedTreatmentId > 0)
     {
         List<TreatmentMedicine> list = (List<TreatmentMedicine>)gvwTreatmentMedicine.ItemsSource;
         if (list.Count(i => i.MedicineId == medicine.MedicineId) > 0)
         {
             MessageBox.Show(ResourceHelper.GetReourceValue("Common_ItemExist"));
         }
         else
         {
             TreatmentMedicine newTreatmentMedicine = new TreatmentMedicine();
             newTreatmentMedicine.TreatmentId = _selectedTreatmentId;
             newTreatmentMedicine.MedicineId = medicine.MedicineId;
             newTreatmentMedicine.Medicine = medicine.Name;
             newTreatmentMedicine.IsChanged = true;
             newTreatmentMedicine.Quantity = 1;
             newTreatmentMedicine.Price = medicine.Price;
             newTreatmentMedicine.BasePrice = medicine.Price;
             newTreatmentMedicine.Unit = medicine.Unit;
             newTreatmentMedicine.TotalPrice = medicine.Price;
             newTreatmentMedicine.Description = medicine.Description;
             list.Add(newTreatmentMedicine);
             gvwTreatmentMedicine.ItemsSource = null;
             gvwTreatmentMedicine.ItemsSource = list;
         }
     }
 }
コード例 #3
0
ファイル: Factory.cs プロジェクト: netthanhhung/Medical
        public static TreatmentMedicine TreatmentMedicine(System.Data.IDataReader reader)
        {
            TreatmentMedicine result = null;

            if (null != reader && reader.Read())
            {
                result = new TreatmentMedicine();
                PopulateTreatmentMedicine(result, reader);
            }

            return result;
        }