예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBoxKodeSales.Text.Length == 0 || textBoxNamaSales.Text.Length == 0 || textBoxNoTelp.Text.Length == 0 || textBoxPassword.Text.Length == 0 || textBoxRWPassword.Text.Length == 0 || textBoxUsername.Text.Length == 0)
            {
                MessageBox.Show("There are some field that empty");
            }
            else
            {
                DAL shipper = null;

                try
                {
                    shipper = new DAL();
                    shipper.Register_Sales(_conn, textBoxKodeSales.Text, textBoxUsername.Text, textBoxPassword.Text, textBoxNamaSales.Text, textBoxAlamat.Text, textBoxNoTelp.Text, textBoxEmail.Text);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                MessageBox.Show("Register Success");
                Hide();
                using (Login l = new Login(_conn)) //if data ok, form will close it self!
                {
                    if (l.ShowDialog() == DialogResult.OK)
                    {

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    this.DialogResult = DialogResult.OK;

                }
            }
        }
예제 #2
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);
        }