Exemplo n.º 1
0
        private void btSelect_Click(object sender, EventArgs e)
        {
            try
            {
                bool isChecked = false;
                foreach (Control ctl in groupBox1.Controls)
                {
                    if (ctl is RadioButton)
                    {
                        var aRadioButton = (RadioButton) ctl;
                        if (aRadioButton.Checked)
                        {
                            isChecked = true;
                        }
                    }
                }

                if (!isChecked)
                {
                    MessageBox.Show("Please select an option!");
                    return;
                }

                var form2 = new FrmFindPatient();
                foreach (Control ctl in groupBox1.Controls)
                {
                    if (ctl is RadioButton)
                    {
                        var aRadioButton = (RadioButton) ctl;
                        if (aRadioButton.Checked)
                        {
                            switch (aRadioButton.Name)
                            {
                                case "rbUpdate":
                                    StaticVar = this;
                                    this.Visible = false;
                                    Hide();
                                    form2.Show();
                                    break;
                                case "rbDelete":
                                    StaticVar = this;
                                    this.Visible = false;
                                    Hide();
                                    form2.Delete = true;
                                    form2.Show();
                                    break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {

                //var logger = new ExceptionLogger();
                //logger.AddLogger(new EventLogLogger());
                //logger.LogException(ex, "Menu selection failed!");
                //throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 2
0
        private void dgResults_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {

                if (dgResults.RowCount == 0)
                {
                    MessageBox.Show("Please select a Patient!");
                    return;
                }

                if (Delete)
                {
                    DialogResult dlgRes = MessageBox.Show(
                        "Are you sure you want to delete the Replenishment Schedule for: " +
                        dgResults.SelectedRows[0].Cells[1].Value + "?",
                        "Confirm Delete",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question);
                    if (dlgRes == DialogResult.Yes)
                    {
                        DeleteReplenishmentSchedule(Int32.Parse(dgResults.SelectedRows[0].Cells[0].Value.ToString()));
                        MessageBox.Show("Succesfully Deleted Replenishment Schedule!");
                        StaticVar = this;
                        Hide();
                        var form3 = new FrmReplacementMenu();
                        form3.Show();
                        return;
                    }
                    else
                    {
                        StaticVar = this;
                        Hide();
                        var form3 = new FrmReplacementMenu();
                        form3.Show();
                        return;
                    }
                }

                if (SetCorrectRxId(int.Parse(dgResults.SelectedRows[0].Cells[0].Value.ToString())) == "0")
                {
                    MessageBox.Show(
                        "Please add a Soft Contact Lens Order for: " + dgResults.SelectedRows[0].Cells[1].Value + "!",
                        "Add a Soft Contact Lens Order");
                    return;
                }

                StaticVar = this;
                Hide();

                var form2 = new FrmReplenishmentSchedule
                {
                    PatientId = Int32.Parse(dgResults.SelectedRows[0].Cells[0].Value.ToString())
                };
                form2.Show();
                this.Visible = false;
                this.IsExit = false;
                this.Close();
            }
            catch (Exception ex)
            {
                //var logger = new ExceptionLogger();
                //logger.AddLogger(new EventLogLogger());
                //logger.LogException(ex, "Error selecting patient!");
                //throw new Exception(ex.Message, ex);
            }
        }
 //private void dgDates_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
 //{
 //    DateTime dateTime;
 //    if (e.ColumnIndex == 0)
 //    {
 //        if (e.FormattedValue.ToString().Length > 0)
 //        {
 //            if (!DateTime.TryParse(e.FormattedValue.ToString(), out dateTime))
 //            {
 //                dgDates.Rows[e.RowIndex].ErrorText = "Replenishment Date must be a date!";
 //                e.Cancel = true;
 //            }
 //        }
 //    }
 //    if (e.ColumnIndex == 1)
 //    {
 //        if (e.FormattedValue.ToString().Length > 0)
 //        {
 //            if (e.FormattedValue.ToString() == "  /  /")
 //            {
 //                //DateTime dtEmtpy = new DateTime(1000,1,1);
 //                dgDates[e.ColumnIndex, e.RowIndex].Value = DateTime.Now.ToShortDateString();
 //                e.Cancel = false;
 //                return;
 //            }
 //            //if (!DateTime.TryParse(e.FormattedValue.ToString(), out dateTime))
 //            //{
 //            //    dgDates.Rows[e.RowIndex].ErrorText = "Compliance Date must be a date!";
 //            //    e.Cancel = true;
 //            //}
 //        }
 //    }
 //}
 private void GoToMenu()
 {
     StaticVar = this;
     Hide();
     var form2 = new FrmReplacementMenu();
     form2.Show();
 }
Exemplo n.º 4
0
 private void btBack_Click(object sender, EventArgs e)
 {
     StaticVar = this;
         Hide();
         this.Visible = false;
         this.IsExit = false;
         this.Close();
         var form2 = new FrmReplacementMenu();
         form2.Show();
 }