/// <summary> /// [Português] /// Construtor do FrmReport. /// <para></para> /// [English] /// FrmReport class constructor. /// </summary> /// <param name="list"></param> /// <param name="patient"></param> /// public FrmReport(Patient patient) { InitializeComponent(); this.AuxPatient = patient; this.txtNome.Text = this.AuxPatient.Name; var list = PosturalEvaluationController.Instance.GetAll(patient.Name); this.posturalEvaluationBindingSource.DataSource = list; }
/// <summary> /// [Português] /// Construtor da classe FrmCapturePic. /// <para></para> /// [English] /// FrmCapturePic class constructor. /// </summary> /// <param name="postura"> Imagem da Postura / Image of Posture </param> /// <param name="titulo"> Titulo do Formulario / Title of the Form</param> /// <param name="viewtype"> Tipo da postura avaliada / Type of posture evaluated </param> /// <param name="nomePaciente"> Nome do paciente / Name of the Pacient </param> /// <param name="idade"> Idade do paciente / Age of the Pacient</param> public FrmCapturePic(Patient patient) { InitializeComponent(); _patient = patient; _viewType = ViewType.Anterior; _posturalEvaluation = new PosturalEvaluation(); _posturalEvaluation.Patient = _patient; FormSetup(); }
/// <summary> /// [Português] /// Construtor do FrmCadPaciente, usado para realizar a alteração do cadastro do paciente. /// [English] /// Builder FrmCadPaciente, used to make a change in the patient record. /// </summary> /// <param name="pacient"></param> public FrmCadPatient(Patient pacient) { InitializeComponent(); this.Text = "GESTUM - Alterar cadastro de Pacientes"; txtNome.Text = pacient.Name; txtEndereco.Text = pacient.Address; maskedTxtTelefone.Text = pacient.PhoneNumber; cboSexo.Text = pacient.Gender; txtProfissao.Text = pacient.Occupation; maskedTextBoxIdade.Text = Convert.ToString(pacient.Age); dateTimePickerNascimento.Value = new DateTime(pacient.BirthDate.Year, pacient.BirthDate.Month, pacient.BirthDate.Day); maskedTextBoxPeso.Text = Convert.ToString(pacient.Weight); maskedTextAltura.Text = Convert.ToString(pacient.Height); txtAvaliador.Text = pacient.NameEvaluator; this.btnAlterar.Visible = true; this.btnCadastrar.Visible = false; validatingAllFields(); nomeAux = txtNome.Text; }
/// <summary> /// [Português] /// Método auxiliar para o cadastro do paciente. /// <para></para> /// [English] /// Helper method to register the patient. /// </summary> /// <param name="patient"></param> /// <param name="option"></param> private void Option(Patient patient,Boolean option) { Bitmap img = new Bitmap(Gestum.Properties.Resources.cadastro_sucesso); patientController = PatientController.Instance; switch (option) { case true: if (patientController.Insert(patient)) { ShowMessage("Gestum - Cadastro de Paciente", "O paciente " + patient.Name + " foi cadastrado com sucesso.", img); } break; case false: if (patientController.UpdatePacient(patient, nomeAux)) { ShowMessage("Gestum - Alterar cadastro de Paciente", "O paciente " + nomeAux + " foi alterado com sucesso.", img); } break; default: break; } }
/// <summary> /// [Português] /// Método para adicionar ou alterar paciente de acordo com o parametro. /// <para></para> /// [English] /// Method for adding or changing patient according to the parameter. /// </summary> /// <param name="option"> True - Cadastra o paciente na base de dados / Registers the patient into the database /// False - Altera o cadastro do paciente / Changes the record of the patient </param> private void AddUpdatePatient(Boolean option) { Patient patient = new Patient( txtNome.Text, txtEndereco.Text, maskedTxtTelefone.Text, txtProfissao.Text, txtAvaliador.Text, float.Parse(maskedTextAltura.Text), float.Parse(maskedTextBoxPeso.Text), cboSexo.Text, DateTime.Parse(dateTimePickerNascimento.Text) ); validationProviderPacient.PerformValidation(txtNome); validationProviderPacient.PerformValidation(txtEndereco); validationProviderPacient.PerformValidation(maskedTxtTelefone); validationProviderPacient.PerformValidation(maskedTextBoxIdade); validationProviderPacient.PerformValidation(dateTimePickerNascimento); validationProviderPacient.PerformValidation(txtProfissao); validationProviderPacient.PerformValidation(txtAvaliador); validationProviderPacient.PerformValidation(maskedTextBoxPeso); validationProviderPacient.PerformValidation(maskedTextAltura); try { if (validationProviderPacient.IsValid) { Option(patient, option); } } catch (Exception erro) { //Carregar outra imagem. Bitmap img = new Bitmap(Gestum.Properties.Resources.exclamation); ShowMessage("Ocorreu um erro inesperado!",erro.Message, img); } }
/// <summary> /// [Português] /// Método que cadastra um novo paciente no banco de dados. /// <para></para> /// [English] /// Method to register a new patient in the database. /// </summary> /// <param name="patient"> Objeto Paciente que será armazenado no banco /// de dados / Patient object that is stored in the database </param> /// <returns> /// True - Adicionado com sucesso / Successfully added /// <para></para> /// False - Ocorreu um erro / There was an error</returns> public Boolean Insert(Patient patient) { IObjectContainer database = null; try { database = Database.Instance.Open(); database.Store(patient); database.Commit(); return true; } catch (Exception erro) { database.Rollback(); throw new Exception(erro.Message); } }
/// <summary> /// [Português] /// Método que altera o registro de determinado paciente. /// <para></para> /// [English] /// Method that alters the record of a particular patient. /// </summary> /// <param name="pacient"> Objeto do tipo Paciente. / Object of the type Pacient. </param> /// <param name="nomeAux"></param> /// <returns> /// True - Alterado com sucesso / Successfully update /// <para></para> /// False - Ocorreu um erro / There was an error</returns> public Boolean UpdatePacient(Patient pacient, string nomeAux) { IObjectContainer database = null; try { database = Database.Instance.Open(); var results = database.Query<Patient>(p => p.Name == nomeAux); Patient aux = results.First(); aux.Name = pacient.Name; aux.Address = pacient.Address; aux.PhoneNumber = pacient.PhoneNumber; aux.Gender = pacient.Gender; aux.Occupation = pacient.Occupation; aux.BirthDate = pacient.BirthDate; aux.Weight = pacient.Weight; aux.Height = pacient.Height; aux.NameEvaluator = pacient.NameEvaluator; database.Commit(); database.Store(aux); return true; } catch (Exception erro) { database.Rollback(); throw new Exception(erro.Message); } }
/// <summary> /// [Português] /// Método que retorna um paciente de acordo com o que foi selecionado /// no grid do form principal. /// <para></para> /// [English] /// Method that returns a patient in accordance with what was selected /// in the grid of the main form. /// </summary> /// <returns> Paciente / Patient </returns> private Patient PatientReturn() { int Line = this.grdPrincipal.CurrentRow.Index; string Name = this.grdPrincipal[0,Line].Value.ToString(); Patient auxPatient = new Patient(); PatientController patientController = PatientController.Instance; auxPatient = patientController.SearchPacient(Name); return auxPatient; }