public int UpdateById(C_ERROR_CODE NewErrorCode, OleExec DB) { Row_C_ERROR_CODE NewErrorCodeRow = (Row_C_ERROR_CODE)NewRow(); NewErrorCodeRow.ID = NewErrorCode.ID; NewErrorCodeRow.ERROR_CODE = NewErrorCode.ERROR_CODE; NewErrorCodeRow.ENGLISH_DESCRIPTION = NewErrorCode.ENGLISH_DESCRIPTION; NewErrorCodeRow.CHINESE_DESCRIPTION = NewErrorCode.CHINESE_DESCRIPTION; NewErrorCodeRow.EDIT_EMP = NewErrorCode.EDIT_EMP; NewErrorCodeRow.EDIT_TIME = NewErrorCode.EDIT_TIME; int result = DB.ExecuteNonQuery(NewErrorCodeRow.GetUpdateString(DBType, NewErrorCode.ID), CommandType.Text); return(result); }
public C_ERROR_CODE GetByid(string id, OleExec DB) { string strSql = $@"select * from c_error_code where id=:id"; OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":id", id) }; DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); if (res.Rows.Count > 0) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[0]); return(ret.GetDataObject()); } else { return(null); } }
public C_ERROR_CODE GetByErrorCode(string ErrorCode, OleExec DB) { //string strSql = $@"select * from c_error_code where error_code=:ErrorCode"; string strSql = $@"select * from c_error_code where error_code='{ErrorCode}'"; //OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":ErrorCode", ErrorCode) }; //DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, null); if (res.Rows.Count > 0) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[0]); return(ret.GetDataObject()); } else { return(null); } }
public List <C_ERROR_CODE> GetByFuzzySearch(string ParametValue, OleExec DB) { string strSql = $@"select * from c_error_code where upper(error_code) like'%{ParametValue}%' or upper(english_description) like'%{ParametValue}%' or upper(chinese_description) like'%{ParametValue}%'"; List <C_ERROR_CODE> result = new List <C_ERROR_CODE>(); DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text); if (res.Rows.Count > 0) { for (int i = 0; i < res.Rows.Count; i++) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[i]); result.Add(ret.GetDataObject()); } return(result); } else { return(null); } }
public List <C_ERROR_CODE> GetAllErrorCode(OleExec DB) { string strSql = $@"select * from c_error_code "; List <C_ERROR_CODE> result = new List <C_ERROR_CODE>(); DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text); if (res.Rows.Count > 0) { for (int i = 0; i < res.Rows.Count; i++) { Row_C_ERROR_CODE ret = (Row_C_ERROR_CODE)NewRow(); ret.loadData(res.Rows[i]); result.Add(ret.GetDataObject()); } return(result); } else { return(null); } }