private void frmPermissionField_Load(object sender, EventArgs e) { cboValue.Items.Clear(); cboValue.Items.AddRange(SPECIAL_COMMAND_VERBIAGE.ToArray()); cboParentValue.Items.Clear(); cboParentValue.Items.AddRange(SPECIAL_COMMAND_VERBIAGE.ToArray()); }
private bool checkSpecialValues(ComboBox cbo, Label lbl) { // special commands don't have to pass type checking as they'll be replaced @ permission calculation time for a request by the middle tier var text = getSpecialCommandFromVerbiage(cbo.Text); if (!SPECIAL_COMMAND_VERBIAGE.Contains(text)) { switch (lblType.Text.ToLower()) { case "string": if (cbo.Text.Trim().Length == 0) { MessageBox.Show(getDisplayMember("checkSpecialValues{compare}", "A value to compare against must be specified.")); cbo.Focus(); cbo.SelectAll(); return(false); } break; case "integer": if (Toolkit.ToInt32(cbo.Text, int.MinValue + 1) == int.MinValue + 1) { MessageBox.Show(getDisplayMember("checkSpecialValues{notint}", "A valid integer value must be specified.")); cbo.Focus(); cbo.SelectAll(); return(false); } break; case "datetime": if (Toolkit.ToDateTime(cbo.Text, DateTime.MinValue.AddHours(2)) == DateTime.MinValue.AddHours(2)) { MessageBox.Show(getDisplayMember("checkSpecialValues{notdate}", "A valid date value must be specified.")); cbo.Focus(); cbo.SelectAll(); return(false); } break; case "decimal": case "float": case "double": if (Toolkit.ToDecimal(cbo.Text, decimal.MinValue + 1) == decimal.MinValue + 1) { MessageBox.Show(getDisplayMember("chkSpecialValues{notdecimal}", "A valid decimal value must be specified.")); cbo.Focus(); cbo.SelectAll(); return(false); } break; } } return(true); }