コード例 #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            GlobalVariables.Is_Session           = false;
            GlobalVariables.Patients_Search_Flag = 0;
            Patients_Page patients = new Patients_Page();

            this.Hide();
            patients.Show();
        }
コード例 #2
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult exit = new DialogResult();

            exit = MessageBox.Show(resourceManager.GetString("msgContinue", GlobalVariables.uiLanguage), resourceManager.GetString("msgWarning", GlobalVariables.uiLanguage), MessageBoxButtons.YesNo, MessageBoxIcon.Information);
            if (exit == DialogResult.Yes)
            {
                GlobalVariables.Is_Edit = false;
                GlobalVariables.Patients_Search_Flag = 0;
                Patients_Page patients = new Patients_Page();
                this.Hide();
                patients.Show();
            }
        }
コード例 #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(txtUsername.Text) || String.IsNullOrEmpty(txtPassword.Text))
                {
                    DialogResult error = new DialogResult();
                    error = MessageBox.Show(resourceManager.GetString("msgFields", GlobalVariables.uiLanguage), resourceManager.GetString("msgWarning", GlobalVariables.uiLanguage), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    using (VivosEntities db = new VivosEntities())
                    {
                        Consumer consumer = (Consumer)(from x in db.Consumers where x.Email.Equals(txtUsername.Text) select x).FirstOrDefault();

                        if (consumer != null)
                        {
                            User user = (User)(from x in db.Users where consumer.Id.Equals(x.Id) && x.Password.Equals(txtPassword.Text) select x).FirstOrDefault();

                            if (user != null)
                            {
                                GlobalVariables.LoginID = consumer.Id;

                                if (consumer.Code.Equals("admin"))
                                {
                                    Admin_Page admin = new Admin_Page();
                                    this.Hide();
                                    admin.Show();
                                }
                                else
                                {
                                    Patients_Page patients = new Patients_Page();
                                    this.Hide();
                                    patients.Show();
                                }
                                return;
                            }
                        }
                    }
                    DialogResult error = new DialogResult();
                    error = MessageBox.Show(resourceManager.GetString("msgWrong", GlobalVariables.uiLanguage), resourceManager.GetString("msgWarning", GlobalVariables.uiLanguage), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #4
0
ファイル: Login_Page.cs プロジェクト: Oguzhankoksal/VivoosVR
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //Checks the case of all textboxes are filled
            try
            {
                if (String.IsNullOrEmpty(txtUsername.Text) || String.IsNullOrEmpty(txtPassword.Text))
                {
                    DialogResult error = new DialogResult();
                    error = MessageBox.Show(resourceManager.GetString("msgFields", GlobalVariables.uiLanguage), resourceManager.GetString("msgWarning", GlobalVariables.uiLanguage), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    using (VivosEntities db = new VivosEntities())
                    {
                        Consumer consumer = (Consumer)(from x in db.Consumers where x.Email.Equals(txtUsername.Text) select x).FirstOrDefault();

                        if (consumer != null)
                        {
                            User user = (User)(from x in db.Users where consumer.Id.Equals(x.Id) && x.Password.Equals(txtPassword.Text) select x).FirstOrDefault();

                            if (user != null)
                            {
                                GlobalVariables.LoginID = consumer.Id;

                                if (consumer.Code.Equals("admin"))
                                {
                                    Admin_Page admin = new Admin_Page();
                                    this.Hide();
                                    admin.Show();
                                }

                                else
                                {
                                    Patients_Page patients = new Patients_Page();
                                    this.Hide();
                                    patients.Show();
                                }
                                return;
                            }
                        }
                    }

                    DialogResult error = new DialogResult();
                    error = MessageBox.Show(resourceManager.GetString("msgWrong", GlobalVariables.uiLanguage), resourceManager.GetString("msgWarning", GlobalVariables.uiLanguage), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                /*SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS" + ";" + ";Integrated Security=True");
                 * con.Open();
                 * string str = "USE Master;";
                 * //string str1 = "ALTER DATABASE Vivos SET SINGLE_USER WITH ROLLBACK IMMEDIATE;";
                 * string str2 = "RESTORE DATABASE Vivos FROM DISK='.\\Vivos.bak' WITH REPLACE";
                 * SqlCommand cmd = new SqlCommand(str, con);
                 * //SqlCommand cmd1 = new SqlCommand(str1, con);
                 * SqlCommand cmd2 = new SqlCommand(str2, con);
                 * cmd.ExecuteNonQuery();
                 * // cmd1.ExecuteNonQuery();
                 * cmd2.ExecuteNonQuery();
                 * con.Close();*/
            }
        }