Esempio n. 1
0
        private void frm_users_Load(object sender, EventArgs e)
        {
            if (this.currentUseraccess == "0")
            {
                //Administrator
                tab_user.TabPages.Remove(tabPage2); //MyAccount
                tab_user.TabPages.Remove(tabPage3); //Requests
                home.LoadToDatagridview(dgvStaff, "SELECT sId 'ID',fName 'NAME' FROM staff WHERE sId > 0");
                dgvStaff.Columns[0].Width = 20;
                home.fillCombo(cmb_desig, "SELECT name FROM designation WHERE id > 0;", "name");
            }
            else if (this.currentUseraccess == "2")
            {
                //User mode staff
                tab_user.TabPages.Remove(tabPage1);
                tab_user.TabPages.Remove(tabPage3);
                home.LoadToDatagridview(dgvRequest, "SELECT date, type, amount, status FROM requests WHERE sId=" + this.currentUID + ";");
                userDetails();
                attDetails();
            }
            else
            {
                //Admin mode staff
                home.LoadToDatagridview(dgvStaff, "SELECT sId 'ID',fName 'NAME' FROM staff WHERE sId > 0");
                home.fillCombo(cmb_desig, "SELECT name FROM designation WHERE id > 0;", "name");
                dgvStaff.Columns[0].Width = 20;
                home.LoadToDatagridview(dgvRequest, "SELECT date, type, amount, status FROM requests WHERE sId=" + this.currentUID + ";");
                home.LoadToDatagridview(dgvReqMg, "SELECT * FROM requests");
                userDetails();
                attDetails();
            }

            string w = Screen.FromControl(home).WorkingArea.Width.ToString();

            this.Location     = new Point((Convert.ToInt32(w) - this.Width) / 2, 120);
            FormBorderStyle   = FormBorderStyle.FixedSingle;
            btn_clear.Enabled = true;
            disableFields();
        }
Esempio n. 2
0
        private void returnmgt_Load(object sender, EventArgs e)
        {
            string w = Screen.FromControl(home).WorkingArea.Width.ToString();

            this.Location   = new Point((Convert.ToInt32(w) - this.Width) / 2, 120);
            FormBorderStyle = FormBorderStyle.FixedSingle;
            btn_cal.Enabled = false;

            home.fillCombo(cmbRetDocNo, "SELECT dno FROM returns ORDER BY dno DESC", "dno");

            MySqlCommand cmd = new MySqlCommand("SELECT dno FROM returns order by dno desc limit 1;", this.conn);

            try
            {
                conn.Open();
                MySqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read() == true)
                {
                    lbl_docnum.Text = "00" + (Convert.ToInt32(dr["dno"].ToString()) + 1).ToString();
                }
                else
                {
                    lbl_docnum.Text = "001";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            //Load Discount Table
            home.LoadToDatagridview(dataGridView2, "SELECT itemCode 'Code',description 'Description',qty 'Qty' FROM returnstock;");
        }