コード例 #1
0
        public FrmChangePass()
        {
            InitializeComponent();
            BL.cls_login log = new BL.cls_login();

            DataTable dt = log.Login("admin", "hahah");

            txtID.Text          = dt.Rows[0][0].ToString();
            txtUserName.Text    = dt.Rows[0][1].ToString();
            txtOldPassword.Text = dt.Rows[0][2].ToString();
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataTable dt = log2.Login(txtID.Text, txtOldPassword.Text);

            if (String.IsNullOrEmpty(txtOldPassword.Text) || String.IsNullOrWhiteSpace(txtOldPassword.Text))
            {
                MessageBox.Show("Please full fill the Old Password.", "Password Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (txtOldPassword.Text == dt.Rows[0][3].ToString())
            {
                user.Update_User_Pass(txtID.Text, txtNewPass.Text);
            }
            //user.Update_User_Pass(txtID.Text, txtNewPass.Text);
            MessageBox.Show("Done");
        }
コード例 #3
0
        private void login_Click(object sender, EventArgs e)
        {
            DataTable        dt  = log.Login(txtID.Text, txtPWD.Text);
            FrmAddDona       fAD = new FrmAddDona();
            FrmChangePass    fCP = new FrmChangePass();
            FrmCreateIDs     fCI = new FrmCreateIDs();
            FrmDistDonations fDD = new FrmDistDonations();
            FrmMemList       fML = new FrmMemList();
            FrmPayments      fP  = new FrmPayments();
            FrmReports       fR  = new FrmReports();

            PL.FrmBackup        fB   = new PL.FrmBackup();
            PL.FrmConfig        fC   = new PL.FrmConfig();
            PL.FrmDonaList      fDL  = new PL.FrmDonaList();
            PL.FrmManageDona    fMD  = new PL.FrmManageDona();
            PL.FrmManageMem     fMM  = new PL.FrmManageMem();
            PL.FrmPreview       fPre = new PL.FrmPreview();
            PL.FrmRestoreServer fRS  = new PL.FrmRestoreServer();
            PL.frmUserList      fUL  = new PL.frmUserList();


            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("Login success");
                if (dt.Rows[0][3].ToString() == "User" || dt.Rows[0][3].ToString() == "user")
                {
                    Main x = new Main();
                    x.Show();
                    x.ID       = dt.Rows[0][0].ToString();
                    x.Username = dt.Rows[0][1].ToString();
                    x.Password = dt.Rows[0][2].ToString();
                    this.Hide();
                }
                else if (dt.Rows[0][3].ToString() == "Admin" || dt.Rows[0][3].ToString() == "admin")
                {
                    Main x = new Main();
                    x.Show();
                    x.ID       = dt.Rows[0][0].ToString();
                    x.Username = dt.Rows[0][1].ToString();
                    x.Password = dt.Rows[0][2].ToString();
                    this.Hide();
                }
                else if (dt.Rows[0][3].ToString() == "Employee" || dt.Rows[0][3].ToString() == "Employee")
                {
                    Main x = new Main();
                    x.Show();
                    x.ID       = dt.Rows[0][0].ToString();
                    x.Username = dt.Rows[0][1].ToString();
                    x.Password = dt.Rows[0][2].ToString();
                    this.Hide();
                }
                //Main.getMainForm.Show();
                //this.Close();



                /* try
                 * {
                 *  Main main = new Main();
                 *  main.ID = dt.Rows[0][0].ToString();
                 *  main.Username = dt.Rows[0][1].ToString();
                 *  main.Password = dt.Rows[0][2].ToString();
                 *  changePass.txtID.Text = dt.Rows[0][1].ToString();
                 *  Application.Run(new FrmChangePass());
                 *  //Application.Run(new Main());
                 * }
                 * catch(Exception ex){
                 *  MessageBox.Show(ex.Message);
                 * }*/
            }
            else
            {
                MessageBox.Show("login fail");
            }
        }