Ejemplo n.º 1
0
        public Roleform quyentruycap(int role, int IDmanhinh)
        {
            Roleform roleform = new Roleform();

            SqlConnection con        = new SqlConnection(path);
            string        sql        = string.Format("Select * from Phanquyen where QuyenId='{0}' and ManhinhId='{1}'", role, IDmanhinh);
            SqlCommand    sqlCommand = new SqlCommand(sql, con);

            con.Open();
            SqlDataReader row = sqlCommand.ExecuteReader();

            if (row.HasRows)
            {
                row.Read();
                roleform.Them = Boolean.Parse(row[4].ToString());
                roleform.Xoa  = Boolean.Parse(row[5].ToString());
                roleform.Sua  = Boolean.Parse(row[6].ToString());
                roleform.Inan = Boolean.Parse(row[7].ToString());
                roleform.Nhap = Boolean.Parse(row[8].ToString());
                roleform.Xuat = Boolean.Parse(row[9].ToString());
            }


            con.Close();
            return(roleform);
        }
Ejemplo n.º 2
0
        private void FrmQlKhachhang_Load(object sender, EventArgs e)
        {
            Loadnhansu();
            Roleform roleform = phanquyen();

            btnthem.Enabled = roleform.Them;
            btnxoa.Enabled  = roleform.Xoa;
            btnsua.Enabled  = roleform.Sua;
            btnin.Enabled   = roleform.Inan;
            btnnhap.Enabled = roleform.Nhap;
            btnxuat.Enabled = roleform.Xuat;
        }