190724
This commit is contained in:
@@ -17,16 +17,57 @@ using System.Windows.Forms;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public static partial class Util
|
||||
public static partial class Util
|
||||
{
|
||||
public static bool IsNumeric( string input)
|
||||
|
||||
#region "flag"
|
||||
|
||||
|
||||
//public static Boolean getBit(ref Int32 flag_, int idx)
|
||||
//{
|
||||
// return getBit(ref (UInt32)flag_, idx);
|
||||
//}
|
||||
public static Boolean getBit( Int32 flag_, int idx)
|
||||
{
|
||||
var offset = (UInt32)(1 << (int)idx);
|
||||
return ((flag_ & offset) != 0);
|
||||
}
|
||||
public static void toggleBit(ref Int32 flag_, int idx)
|
||||
{
|
||||
var curValue = getBit( flag_, idx);
|
||||
setBit(ref flag_, idx, !curValue);
|
||||
}
|
||||
// public static void setBit(ref Int32 flag_, int idx, Boolean value)
|
||||
//{
|
||||
// setBit(ref (UInt32)flag_, idx, value);
|
||||
//}
|
||||
public static void setBit(ref Int32 flag_, int idx, Boolean value)
|
||||
{
|
||||
UInt32 ovalue = (UInt32)flag_;
|
||||
if (value)
|
||||
{
|
||||
var offset = (UInt32)(1 << (int)idx);
|
||||
ovalue = ovalue | offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
var offset = (UInt32)(~(1 << (int)idx));
|
||||
ovalue = ovalue & offset;
|
||||
}
|
||||
flag_ = (Int32)ovalue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public static bool IsNumeric(string input)
|
||||
{
|
||||
double data;
|
||||
return double.TryParse(input, out data);
|
||||
//return Regex.IsMatch(input, @"^\d+$");
|
||||
}
|
||||
|
||||
public static string MakeFilterString(string[] cols,string search)
|
||||
public static string MakeFilterString(string[] cols, string search)
|
||||
{
|
||||
|
||||
|
||||
@@ -36,9 +77,9 @@ namespace FCOMMON
|
||||
if (filterStr != "") filterStr += " OR ";
|
||||
filterStr += string.Format("isnull({0},'') like '%#%'", col);
|
||||
}
|
||||
return filterStr.Replace("#", search.Replace("'","''"));
|
||||
return filterStr.Replace("#", search.Replace("'", "''"));
|
||||
}
|
||||
public static void CopyData(System.Data.DataRow drFrom, System.Data.DataRow drTo)
|
||||
public static void CopyData(System.Data.DataRow drFrom, System.Data.DataRow drTo)
|
||||
{
|
||||
for (int i = 0; i < drFrom.ItemArray.Length; i++)
|
||||
drTo[i] = drFrom[i];
|
||||
@@ -246,7 +287,7 @@ namespace FCOMMON
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
public static void SaveBugReport(string content, string subdirName = "BugReport")
|
||||
{
|
||||
@@ -463,9 +504,9 @@ namespace FCOMMON
|
||||
si.Arguments = arg;
|
||||
System.Diagnostics.Process.Start(si);
|
||||
}
|
||||
public static void RunDefaultMail(string to,string title,string content="",string cc="",string bcc="")
|
||||
public static void RunDefaultMail(string to, string title, string content = "", string cc = "", string bcc = "")
|
||||
{
|
||||
string args = "mailto:" + to + "?";
|
||||
string args = "mailto:" + to + "?";
|
||||
if (title != "") args += "subject=" + title;
|
||||
args += "&IsBodyHtml=true";
|
||||
if (content != "")
|
||||
@@ -475,7 +516,7 @@ namespace FCOMMON
|
||||
}
|
||||
if (bcc != "")
|
||||
{
|
||||
if (!args.EndsWith("?")) args += "&";
|
||||
if (!args.EndsWith("?")) args += "&";
|
||||
args += "bcc=" + bcc;
|
||||
}
|
||||
if (cc != "")
|
||||
@@ -488,9 +529,9 @@ namespace FCOMMON
|
||||
if (!args.EndsWith("?")) args += "&";
|
||||
args += "bcc=" + bcc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.Diagnostics.Process.Start(args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user