Exemplo n.º 1
0
        public ForgetPass(IDbConnection conn)
        {
            InitializeComponent();
            _conn = conn;

            DAL shipper = null;
            IDataReader reader = null;

            try
            {
                shipper = new DAL();
                reader = shipper.Cek_Sales(_conn);

                if (reader.Read())
                {
                    textBoxUsername.Text = reader[0].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            DAL shipper = null;
            IDataReader reader = null;

            try
            {
                shipper = new DAL();
                reader = shipper.Cek_Sales(_conn);

                if (reader.Read())
                {
                    if (!textBoxUsername.Text.Equals(reader.GetString(0)) || !textBoxPassword.Text.Equals(reader.GetString(1)) )
                    {
                        MessageBox.Show("Username atau Password Salah");

                    }
                    else
                    {
                        MessageBox.Show("Login Berhasil");
                        this.DialogResult = DialogResult.OK;

                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        public MenuUtama(IDbConnection conn)
        {
            InitializeComponent();
            _conn = conn;

            DAL shipper = null;
            IDataReader reader = null;
            current = DateTime.Now;

            try
            {
                shipper = new DAL();
                reader = shipper.Cek_Sales(_conn);

                if (reader.Read())
                {
                    Hide();
                    using (Login l = new Login(_conn)) //if data ok, form will close it self!
                    {
                        if (l.ShowDialog() == DialogResult.OK)
                        {
                            this.Visible = true;
                        }
                        else
                        {
                            _conn.Close();
                            _conn.Dispose();
                            Application.Exit();
                        }
                    }
                }
                else
                {
                    Hide();
                    using (Register c = new Register(_conn)) //if data ok, form will close it self!
                    {
                        if (c.ShowDialog() == DialogResult.OK)
                        {
                            this.Visible = true;
                        }
                        else
                        {
                            _conn.Close();
                            _conn.Dispose();
                            Application.Exit();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
            retrieve_salesData();
            retrieve_pageData(current);
        }