Esempio n. 1
0
        string SetIdStaff()
        {
            DataTable dt = busStaff.CreateData("");

            if (dt.Rows.Count < 1)
            {
                return("STA0000");
            }
            else
            {
                string s  = Convert.ToString(dt.Rows[dt.Rows.Count - 1][0]);
                int    id = Convert.ToInt32(s.Remove(0, 3)) + 1;
                if (id < 10)
                {
                    return("STA0000" + id);
                }
                else if (id < 100)
                {
                    return("STA00" + id);
                }
                else if (id < 1000)
                {
                    return("STA0" + id);
                }
                else
                {
                    return("STA" + id);
                }
            }
        }
        void ShowInformation(string user, string pass)
        {
            UnlockUpdateCustomer();
            DataTable dt = busStaff.CreateData("Where UserName = N'" + user + "' AND Password = N'" + pass + "'");

            if (dt.Rows.Count > 0)
            {
                txtNameStaff.Text = dt.Rows[0][1].ToString();
                dtpStaff.Value    = Convert.ToDateTime(dt.Rows[0][2].ToString());
                if (dt.Rows[0][3].ToString() == "nam")
                {
                    rdStaffMale.Checked = true;
                }
                else if (dt.Rows[0][3].ToString() == "nữ")
                {
                    rdStaffWomen.Checked = true;
                }
                txtPasswordStaff.Text    = dt.Rows[0][5].ToString();
                txtUserNameStaff.Text    = dt.Rows[0][4].ToString();
                txtPhoneNumberStaff.Text = dt.Rows[0][6].ToString();
            }
            else
            {
                MessageBox.Show("Da xay ra loi");
            }
        }