Esempio n. 1
0
 public MainWindow(User user)
 {
     InitializeComponent();
     _activeUser        = user;
     this.userName.Text = user.Name;
     context            = HospitalEntities.GetEntity();
     UpdateCards();
     this.Closed += (sender, args) => Application.Current.Shutdown();
     _thisWindow  = this;
 }
Esempio n. 2
0
        private void btnVorud_Click(object sender, EventArgs e)
        {
            try
            {
                //    FrmMain FrmMain = new FrmMain();
                //    FrmMain.ShowDialog();

                if (txtUserName.Text.Trim().Length == 0 || txtPassword.Text.Trim().Length == 0)
                {
                    FarsiMessagbox.Show("تمامی اطلاعات درخواستی را وارد نمایید", "ورود کاربر", FMessageBoxButtons.Ok, FMessageBoxIcon.Information);
                }
                else
                {
                    HospitalEntities db = new HospitalEntities();

                    string password = "";
                    LogContent           = "UserName = "******"نام کاربری یا کلمه عبور اشتباه می باشد.", "ورود کاربر", FMessageBoxButtons.Ok, FMessageBoxIcon.Information);

                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var context = HospitalEntities.GetEntity();
//			context.users.Load();
            var users = context.GetUsersByName(username.Text);

            if (!users.Any())
            {
                MessageBox.Show("Incorrect username or password");
                return;
            }
            var user = users.First();

            if (user.Password != password.Password)
            {
                MessageBox.Show("Incorrect username or password");
                return;
            }
            var window = new MainWindow(user);

            window.Show();
            this.Hide();
        }