Esempio n. 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;
            }
        }
Esempio n. 2
0
        public BDVisitPrice VisitPriceSaveChange(BDVisitPrice _bDVisitPrice)
        {
            try
            {
                // BDVisitPrice operation add & edit

                var dbVisitPrice = _contextDatabase.BDVisitPrices.SingleOrDefault(s => s.VisitPriceID == _bDVisitPrice.VisitPriceID);
                if (dbVisitPrice != null)
                {
                    // Update BDVisitPrice
                    _contextDatabase.Entry(dbVisitPrice).CurrentValues.SetValues(_bDVisitPrice);
                    _contextDatabase.BDVisitPrices.Attach(dbVisitPrice);
                    _contextDatabase.SaveChanges();
                    return(dbVisitPrice);
                }
                else
                {
                    // Insert BDVisitPrice into the database
                    _contextDatabase.BDVisitPrices.Add(_bDVisitPrice);
                    _contextDatabase.SaveChanges();
                    return(_bDVisitPrice);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(null);
        }
Esempio n. 3
0
        public string addBDVisitType(VisitType _visitType)
        {
            try
            {
                var Query = _contextDatabase.BDVisitTypes.Where(a => a.VisitTypeID == _visitType.VisitTypeID).FirstOrDefault();
                if (Query != null)
                {
                    Query.VisitTypeName = _visitType.VisitTypeName;
                    _contextDatabase.SaveChanges();
                    return("Added sucsessfully");
                }
                else
                {
                    BDVisitType _bDVisitType = new BDVisitType();
                    _bDVisitType.VisitTypeName = _visitType.VisitTypeName;
                    _contextDatabase.BDVisitTypes.Add(_bDVisitType);
                    _contextDatabase.SaveChanges();
                    return("Edited succesfuy");
                }
            }
            catch (Exception ex)
            {
                return("Erorr on add");

                throw;
            }
        }
        public bool AddNewReservation(Reservasion _reservation)
        {
            try
            {
                TRANVisit tr = new TRANVisit();

                tr.PatientID       = _reservation.PatientID;
                tr.PhysicianID     = _reservation.PhysicianID;
                tr.VisitTypeID     = _reservation.VisitTypeID;
                tr.VisitDate       = _reservation.VisitDate;
                tr.TimeFrom        = _reservation.TimeFrom;
                tr.TimeTo          = _reservation.TimeTo;
                tr.VisitsCount     = _reservation.VisitsCount;
                tr.VisitPrice      = _reservation.VisitPrice;
                tr.PhysicianSalary = _reservation.PhysicianSalary;
                tr.Paiedprice      = _reservation.PaiedPrice;
                tr.RestPrice       = _reservation.RestPrice;
                tr.TotalVisitPrice = _reservation.TotalVisitPrice;
                tr.Notes           = _reservation.Notes;

                _contextDatabase.TRANVisits.Add(tr);
                _contextDatabase.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public BDPhysicianSalary PhysicianSalarySaveChange(BDPhysicianSalary _bDPhysicianSalary)
        {
            try
            {
                // BDPhysicianSalary operation add & edit

                var dbPhysicianSalary = _contextDatabase.BDPhysicianSalaries.SingleOrDefault(s => s.PhysicianPriceID == _bDPhysicianSalary.PhysicianPriceID);
                if (dbPhysicianSalary != null)
                {
                    // Update BDPhysicianSalary
                    _contextDatabase.Entry(dbPhysicianSalary).CurrentValues.SetValues(_bDPhysicianSalary);
                    _contextDatabase.BDPhysicianSalaries.Attach(dbPhysicianSalary);
                    _contextDatabase.SaveChanges();
                    return(dbPhysicianSalary);
                }
                else
                {
                    // Insert BDPhysicianSalary into the database
                    _contextDatabase.BDPhysicianSalaries.Add(_bDPhysicianSalary);
                    _contextDatabase.SaveChanges();
                    return(_bDPhysicianSalary);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(null);
        }
Esempio n. 6
0
        public string addACPatient(ACPatient patient)
        {
            try
            {
                var Query = _contextDatabase.ACPatients.Where(a => a.PatientID == patient.PatientID).FirstOrDefault();
                if (Query != null)
                {
                    Query.PatientName = patient.PatientName;
                    Query.DOB         = patient.DOB;
                    Query.Phone       = patient.Phone;
                    Query.Mobile      = patient.Mobile;
                    Query.Address     = patient.Address;
                    Query.Notes       = patient.Notes;
                    _contextDatabase.SaveChanges();
                    return("تم الحفظ بنجاح");
                }
                else
                {
                    ACPatient _bDPatient = new ACPatient();
                    _bDPatient.PatientName = patient.PatientName;
                    _bDPatient.DOB         = patient.DOB;
                    _bDPatient.Phone       = patient.Phone;
                    _bDPatient.Mobile      = patient.Mobile;
                    _bDPatient.Address     = patient.Address;
                    _bDPatient.Notes       = patient.Notes;
                    _contextDatabase.ACPatients.Add(_bDPatient);
                    _contextDatabase.SaveChanges();
                    return("تم الحفظ بنجاح");
                }
            }
            catch (Exception ex)
            {
                return("Erorr on save");

                throw;
            }
        }