예제 #1
0
 public string addBDPhysician(Physician Physician)
 {
     try
     {
         var Query = _contextDatabase.BDPhysicians.Where(a => a.PhysicianID == Physician.PhysicianID).FirstOrDefault();
         if (Query != null)
         {
             Query.PhysicianName = Physician.PhysicianName;
             _contextDatabase.SaveChanges();
             return "تم الحفظ بنجاح";
         }
         else
         {
             BDPhysician _bDPhysician = new BDPhysician();
             _bDPhysician.PhysicianName = Physician.PhysicianName;
             _contextDatabase.BDPhysicians.Add(_bDPhysician);
             _contextDatabase.SaveChanges();
             return "تم الحفظ بنجاح";
         }
     }
     catch (Exception ex)
     {
         return "Erorr on save";
         throw;
     }
 }
예제 #2
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (ValidateUI())
     {
         if (Mode == "Add")
         {
             Physician _bdphysician = new Physician();
             _bdphysician.PhysicianName = tbx_PhysicianName.Text.ToString();
             string _message = physician.addBDPhysician(_bdphysician);
             FillPhysicianCombo();
             MessageBox.Show(_message);
         }
         else if (Mode == "Edit")
         {
             _SelectedPhysician.PhysicianName = tbx_PhysicianName.Text.ToString();
             string _message = physician.addBDPhysician(_SelectedPhysician);
             FillPhysicianCombo();
             MessageBox.Show(_message);
         }
         ControlUI("Select");
         Mode = "Select";
     }
     else
     {
         MessageBox.Show("برجاء ادخال بيانات صحيحة");
     }
 }
        private void FrmProfitReport_Load(object sender, EventArgs e)
        {
              
            Physician _physician = new Physician();
            _AllPhysicians = _physician.GetPhysiciansWithPrics(DateTime.Now.Date);
            cbx_Physycian.DataSource = null;
            cbx_Physycian.DataSource = _AllPhysicians;
            cbx_Physycian.DisplayMember = "PhysicianName";
            cbx_Physycian.ValueMember = "PhysicianID";
            cbx_Physycian.SelectedIndex = -1;

           // this.reportViewer1.RefreshReport();
        }
예제 #4
0
 public string deleteDBPhysician(Physician Physician)
 {
     try
     {
         var _bDPhysician = _contextDatabase.BDPhysicians.Single(a => a.PhysicianID == Physician.PhysicianID);
         _contextDatabase.BDPhysicians.Remove(_bDPhysician);
         _contextDatabase.SaveChanges();
         return "تم الحذف بنجاح";
     }
     catch (Exception ex)
     {
         return "Error on delete";
     }
 }
예제 #5
0
 public string deleteDBPhysician(Physician Physician)
 {
     try
     {
         var _bDPhysician = _contextDatabase.BDPhysicians.Single(a => a.PhysicianID == Physician.PhysicianID);
         _contextDatabase.BDPhysicians.Remove(_bDPhysician);
         _contextDatabase.SaveChanges();
         return("تم الحذف بنجاح");
     }
     catch (Exception ex)
     {
         return("Error on delete");
     }
 }
        private void Fillcbx_Physician()
        {
            Physician _physician = new Physician();
            _AllPhysicians = _physician.GetPhysiciansWithPrics(DateTime.Now.Date);
            cbx_Physycian.DataSource = null;
            cbx_Physycian.DataSource = _AllPhysicians;
            cbx_Physycian.DisplayMember = "PhysicianName";
            cbx_Physycian.ValueMember = "PhysicianID";
            cbx_Physycian.SelectedIndex = -1;
            PhysicianPrice = 0;
            VisitPrice = 0;

        }