Exemple #1
0
        public bool VerifyAppointment(int verifyUserID, string verifyUserPassword, int nAppointmentID)
        {
            TblEmployee verifyUser = new TblEmployee();

            verifyUser.NEmployeeID = verifyUserID;

            verifyUser.SelectOne();

            if (verifyUser.StrPassword.IsNull)
            {
                throw new Exception("Invalid User ID or Password");
            }

            if (verifyUser.StrPassword.Value != verifyUserPassword)
            {
                throw new Exception("Invalid User ID or Password");
            }

            TblAppointment myAppointment = new TblAppointment();

            myAppointment.NAppointmentId = nAppointmentID;
            myAppointment.SelectOne();

            if (!myAppointment.NVerifiedBy.IsNull)
            {
                throw new Exception("This appointment have been verified by other staff with the employee ID : " + myAppointment.NVerifiedBy.Value.ToString());
            }

            myAppointment.NVerifiedBy = verifyUserID;
            //myAppointment.NStatus = 1;
            myAppointment.Update();
            return(true);
        }
Exemple #2
0
        public async Task <string> CreateNewAppointment(AppointmentDTO appointment)
        {
            using (var dbcxtransaction = _tandVardContext.Database.BeginTransaction())
            {
                var tblInsertItem = new TblAppointment()
                {
                    FldAppointmentBegin = appointment.FldAppointmentBegin,
                    FldAppointmentEnd   = appointment.FldAppointmentEnd,
                    FldDenistIdFK       = appointment.FldDenistIdFK,
                    FldPatientFK        = appointment.FldPatientFK
                };
                if (!_tandVardContext.TblUsers.Any(x => x.FldUserId == tblInsertItem.FldDenistIdFK))
                {
                    throw new ArgumentException("The appointed dentist does not Exist");
                }
                if (!_tandVardContext.TblPatients.Any(x => x.FldPatientId == tblInsertItem.FldPatientFK))
                {
                    throw new ArgumentException("The appointed patient does not Exist");
                }

                var result = await _tandVardContext.TblAppointments.AddAsync(tblInsertItem);

                if (result.State.ToString() != "Added")
                {
                    throw new Exception("Appointment was not added");
                }

                _tandVardContext.SaveChanges();
                dbcxtransaction.Commit();
                return("Appointment was successfully created");
            }
        }
Exemple #3
0
        public bool VerifyAppointmentLimit(int nContactID)
        {
            TblAppointment appt     = new TblAppointment();
            DataTable      table    = appt.LoadData("Select COUNT (*) as nCount From TblAppointment where nContactID = @nContactID group by strReceiptNo", new string[] { "@nContactID" }, new object[] { nContactID });
            decimal        netTotal = 0;

            if (table.Rows.Count > 0)
            {
                netTotal = ACMS.Convert.ToDecimal(table.Rows[0]["mSubTotal"]);
            }
            return(true);
        }
Exemple #4
0
        public bool CloseAppointment(int nAppointmentID)
        {
            TblAppointment myAppointment = new TblAppointment();

            myAppointment.NAppointmentId = nAppointmentID;
            myAppointment.SelectOne();
            myAppointment.NStatus = 2;
            myAppointment.Update();

            TblContacts myContact = new TblContacts();

            myContact.UpdateLeadStatus(Convert.ToInt32(myAppointment.NContactId.Value), 0);
            return(true);
        }
Exemple #5
0
        public void Post([FromBody] TblAppointment value)
        {
            bool appointmentClash = ValidateNoAppoinmentClash(value);

            if (appointmentClash == true)
            {
                db.TblPatients.Add(value.AppointmentPatient);
                db.TblAppointments.Add(value);
                db.SaveChanges();
            }
            else
            {
                throw new Exception("Seçtiğiniz tarih aralığında doktorumuz müsait değildir.");
            }
        }
Exemple #6
0
        private bool ValidateNoAppoinmentClash(TblAppointment newAppointment)
        {
            var appointments = from a in db.TblAppointments.Where(x => x.AppointmentDoctorId == newAppointment.AppointmentDoctorId)
                               select a;

            foreach (var item in appointments)
            {
                if (newAppointment.AppointmentStartDate > item.AppointmentStartDate && newAppointment.AppointmentStartDate < item.AppointmentEndDate ||
                    newAppointment.AppointmentEndDate > item.AppointmentStartDate && newAppointment.AppointmentEndDate < item.AppointmentEndDate)
                {
                    return(false);
                }
            }
            return(true);
        }
 public void Put(string id, [FromBody] TblAppointment appointment)
 {
     ms.Database.ExecuteSqlCommand("updateAppointmentStatus '" + id + "'," + appointment.ApStatus);
 }
Exemple #8
0
 public void Post([FromBody] TblAppointment appointment)
 {
     msc.Database.ExecuteSqlCommand("exec bookingAppointment '" + appointment.ApDrUserId + "','" + appointment.ApMdMedicareServiceId + "','" + appointment.ApPtUserId + "','" + appointment.ApDate + "','" + appointment.ApTime + "'");
 }
 public void Put([FromBody] TblAppointment appointmentUpdate)
 {
     ms.Database.ExecuteSqlCommand("updateAppointment '" + appointmentUpdate.ApAppointmentId + "','" + appointmentUpdate.ApDrUserId +
                                   "','" + appointmentUpdate.ApMdMedicareServiceId + "','" + appointmentUpdate.ApPtUserId + "','" + appointmentUpdate.ApDate +
                                   "','" + appointmentUpdate.ApTime + "'");
 }
 public void Post([FromBody] TblAppointment appointment)
 {
     ms.Database.ExecuteSqlCommand("insertAppointment '" + appointment.ApDrUserId + "','" + appointment.ApMdMedicareServiceId +
                                   "','" + appointment.ApPtUserId + "','" + appointment.ApDate + "','" + appointment.ApTime + "'," + appointment.ApStatus);
 }