Beispiel #1
0
        public DataTable getRoleList()
        {
            string    query = string.Format($"select * from Roles");
            DataTable dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #2
0
        public string getRole(string username)
        {
            string    query = string.Format($"select roleid from Users where username='******'");
            DataTable dt    = cq.GetData(query);

            return(dt.Rows[0][0].ToString());
        }
Beispiel #3
0
        public DataTable getNhaPhanPhoiDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from NHAPHANPHOI where MaNPP = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #4
0
        public DataTable getKhuVucDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from KHUVUC where MaKhuVuc = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #5
0
        public DataTable getKhachHangDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from KHACHHANG where MAKH = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #6
0
        public DataTable getBangNhomHangDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from BANGNHOMHANG where MaNH = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #7
0
        public DataTable getBanDonViDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from BANGDONVI where MaDV = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #8
0
        public DataTable getHangHoaDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from HANGHOA where MaHH = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #9
0
        public DataTable getHangHoa()
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from HANGHOA");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #10
0
        public DataTable getBangNhomHang()
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from BANGNHOMHANG");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #11
0
        public DataTable getBanDonVi()
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from BANGDONVI");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #12
0
        public DataTable getKho()
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from Kho");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #13
0
        public DataTable getComboBoxRoles()
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from Roles");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #14
0
        public DataTable getUserDetail(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select r.*,u.* from Users u join Roles r on u.roleid = r.roleid where userid = '{mahanghoa}'");
            DataTable   dt    = cq.GetData(query);

            return(dt);
        }
Beispiel #15
0
        public int updateUser(DTOUser hanghoa)
        {
            CommonQuery cq     = new CommonQuery();
            string      query2 = string.Format($"select * from Roles where rolename = '{hanghoa.rolename}'");

            DataTable dt2 = cq.GetData(query2);

            hanghoa.roleid = dt2.Rows[0]["roleid"].ToString();

            string query = string.Format($"update Users set userpassword='******',roleid='{hanghoa.roleid}',isactive='{hanghoa.isactive}' where userid = '{hanghoa.userid}'");
            int    dt    = cq.ExecNonQuery(query);


            return(dt);
        }
Beispiel #16
0
        public bool insertUser(DTOUser hanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from Users where userid = '{hanghoa.userid}'");

            if (cq.ExecSelectedCount(query) > 0)
            {
                return(false);
            }


            string query2 = string.Format($"select * from Roles where rolename = '{hanghoa.rolename}'");

            DataTable dt2 = cq.GetData(query2);

            hanghoa.roleid = dt2.Rows[0]["roleid"].ToString();

            query = string.Format($"insert into Users values('{hanghoa.userid}','{hanghoa.username}'," +
                                  $"'{hanghoa.userpassword}','{hanghoa.userfullname}','{hanghoa.roleid}','{hanghoa.isactive}')");
            int dt = cq.ExecNonQuery(query);

            return(true);
        }