Esempio n. 1
0
        protected override void afterUpdate(bool isSuccessful)
        {
            if (isSuccessful)
            {
                AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                addActivityLog.ActivityLog = new ActivityLog();
                addActivityLog.ActiveUser  = ActiveUser;
                if (User.Status.Equals("Archived"))
                {
                    addActivityLog.ActivityLog.Activity = "User archived a user account named " + User.Username + ".";
                }
                else
                {
                    addActivityLog.ActivityLog.Activity = "User unarchived a user account named " + User.Username + ".";
                }
                addActivityLog.saveActivityLog();

                DialogBoxViewModel.Mode    = "Success";
                DialogBoxViewModel.Message = "Operation completed.";
                DialogBoxViewModel.Answer  = "None";
                LoadUsers();
            }
            else
            {
                DialogBoxViewModel.Mode    = "Error";
                DialogBoxViewModel.Message = "Operation failed.";
                DialogBoxViewModel.Answer  = "None";
            }
            while (DialogBoxViewModel.Answer.Equals("None"))
            {
                Thread.Sleep(100);
            }
            DialogBoxViewModel.Answer = "";
        }
Esempio n. 2
0
        protected override void afterDelete(bool isSuccessful)
        {
            if (isSuccessful)
            {
                AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                addActivityLog.ActivityLog          = new ActivityLog();
                addActivityLog.ActiveUser           = ActiveUser;
                addActivityLog.ActivityLog.Activity = "User deleted a supplier named " + Supplier.Name + ".";
                addActivityLog.saveActivityLog();

                LoadSuppliers();
                DialogBoxViewModel.Mode    = "Success";
                DialogBoxViewModel.Message = "Operation completed.";
                DialogBoxViewModel.Answer  = "None";
            }
            else
            {
                DialogBoxViewModel.Mode    = "Error";
                DialogBoxViewModel.Message = "Operation failed.";
                DialogBoxViewModel.Answer  = "None";
            }
            while (DialogBoxViewModel.Answer.Equals("None"))
            {
                Thread.Sleep(100);
            }
            DialogBoxViewModel.Answer = "";
        }
Esempio n. 3
0
        protected override void afterCreate(bool isSuccessful)
        {
            if (isSuccessful)
            {
                DialogBoxViewModel.Mode    = "Success";
                DialogBoxViewModel.Message = "Operation completed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
                Medicine     = new Medicine();
                CopyMedicine = (Medicine)Medicine.Clone();

                AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                addActivityLog.ActivityLog          = new ActivityLog();
                addActivityLog.ActiveUser           = ActiveUser;
                addActivityLog.ActivityLog.Activity = "User added new item named " + Medicine.Name + ".";
                addActivityLog.saveActivityLog();
            }
            else
            {
                DialogBoxViewModel.Mode    = "Error";
                DialogBoxViewModel.Message = "Operation failed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
            }
        }
        protected override void afterCreate(bool isSuccessful)
        {
            if (isSuccessful)
            {
                AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                addActivityLog.ActivityLog          = new ActivityLog();
                addActivityLog.ActiveUser           = ActiveUser;
                addActivityLog.ActivityLog.Activity = "User created a new provider named " + Provider.Name + ".";
                addActivityLog.saveActivityLog();

                DialogBoxViewModel.Mode    = "Success";
                DialogBoxViewModel.Message = "Operation completed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
                Provider     = new Provider();
                CopyProvider = (Provider)Provider.Clone();
            }
            else
            {
                DialogBoxViewModel.Mode    = "Error";
                DialogBoxViewModel.Message = "Operation failed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
            }
        }
Esempio n. 5
0
        protected override void afterCreate(bool isSuccessful)
        {
            if (isSuccessful)
            {
                DialogBoxViewModel.Mode    = "Success";
                DialogBoxViewModel.Message = "Operation completed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
                Patient     = new Patient();
                CopyPatient = (Patient)Patient.Clone();

                AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                addActivityLog.ActivityLog          = new ActivityLog();
                addActivityLog.ActiveUser           = ActiveUser;
                addActivityLog.ActivityLog.Activity = "User added new patient named " + Patient.FirstName + " " + Patient.LastName + ".";
                addActivityLog.saveActivityLog();
            }
            else
            {
                DialogBoxViewModel.Mode    = "Error";
                DialogBoxViewModel.Message = "Operation failed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
            }
        }
Esempio n. 6
0
        protected override void afterCreate(bool isSuccessful)
        {
            if (isSuccessful)
            {
                DialogBoxViewModel.Mode    = "Success";
                DialogBoxViewModel.Message = "Operation completed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
                Treatment     = new Treatment();
                CopyTreatment = (Treatment)Treatment.Clone();

                AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                addActivityLog.ActivityLog          = new ActivityLog();
                addActivityLog.ActiveUser           = ActiveUser;
                addActivityLog.ActivityLog.Activity = "User created a new service named " + Treatment.Name + ".";
                addActivityLog.saveActivityLog();
            }
            else
            {
                DialogBoxViewModel.Mode    = "Error";
                DialogBoxViewModel.Message = "Operation failed.";
                DialogBoxViewModel.Answer  = "None";
                while (DialogBoxViewModel.Answer.Equals("None"))
                {
                    Thread.Sleep(100);
                }
                DialogBoxViewModel.Answer = "";
            }
        }
Esempio n. 7
0
        public void finishTreatment()
        {
            if (ToothList != null && ToothList.Count > 0)
            {
                if (MessageBox.Show("Are you sure you want to save this treatment?", "Save Treatment", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    foreach (ToothViewModel toothViewModel in ToothList)
                    {
                        AddTreatmentRecordViewModel treatmentRecord = new AddTreatmentRecordViewModel();
                        treatmentRecord.Treatment   = Appointment.Treatment;
                        treatmentRecord.Appointment = Appointment;
                        treatmentRecord.Tooth       = toothViewModel.Tooth;
                        treatmentRecord.Patient     = Appointment.Patient;
                        treatmentRecord.Notes       = toothViewModel.Remarks;
                        treatmentRecord.ActiveUser  = ActiveUser;
                        treatmentRecord.saveTreatmentRecord();
                        if (!Appointment.Treatment.Output.Equals("None"))
                        {
                            toothViewModel.Tooth.Condition = Appointment.Treatment.Output;
                        }
                        toothViewModel.saveTooth();
                        toothViewModel.loadTooth();
                    }
                    foreach (ConsumableItem consumable in Consumables)
                    {
                        AddUsedItemViewModel addUsedItemViewModel = new AddUsedItemViewModel();
                        addUsedItemViewModel.Appointment = Appointment;
                        addUsedItemViewModel.Medicine    = consumable.Medicine;
                        addUsedItemViewModel.Quantity    = Int32.Parse(consumable.Consumed);
                        addUsedItemViewModel.ActiveUser  = ActiveUser;
                        consumable.ViewModel.ActiveUser  = ActiveUser;
                        consumable.consume();
                        addUsedItemViewModel.SaveUsedItem();
                    }
                    AddBillingViewModel.Billing.Provider = ProviderViewModel.Provider;
                    if (AddBillingViewModel.Billing.Provider == null)
                    {
                        AddBillingViewModel.Billing.Provider = new Provider();
                    }
                    AddBillingViewModel.ActiveUser            = ActiveUser;
                    AddBillingViewModel.Appointment           = Appointment;
                    AddBillingViewModel.Billing.AmountCharged = Double.Parse(AmountCharge);
                    AddBillingViewModel.Billing.Balance       = Double.Parse(AmountCharge);
                    AddBillingViewModel.saveBilling();



                    MessageBox.Show("Treatment was successfully saved.", "Treatment Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                    MySqlConnection connection = CreateConnection();
                    MySqlCommand    command    = connection.CreateCommand();
                    command.CommandText = "update allaboutteeth_appointments set appointment_status='Completed' where appointment_no = '" + Appointment.No + "'";
                    command.ExecuteNonQuery();
                    connection.Close();
                    connection = null;

                    MySqlConnection connection2 = CreateConnection();
                    MySqlCommand    command2    = connection2.CreateCommand();
                    command2.CommandText = "update allaboutteeth_patients set patient_status='Active', patient_addedby='" + ActiveUser.No + "' where patient_no='" + Appointment.Patient.No + "'";
                    command2.ExecuteNonQuery();
                    connection2.Close();
                    connection2 = null;

                    AddActivityLogViewModel addActivityLog = new AddActivityLogViewModel();
                    addActivityLog.ActivityLog          = new ActivityLog();
                    addActivityLog.ActiveUser           = ActiveUser;
                    addActivityLog.ActivityLog.Activity = "User performed treatment for " + Operation.Appointment.Patient.FirstName + " " + Operation.Appointment.Patient.LastName + ".";
                    addActivityLog.saveActivityLog();

                    try
                    {
                        var appointment = Appointments.OrderBy(x => x.No).First(x =>
                                                                                x.Patient.No == Appointment.Patient.No && x.No != Appointment.No);
                        Appointment = appointment;
                        Appointments.Remove(appointment);
                        Teeth     = new List <ToothViewModel>();
                        ToothList = new List <ToothViewModel>();
                        ClearItems();
                    }
                    catch (Exception)
                    {
                        MenuViewModel.gotoBillings();
                    }
                    //MenuViewModel.gotoBillings();
                }
            }
            else
            {
                MessageBox.Show("No tooth is selected.", "Selection Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }