public static void LoadUsers(DataTable _dt, String _query)
        {
            _dt = new DataTable();

            //TODO: Rigged for data normalization... to be fixed...
            ProgOps._daRes = new SqlDataAdapter(_query, _dbConnect);
            ProgOps._daRes.Fill(_dt);

            ProgOps.CloseDB();
        }
예제 #2
0
        private void frmReset_Load(object sender, EventArgs e)
        {
            // loads datatable on load; Query will be global on normalization
            String query = "SELECT * FROM GROUP1SP212330.USERS";

            dt = new DataTable();

            //TODO: Rigged for data normalization... to be fixed...
            ProgOps._daRes = new SqlDataAdapter(query, ProgOps._dbConnect);
            ProgOps._daRes.Fill(dt);

            ProgOps.CloseDB();
        }
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            username    = tbxUsername.Text;
            firstName   = tbxFName.Text;
            lastName    = tbxLName.Text;
            password    = tbxPassword.Text;
            cfmPW       = tbxCfmPW.Text;
            designation = cbxDesig.GetItemText(cbxDesig.SelectedItem);


            bool userExist = false;

            if (username == String.Empty || firstName == String.Empty ||
                lastName == String.Empty || password == String.Empty || cfmPW == String.Empty)
            {
                MessageBox.Show("All data is required to complete user accounts", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                SetDefaults();
            }
            else if (password != cfmPW)
            {
                MessageBox.Show("Passwords do not match", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                SetDefaults();
            }
            else
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["USERNAME"].ToString() == username)
                    {
                        MessageBox.Show("This account already exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        SetDefaults();
                        userExist = true;
                    }
                }
            }

            if (userExist == false)
            {
                int id = 0;
                ProgOps._saveUser(id, firstName, lastName, username, password, designation);
                ProgOps.CloseDB();
                SetDefaults();
                MessageBox.Show("Account Created Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                // close Form
                frmLogin login = new frmLogin();
                login.Show();
                this.Close();
            }
        }
예제 #4
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            // loads datatable on load; Query will be global on normalization
            String query = "SELECT * FROM GROUP1SP212330.USERS";

            dt = new DataTable();

            ProgOps._daRes = new SqlDataAdapter(query, ProgOps._dbConnect);
            ProgOps._daRes.Fill(dt);

            ProgOps.CloseDB();

            // Will load all tables on launch
            // ProgOps.LoadAll();
        }
예제 #5
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            username = tbxUsername.Text;
            password = tbxPW.Text;
            cfmPW    = tbxCfmPW.Text;
            if (username == String.Empty || password == String.Empty || cfmPW == String.Empty)
            {
                MessageBox.Show("All data is required to complete user accounts", "Incomplete Fields", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                SetDefaults();
            }
            else if (password != cfmPW)
            {
                MessageBox.Show("Passwords do not match", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                SetDefaults();
            }
            else
            {
                String firstName, lastName, designation;

                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["USERNAME"].ToString() == username)
                    {
                        int id = Int32.Parse(dr["USER_ID"].ToString());
                        firstName   = dr["FNAME"].ToString();
                        lastName    = dr["LNAME"].ToString();
                        designation = dr["DESIGNATION"].ToString();

                        if (ProgOps._updateUser(id, firstName, lastName, username, password, designation))
                        {
                            ProgOps.CloseDB();
                            SetDefaults();
                            MessageBox.Show("PASSWORD UPDATED SUCCESSFULLY", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                            // close Form
                            frmLogin login = new frmLogin();
                            login.Show();
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please check your information and try again", "Please try again", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        private void frmShop_Load(object sender, EventArgs e)
        {
            ShopTable         = new DataTable();
            ProgOps.CartTable = new DataTable();
            ProgOps.CartTable.Columns.Add("SKU", typeof(int));
            ProgOps.CartTable.Columns.Add("ITEM", typeof(String));
            ProgOps.CartTable.Columns.Add("PRICE", typeof(String));
            ProgOps.CartTable.Columns.Add("QUANTITY", typeof(int));
            ProgOps.CartTable.Columns.Add("DEPARTMENT", typeof(String));

            String query = "SELECT * FROM GROUP1SP212330.ITEMS";

            ProgOps._daRes = new SqlDataAdapter(query, ProgOps._dbConnect);
            ProgOps._daRes.Fill(ShopTable);

            ProgOps.CloseDB();

            ShopTable.Columns["ITEM_ID"].ColumnName   = "SKU";
            ShopTable.Columns["ITEM_NAME"].ColumnName = "ITEM";

            dgvShop.DataSource = ShopTable;
        }
 public frmShop()
 {
     InitializeComponent();
     ProgOps.ConnectDB();
 }
예제 #8
0
 public frmLogin()
 {
     InitializeComponent();
     ProgOps.ConnectDB();
 }
 public frmMainMenu()
 {
     InitializeComponent();
     ProgOps.ConnectDB();
 }