예제 #1
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);
        }
예제 #2
0
        public DataTable getBangNhomHang()
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"select * from BANGNHOMHANG");
            DataTable   dt    = cq.GetData(query);

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

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

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

            return(dt);
        }
예제 #6
0
        public int removeBangDonVi(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"delete from BANGDONVI where MaDV = '{mahanghoa}'");
            int         dt    = cq.ExecNonQuery(query);

            return(dt);
        }
예제 #7
0
        public int removeBangNhomHang(string mahanghoa)
        {
            CommonQuery cq    = new CommonQuery();
            string      query = string.Format($"delete from BANGNHOMHANG where MaNH = '{mahanghoa}'");
            int         dt    = cq.ExecNonQuery(query);

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

            return(dt);
        }
예제 #9
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);
        }
예제 #10
0
        public int removeUser(string mahanghoa)
        {
            CommonQuery cq = new CommonQuery();

            string query = string.Format($"delete from Users where userid = '{mahanghoa}'");
            int    dt    = cq.ExecNonQuery(query);

            return(dt);
        }
예제 #11
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);
        }
예제 #12
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);
        }