Exemple #1
0
 private void FormTambahNotaJual_Load(object sender, EventArgs e)
 {
     ut = (FormUtama)this.MdiParent;
     FormatDG();
     textBoxNoNota.Text = Transaksi.GenerateNoNota();
     textBoxKet.Text    = "-";
     textBoxId.Focus();
     labelKodePegawai.Text = ut.u.Id.ToString();
     labelNamaPegawai.Text = ut.u.Name;
     pegawai = ut.u;
     dateTimePickerTglNota.Value = DateTime.Now;
 }
Exemple #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string id   = textBoxUid.Text;
                string pass = textBoxPwd.Text;

                Koneksi     k      = new Koneksi("localhost", "dbmtt", "root", "");
                List <User> lii    = User.BacaData("username", id);
                bool        passOK = false;
                if (lii.Count > 0)
                {
                    User sss = null;
                    foreach (User u in lii)
                    {
                        if (u.Password == pass)
                        {
                            passOK = true;
                            sss    = u;
                            break;
                        }
                    }
                    if (passOK)
                    {
                        MessageBox.Show("Login Berhasil", "Information");
                        FormUtama formUtama = (FormUtama)this.Owner;
                        formUtama.u              = sss;
                        formUtama.Enabled        = true;
                        formUtama.labelUser.Text = sss.Name;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("anda pembobol coba lagi!");
                    }
                }
                else
                {
                    MessageBox.Show("anda siapa?");
                }

                /*List<User> lu = User.BacaData("","");
                 * bool cekUser = false;
                 * string passdb = "";
                 * foreach(User pengguna in lu)
                 * {
                 *  if(pengguna.Username==id)
                 *  {
                 *      cekUser = true;
                 *      passdb = pengguna.Password;
                 *      break;
                 *  }
                 * }
                 * if (cekUser == true)
                 * {
                 *  if (passdb == pass)
                 *  {
                 *      //ok lanjut aku nda tau
                 *      MessageBox.Show("berhasil login");
                 *      FormUtama formUtama = (FormUtama)this.Owner;
                 *      formUtama.Enabled = true;
                 *      this.Close();
                 *  }
                 *  else
                 *  {
                 *      MessageBox.Show("anda pembobol coba lagi!");
                 *  }
                 * }
                 * else
                 * {
                 *  MessageBox.Show("anda siapa?");
                 * }*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }