private void GoToFindPatient()
 {
     StaticVar = this;
     Hide();
     this.Visible = false;
     this.IsExit = false;
     this.Close();
     Application.DoEvents();
     System.Threading.Thread.Sleep(400);
     var form2 = new FrmFindPatient();
     form2.Show();
 }
 //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();
 }
Пример #3
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);
            }
        }