public bool FilterCommitBefore(CFilter filter) { if (api.Request[api.AddPluginPrefix("HoursFilterType")] != null) { var pluginField = filter.GetPluginField(Statics.PluginId, "HoursFilterType"); PreCommitHoursSelection = pluginField == null ? "Unset" : pluginField.ToString(); var newValue = api.Request[api.AddPluginPrefix("HoursFilterType")].ToLower(); FilterType type = FilterType.Unset; switch (newValue) { case "yes": type = FilterType.Yes; break; case "no": type = FilterType.No; break; } filter.SetPluginField(Statics.PluginId, "HoursFilterType", type.ToString()); } if (api.Request[api.AddPluginPrefix("SplitFilterType")] != null) { var pluginField = filter.GetPluginField(Statics.PluginId, "SplitFilterType"); PreCommitSplitSelection = pluginField == null ? "Unset" : pluginField.ToString(); var newValue = api.Request[api.AddPluginPrefix("SplitFilterType")].ToLower(); FilterType type = FilterType.Unset; switch (newValue) { case "yes": type = FilterType.Yes; break; case "no": type = FilterType.No; break; } filter.SetPluginField(Statics.PluginId, "SplitFilterType", type.ToString()); } return true; }
public void FilterCommitRollback(CFilter filter) { filter.SetPluginField(Statics.PluginId, "HoursFilterType", PreCommitHoursSelection); filter.SetPluginField(Statics.PluginId, "SplitFilterType", PreCommitSplitSelection); }
/// <summary> /// Read the filter's ixPersonOriginallyOpenedBy. If it's invalid, fix it (set it to "any") /// </summary> /// <param name="filter">Filter to check (and possibly update)</param> /// <returns>The validated ixPersonOriginallyOpenedBy</returns> protected int GetFieldValueFromFilter(CFilter filter) { filter.IgnorePermissions = true; int ixPersonFromFilter = Convert.ToInt32(filter.GetPluginField(PLUGIN_ID, PLUGIN_FIELD_NAME)); if (!IsValidPerson(ixPersonFromFilter)) { ixPersonFromFilter = IXPERSON_ANY; filter.SetPluginField(PLUGIN_ID, PLUGIN_FIELD_NAME, ixPersonFromFilter); } return ixPersonFromFilter; }
public void FilterCommitRollback(CFilter Filter) { Filter.SetPluginField(PLUGIN_ID, PLUGIN_FIELD_NAME, ixPersonOriginallyOpenedByPreCommit); }
public bool FilterCommitBefore(CFilter Filter) { if (api.Request[sPluginFieldNamePrefixed] != null) { ixPersonOriginallyOpenedByPreCommit = Convert.ToInt32(Filter.GetPluginField(PLUGIN_ID, PLUGIN_FIELD_NAME)); int ixPersonOriginallyOpenedBy = IXPERSON_INVALID; /* use tryparse in case the URL querystring value isn't a valid integer */ if (Int32.TryParse(api.Request[sPluginFieldNamePrefixed].ToString(), out ixPersonOriginallyOpenedBy)) { // if the requested value isn't an actual CPerson, set the plugin field to "any" if (!IsValidPerson(ixPersonOriginallyOpenedBy)) ixPersonOriginallyOpenedBy = IXPERSON_ANY; Filter.SetPluginField(PLUGIN_ID, PLUGIN_FIELD_NAME, ixPersonOriginallyOpenedBy); } } return true; }
public void FilterCommitRollback(CFilter Filter) { /* if the filter commit was aborted, reset the awesomeness * level to the pre-commit value */ Filter.SetPluginField(PLUGIN_ID, "ixAwesomness", preCommitAwesomenessLevel); }
public bool FilterCommitBefore(CFilter Filter) { /* Set the preCommitAwesomenessLevel member variable */ if (api.Request[api.AddPluginPrefix("ixAwesomeness")] != null) { int ixAwesomenessNew = -1; preCommitAwesomenessLevel = Convert.ToInt32(Filter.GetPluginField(PLUGIN_ID, "ixAwesomeness")); /* use tryparse in case the URL querystring value isn't a valid integer */ if (Int32.TryParse(api.Request[api.AddPluginPrefix("ixAwesomeness")].ToString(), out ixAwesomenessNew) && (ixAwesomenessNew > -1) ) Filter.SetPluginField(PLUGIN_ID, "ixAwesomeness", ixAwesomenessNew); } return true; }