|
@@ -705,12 +705,8 @@ |
705 |
705 |
|
|
706 |
706 |
|
if (res.Successful == false) |
707 |
707 |
|
{ |
708 |
|
- |
//set the properties on this instance so the calling party knows what happened |
709 |
708 |
|
DatabaseConnectionStatus = ConnectionStatus.LoginFailed; |
710 |
|
- |
|
711 |
|
- |
//display a formatted error dialog with as much detail as we can muster about the failure reason |
712 |
709 |
|
RaiseErrorEvent("(error) while changing databases in ChangeActiveDatabase: " + res); |
713 |
|
- |
|
714 |
710 |
|
} |
715 |
711 |
|
|
716 |
712 |
|
//update the status to show connected status |
|
@@ -719,30 +715,7 @@ |
719 |
715 |
|
return true; |
720 |
716 |
|
} |
721 |
717 |
|
|
722 |
|
- |
/// <summary> |
723 |
|
- |
/// Simple method that determins if the database name string is a valid Unity Connection database |
724 |
|
- |
/// </summary> |
725 |
|
- |
/// <param name="pDbName"></param> |
726 |
|
- |
/// <returns></returns> |
727 |
|
- |
public static bool IsValidDatabaseName(string pDbName) |
728 |
|
- |
{ |
729 |
|
- |
//make sure the DB name is valid |
730 |
|
- |
switch (pDbName.ToUpper()) |
731 |
|
- |
{ |
732 |
|
- |
case "UNITYDIRDB": |
733 |
|
- |
case "UNITYDYNDB": |
734 |
|
- |
case "UNITYRPTDB": |
735 |
|
- |
case "UNITYMBXDB1": |
736 |
|
- |
case "UNITYMBXDB2": |
737 |
|
- |
case "UNITYMBXDB3": |
738 |
|
- |
case "UNITYMBXDB4": |
739 |
|
- |
case "UNITYMBXDB5": |
740 |
|
- |
case "UNITYMBXDB6": |
741 |
|
- |
return true; |
742 |
|
- |
} |
743 |
|
- |
|
744 |
|
- |
return false; |
745 |
|
- |
} |
|
718 |
+ |
|
746 |
719 |
|
|
747 |
720 |
|
/// <summary> |
748 |
721 |
|
///this function calls the stored procs necessary to tell the grammar compilation engine to wait until we're done before recompiling |
|
@@ -922,21 +895,14 @@ |
922 |
895 |
|
/// <param name="pMinimumDigits" type="int"> |
923 |
896 |
|
/// Optional value for minimum length - defaults to 0 which is legal on many objects (though not users). |
924 |
897 |
|
/// </param> |
925 |
|
- |
/// <param name="pAllowBlank" type="bool"> |
926 |
|
- |
/// Defaults to true which is ok for some object types (though not users). |
927 |
|
- |
/// </param> |
928 |
|
- |
/// <param name="pDisplayErrorReasons" type="bool"> |
929 |
|
- |
/// defaults to FALSE which means no message boxes are presented to the user. TRUE causes messages boxes with the specific |
930 |
|
- |
/// failure reason to be displayed to the user for information purposes (for instance if they are filling in values on a form). |
931 |
|
- |
/// </param> |
932 |
898 |
|
/// <returns> |
933 |
899 |
|
/// TRUE is returned if the string is a valid extension, FALSE otherwise. |
934 |
900 |
|
/// </returns> |
935 |
|
- |
public static bool IsValidExtension(string pExtension, int pMinimumDigits = 0, bool pAllowBlank = true, bool pDisplayErrorReasons = false) |
|
901 |
+ |
public static bool IsValidExtension(string pExtension, int pMinimumDigits = 0) |
936 |
902 |
|
{ |
937 |
903 |
|
if (string.IsNullOrEmpty(pExtension)) |
938 |
904 |
|
{ |
939 |
|
- |
if (pAllowBlank) |
|
905 |
+ |
if (pMinimumDigits==0) |
940 |
906 |
|
{ |
941 |
907 |
|
//special case of blank being valid - for handlers this is true, for users it is not |
942 |
908 |
|
return true; |
|
@@ -948,38 +914,19 @@ |
948 |
914 |
|
|
949 |
915 |
|
if (pExtension.Length < pMinimumDigits) |
950 |
916 |
|
{ |
951 |
|
- |
if (pDisplayErrorReasons) |
952 |
|
- |
{ |
953 |
|
- |
MessageBox.Show(@"Extensions must be at least " + pMinimumDigits.ToString() + @" digits in length"); |
954 |
|
- |
} |
955 |
917 |
|
return false; |
956 |
918 |
|
} |
957 |
919 |
|
|
958 |
|
- |
//if the calling function allows for empty extensions, bail out here... the rest of the checks will fail |
959 |
|
- |
//in that case. |
960 |
|
- |
if ((pExtension.Length == 0) && (pMinimumDigits == 0)) |
961 |
|
- |
{ |
962 |
|
- |
return true; |
963 |
|
- |
} |
964 |
|
- |
|
965 |
920 |
|
long lTemp; |
966 |
921 |
|
|
967 |
922 |
|
if (long.TryParse(pExtension, out lTemp) == false) |
968 |
923 |
|
{ |
969 |
|
- |
if (pDisplayErrorReasons) |
970 |
|
- |
{ |
971 |
|
- |
MessageBox.Show(@"Only numbers are allowed for the extension number"); |
972 |
|
- |
} |
973 |
924 |
|
return false; |
974 |
925 |
|
} |
975 |
926 |
|
|
976 |
927 |
|
//check for negative |
977 |
928 |
|
if (lTemp < 0) |
978 |
929 |
|
{ |
979 |
|
- |
if (pDisplayErrorReasons) |
980 |
|
- |
{ |
981 |
|
- |
MessageBox.Show(@"Only non negative numbers are allowed for the extension number"); |
982 |
|
- |
} |
983 |
930 |
|
return false; |
984 |
931 |
|
} |
985 |
932 |
|
|
|
@@ -1007,6 +954,31 @@ |
1007 |
954 |
|
return 0; |
1008 |
955 |
|
} |
1009 |
956 |
|
|
|
957 |
+ |
/// <summary> |
|
958 |
+ |
/// Simple method that determins if the database name string is a valid Unity Connection database |
|
959 |
+ |
/// </summary> |
|
960 |
+ |
/// <param name="pDbName"></param> |
|
961 |
+ |
/// <returns></returns> |
|
962 |
+ |
public static bool IsValidDatabaseName(string pDbName) |
|
963 |
+ |
{ |
|
964 |
+ |
//make sure the DB name is valid |
|
965 |
+ |
switch (pDbName.ToUpper()) |
|
966 |
+ |
{ |
|
967 |
+ |
case "UNITYDIRDB": |
|
968 |
+ |
case "UNITYDYNDB": |
|
969 |
+ |
case "UNITYRPTDB": |
|
970 |
+ |
case "UNITYMBXDB1": |
|
971 |
+ |
case "UNITYMBXDB2": |
|
972 |
+ |
case "UNITYMBXDB3": |
|
973 |
+ |
case "UNITYMBXDB4": |
|
974 |
+ |
case "UNITYMBXDB5": |
|
975 |
+ |
case "UNITYMBXDB6": |
|
976 |
+ |
return true; |
|
977 |
+ |
} |
|
978 |
+ |
|
|
979 |
+ |
return false; |
|
980 |
+ |
} |
|
981 |
+ |
|
1010 |
982 |
|
#endregion |
1011 |
983 |
|
|
1012 |
984 |
|
} |