string ISearchCriteria.GetSqlSearchCondition() { // string strOp; // switch (compareOperator) { // case CompareOperator.Equal: // strOp = "="; // break; // case CompareOperator.Greater: // strOp = ">"; // break; // case CompareOperator.GreaterOrEqual: // strOp = ">="; // break; // case CompareOperator.Less: // strOp = "<"; // break; // case CompareOperator.LessOrEqual: // strOp = "<="; // break; // case CompareOperator.NotEqual: // strOp = "<>"; // break; // default: // throw new Exception("Invalid CompareOperator."); // } // return string.Format("(Items.Size {0} {1}) AND (ItemType = {2})", strOp, fileSize, (int)VolumeItemType.FileVolumeItem); return(string.Format("({0}) AND (Items.ItemType = {1})", compareOperator.GetSqlCompareString("Items.Size", fileSize.ToString()), (int)VolumeItemType.FileVolumeItem)); }
/* get the sql search condition of this/these field/fields */ internal string GetSqlSearchCondition(long quantity, CompareOperator compareOperator, MatchRule fieldMatchRule) { StringBuilder sql = new StringBuilder(); string strQuantity = quantity.ToString(); if (this.ContainsField(Files)) { SearchUtils.Append(sql, compareOperator.GetSqlCompareString("Volumes.Files", strQuantity), fieldMatchRule); } if (this.ContainsField(Dirs)) { SearchUtils.Append(sql, compareOperator.GetSqlCompareString("Volumes.Dirs", strQuantity), fieldMatchRule); } if (this.ContainsField(Size)) { SearchUtils.Append(sql, compareOperator.GetSqlCompareString("Volumes.Size", strQuantity), fieldMatchRule); } return(sql.ToString()); }
/* get the sql search condition of this field */ internal string GetSqlSearchCondition(long id, CompareOperator compareOperator) { string fieldName = string.Empty; if (this == IDSearchField.ItemID) { fieldName = "ItemID"; } else if (this == IDSearchField.ParentID) { fieldName = "ParentID"; } else if (this == IDSearchField.VolumeID) { fieldName = "VolumeID"; } else { throw new NotImplementedException(string.Format("IDSearchField {0} not implemented", value)); } return(compareOperator.GetSqlCompareString(fieldName, id.ToString())); }
/* get the sql search condition of this field */ internal string GetSqlSearchCondition(long id, CompareOperator compareOperator) { string fieldName = string.Empty; if (this == IDSearchField.ItemID) fieldName = "ItemID"; else if (this == IDSearchField.ParentID) fieldName = "ParentID"; else if (this == IDSearchField.VolumeID) fieldName = "VolumeID"; else throw new NotImplementedException(string.Format("IDSearchField {0} not implemented", value)); return compareOperator.GetSqlCompareString(fieldName, id.ToString()); }
/* get the sql search condition of this/these field/fields */ internal string GetSqlSearchCondition(long quantity, CompareOperator compareOperator, MatchRule fieldMatchRule) { StringBuilder sql = new StringBuilder(); string strQuantity = quantity.ToString(); if (this.ContainsField(Files)) SearchUtils.Append(sql, compareOperator.GetSqlCompareString("Volumes.Files", strQuantity), fieldMatchRule); if (this.ContainsField(Dirs)) SearchUtils.Append(sql, compareOperator.GetSqlCompareString("Volumes.Dirs", strQuantity), fieldMatchRule); if (this.ContainsField(Size)) SearchUtils.Append(sql, compareOperator.GetSqlCompareString("Volumes.Size", strQuantity), fieldMatchRule); return sql.ToString(); }