/// <summary> /// Search data from /// </summary> /// <param name="dt"></param> /// <param name="userName"></param> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="email"></param> /// <param name="roleID"></param> /// <param name="status"></param> /// <returns></returns> /// <remarks> /// Author: PhatLT. FPTSS. /// Created date: 14/02/2011 /// </remarks> public DataTable Search(DataTable dt, string userName, string firstName, string lastName, string email, string roleID, string status) { clsCommon common = new clsCommon(); string strSql = "SELECT USERNAME, PASSWORD, FIRSTNAME, LASTNAME, EMAIL, ADDRESS, PHONE, START_DATE, END_DATE, PWD_CHG_DATE, STATUS, UROLE_ID, DESCRIPTION FROM GENERAL_AUT_USER"; StringBuilder sb = new StringBuilder(); if (userName != null && userName.Length > 0) { sb.Append(string.Format(" AND USERNAME LIKE '{0}' ", common.EncodeKeyword(userName))); } if (roleID != null && roleID.Length > 0) { sb.Append(string.Format(" AND UROLE_ID = '{0}' ", common.EncodeString(roleID))); } if (status != null && status.Length > 0) { sb.Append(string.Format(" AND STATUS = '{0}' ", common.EncodeString(status))); } if (firstName != null && firstName.Length > 0) { sb.Append(string.Format(" AND FIRSTNAME LIKE '{0}' ", common.EncodeKeyword(firstName))); } if (lastName != null && lastName.Length > 0) { sb.Append(string.Format(" AND LASTNAME LIKE '{0}' ", common.EncodeKeyword(lastName))); } if (email != null && email.Length > 0) { sb.Append(string.Format(" AND EMAIL LIKE '{0}' ", common.EncodeKeyword(email))); } if (sb.Length > 0) { strSql = strSql + " WHERE " + sb.ToString(4, sb.Length - 4); } return(dao.GetDataTable(dt, strSql)); }
public DataTable CheckIsExistAcount(string URoleID) { clsCommon common = new clsCommon(); string strSql = "SELECT * FROM GENERAL_AUT_USER "; StringBuilder sb = new StringBuilder(); if (URoleID != null && URoleID.Length > 0) { sb.Append(string.Format(" UROLE_ID LIKE '{0}' ", common.EncodeKeyword(URoleID))); } if (sb.Length > 0) { strSql = strSql + " WHERE " + sb.ToString(); } return(dao.GetDataTable(strSql)); }