Beispiel #1
0
        private void btnEditRequest_Click(object sender, EventArgs e)
        {
            DataTable dt = this.Da.ExecuteQueryTable(@"select * from request_info where reqid = '" + this.txtReqID.Text + "';");

            if (dt.Rows.Count == 1)
            {
                this.Sql = @"update request_info set status = '" + this.cmbStatusRequest.Text + "' where reqid = '" + this.txtReqID.Text + "';";
                int count = this.Da.ExecuteUpdateQuery(this.Sql);

                if (count == 1)
                {
                    MessageBox.Show("Status updated successfully");
                }
                else
                {
                    MessageBox.Show("Error while updating Status");
                }


                FormUserDashBoard f = new FormUserDashBoard();
                Notifications     n = new Notifications(f.Notify);
                n("you have 1 new notifaction");
                this.PopulateGridViewRequest();
            }
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            CommonClass.UserID = this.txtLoginID.Text;
            try
            {
                this.Sql = @"select *  from user_info
                      where userid = '" + this.txtLoginID.Text + "' and password = '******';";

                Dt = this.Da.ExecuteQueryTable(this.Sql);
                string a = Dt.Rows[0][6].ToString();



                if (a == "Admin" || a == "admin")
                {
                    MessageBox.Show("Login Sccessfull Admin");
                    FormAdminDashBoard admin = new FormAdminDashBoard();
                    this.Hide();
                    admin.Show();
                }
                else if (a == "User" || a == "user")
                {
                    MessageBox.Show("Login Sccessfull User");
                    FormUserDashBoard user = new FormUserDashBoard();
                    this.Hide();
                    user.Show();
                }
            }

            catch (Exception exc)
            {
                if (String.IsNullOrEmpty(this.txtLoginID.Text) || String.IsNullOrEmpty(this.txtPassword.Text))
                {
                    MessageBox.Show("Fill all the value");
                }
                else if (Dt.Rows.Count == 0)
                {
                    MessageBox.Show("Invalid Username or Password");
                }
            }
        }