public ReturnValue GetList(int intStart, int intEnd,Drug model) { string strPageWhere = " Where TB.ROWNO >= @PageStart and TB.ROWNO<=@PageEnd "; string strWhere = string.Empty; SqlParameter[] parameters = {new SqlParameter("@PageStart", SqlDbType.Int), new SqlParameter("@PageEnd", SqlDbType.Int), new SqlParameter("@ProvinceCode", SqlDbType.NVarChar,50)}; parameters[0].Value = intStart; parameters[1].Value = intEnd; parameters[2].Value = model.ProvinceCode; if (model.ChinaName.Length > 0)//ҩƷ���� { strWhere += " And Drug.ChinaName Like '%" + model.ChinaName + "%' "; } if (model.Type2.Trim() != "999")//�������� { strWhere += " And Drug.Type2 = '" + model.Type2 + "' "; } if (model.DrugClassCode.Trim() != "999")//ҩƷ���� { strWhere += " And Drug.type2 + right('0'+replace(Convert(Varchar(2),DrugClassCode),'.',''),2) = '" + model.DrugClassCode + "' "; } return SqlHelper.Query(GetList_SQL.Replace("@@@", strWhere) + strPageWhere, parameters); }
public ReturnValue GetListCount(Drug model) { string strWhere = string.Empty; if (model.ChinaName.Length > 0)//ҩƷ���� { strWhere += " And ChinaName Like '%"+model.ChinaName+"%' "; } if (model.Type2.Trim() != "999")//�������� { strWhere += " And Type2 = '" + model.Type2 + "' "; } if (model.DrugClassCode.Trim() != "999")//ҩƷ���� { strWhere += " And type2 + right('0'+replace(Convert(Varchar(2),DrugClassCode),'.',''),2) = '" + model.DrugClassCode + "' "; } return SqlHelper.Query(GetListCount_SQL.Replace("@@@",strWhere)); }
/// <summary> /// /// </summary> /// <returns></returns> public ReturnValue GetList(int intPageNum,Drug model) { int intRowCount = 0; int intPageStart = 0; int intPageEnd = 0; ReturnValue returnV = dal.GetListCount(model); if (returnV.ErrorFlag) { intRowCount = returnV.Count; } else { return returnV; } intPageStart = (intPageNum - 1) * COM.GlobalVal.gloPage + 1; intPageEnd = intPageNum * COM.GlobalVal.gloPage; returnV = dal.GetList(intPageStart,intPageEnd,model); if (returnV.ErrorFlag) { returnV.Count = intRowCount; } return returnV; }