コード例 #1
0
        private void buttonSignIn_Click(object sender, EventArgs e)
        {
            /// delete next 2 lines
            work  = new RepositoryLibrary.GenericUnitOfWork(new DALServerDB.ServerContext(textBoxConnectionString.Text));
            repUs = work.Repository <DALServerDB.Infrastructure.User>();
            ///
            Connection = textBoxConnectionString.Text;
            if (work == null)
            {
                MessageBox.Show("no Connection!!!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrWhiteSpace(textBoxLogin.Text) || string.IsNullOrWhiteSpace(textBoxPassword.Text))
            {
                MessageBox.Show("enter the Login and Password!!!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                GetUserAdminAsync();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Environment.NewLine + ex.Message + Environment.NewLine, this.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxConnectionString.Text))
            {
                MessageBox.Show("enter a ConnectionString!!!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            panelConnectionString.Visible = false;
            groupBoxServer.Visible        = true;
            try
            {
                work  = new RepositoryLibrary.GenericUnitOfWork(new DALServerDB.ServerContext(textBoxConnectionString.Text));
                repUs = work.Repository <DALServerDB.Infrastructure.User>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Environment.NewLine + ex.Message + Environment.NewLine, this.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }