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); }
public DataTable getBangNhomHang() { CommonQuery cq = new CommonQuery(); string query = string.Format($"select * from BANGNHOMHANG"); DataTable dt = cq.GetData(query); return(dt); }
public DataTable getHangHoa() { CommonQuery cq = new CommonQuery(); string query = string.Format($"select * from HANGHOA"); DataTable dt = cq.GetData(query); return(dt); }
public DataTable getKho() { CommonQuery cq = new CommonQuery(); string query = string.Format($"select * from Kho"); DataTable dt = cq.GetData(query); return(dt); }
public DataTable getBanDonVi() { CommonQuery cq = new CommonQuery(); string query = string.Format($"select * from BANGDONVI"); DataTable dt = cq.GetData(query); return(dt); }
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); }
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); }
public DataTable getComboBoxRoles() { CommonQuery cq = new CommonQuery(); string query = string.Format($"select * from Roles"); DataTable dt = cq.GetData(query); return(dt); }
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); }
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); }
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); }
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); }