Exemple #1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            using (var ctx = new db_dataEntities())
            {
                var username = this.txtusername.Text;
                var password = this.txtpassword.Text;

                var getUser = ctx.tbl_user.Where(o => o.username == username && o.password == password).FirstOrDefault();

                if (getUser != null)
                {
                    ObjectCache     cache           = MemoryCache.Default;
                    CacheItemPolicy cacheItemPolicy = new CacheItemPolicy();
                    cache.Add("userLogin", getUser, cacheItemPolicy);

                    this.Hide();

                    menu_admin frm2 = new menu_admin();
                    frm2.Show();
                }
                else
                {
                    MessageBox.Show("please check username and password");
                    this.txtusername.Text = "";
                    this.txtpassword.Text = "";
                }
            }
        }
        private void btn_kembali_Click(object sender, EventArgs e)
        {
            this.Hide();

            menu_admin frm2 = new menu_admin();

            frm2.Show();
        }