This commit is contained in:
2026-07-01 09:07:14 +08:00
parent 3410de774e
commit 715e22707d
3 changed files with 62 additions and 63 deletions
+60 -61
View File
@@ -7,17 +7,17 @@ namespace BLL
using System.Text.RegularExpressions;
/// <summary>
/// ͨ�÷����ࡣ
/// 通用方法类。
/// </summary>
public static class Funs
{
/// <summary>
/// ά��һ��DB����
/// 维护一个DB集合
/// </summary>
private static Dictionary<int, Model.SGGLDB> dataBaseLinkList = new System.Collections.Generic.Dictionary<int, Model.SGGLDB>();
/// <summary>
/// ά��һ��DB����
/// 维护一个DB集合
/// </summary>
public static System.Collections.Generic.Dictionary<int, Model.SGGLDB> DBList
{
@@ -28,7 +28,7 @@ namespace BLL
}
/// <summary>
/// ���ݿ������ַ���
/// 数据库连接字符串
/// </summary>
private static string connString;
@@ -38,7 +38,7 @@ namespace BLL
public static string usingMatId;
/// <summary>
/// ���ݿ������ַ�����
/// 数据库连结字符串。
/// </summary>
public static string ConnString
{
@@ -46,7 +46,7 @@ namespace BLL
{
if (connString == null)
{
throw new NotSupportedException("�����������ַ�����");
throw new NotSupportedException("请设置连接字符串!");
}
return connString;
@@ -56,7 +56,7 @@ namespace BLL
{
if (connString != null)
{
throw new NotSupportedException("���������ã�");
throw new NotSupportedException("连接已设置!");
}
connString = value;
@@ -70,7 +70,7 @@ namespace BLL
}
/// <summary>
/// �����
/// 单位设置
/// </summary>
public static string UnitSet
{
@@ -79,7 +79,7 @@ namespace BLL
}
/// <summary>
/// ·��
/// 路径
/// </summary>
public static string RootPath
{
@@ -88,7 +88,7 @@ namespace BLL
}
/// <summary>
/// ϵͳ��
/// 系统名
/// </summary>
public static string SystemName
{
@@ -96,7 +96,7 @@ namespace BLL
set;
}
/// <summary>
/// AD����
/// AD域名
/// </summary>
public static string ADomainUrl
{
@@ -104,7 +104,7 @@ namespace BLL
set;
}
/// <summary>
/// APP���ص�ַ
/// APP下载地址
/// </summary>
public static string APPUrl
{
@@ -122,7 +122,7 @@ namespace BLL
/// <summary>
/// ÿҳ����
/// 每页数量
/// </summary>
public static int PageSize
{
@@ -131,7 +131,7 @@ namespace BLL
} = 15;
/// <summary>
/// ���ݿ������ġ�
/// 数据库上下文。
/// </summary>
public static Model.SGGLDB DB
{
@@ -147,50 +147,50 @@ namespace BLL
}
/// <summary>
/// ΪĿ����������� "��ѡ��" ��
/// 为目标下拉框加上 "请选择" 项
/// </summary>
/// <param name="DLL">Ŀ��������</param>
/// <param name="DLL">目标下拉框</param>
public static void PleaseSelect(System.Web.UI.WebControls.DropDownList DDL)
{
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem("- ��ѡ�� -", "0"));
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem("- 请选择 -", "0"));
return;
}
/// <summary>
/// ΪĿ����������� "��ѡ��" ��
/// 为目标下拉框加上 "请选择" 项
/// </summary>
/// <param name="DLL">Ŀ��������</param>
/// <param name="DLL">目标下拉框</param>
public static void FineUIPleaseSelect(FineUIPro.DropDownList DDL)
{
DDL.Items.Insert(0, new FineUIPro.ListItem("- ��ѡ�� -", BLL.Const._Null));
DDL.Items.Insert(0, new FineUIPro.ListItem("- 请选择 -", BLL.Const._Null));
return;
}
/// <summary>
/// ΪĿ����������� "���±���" ��
/// 为目标下拉框加上 "重新编制" 项
/// </summary>
/// <param name="DLL">Ŀ��������</param>
/// <param name="DLL">目标下拉框</param>
public static void ReCompileSelect(System.Web.UI.WebControls.DropDownList DDL)
{
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem("���±���", "0"));
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem("重新编制", "0"));
return;
}
/// <summary>
/// ΪĿ����������� "���±���" ��
/// 为目标下拉框加上 "重新编制" 项
/// </summary>
/// <param name="DLL">Ŀ��������</param>
/// <param name="DLL">目标下拉框</param>
public static void FineUIReCompileSelect(FineUIPro.DropDownList DDL)
{
DDL.Items.Insert(0, new FineUIPro.ListItem("���±���", "0"));
DDL.Items.Insert(0, new FineUIPro.ListItem("重新编制", "0"));
return;
}
/// <summary>
/// �ַ����Ƿ�Ϊ������
/// 字符串是否为浮点数
/// </summary>
/// <param name="decimalStr">Ҫ�����ַ���</param>
/// <returns>�����ǻ��</returns>
/// <param name="decimalStr">要检查的字符串</param>
/// <returns>返回是或否</returns>
public static bool IsDecimal(string decimalStr)
{
if (String.IsNullOrEmpty(decimalStr))
@@ -211,10 +211,10 @@ namespace BLL
}
/// <summary>
/// �ж�һ���ַ����Ƿ�������
/// 判断一个字符串是否是整数
/// </summary>
/// <param name="integerStr">Ҫ�����ַ���</param>
/// <returns>�����ǻ��</returns>
/// <param name="integerStr">要检查的字符串</param>
/// <returns>返回是或否</returns>
public static bool IsInteger(string integerStr)
{
if (String.IsNullOrEmpty(integerStr))
@@ -235,10 +235,10 @@ namespace BLL
}
/// <summary>
/// ��ȡ�µ�����
/// 获取新的数字
/// </summary>
/// <param name="number">Ҫת��������</param>
/// <returns>�µ�����</returns>
/// <param name="number">要转换的数字</param>
/// <returns>新的数字</returns>
public static string InterceptDecimal(object number)
{
if (number == null)
@@ -285,11 +285,11 @@ namespace BLL
}
/// <summary>
/// �ж��ַ����ӵ�nλ��ʼ�Ժ��Ƿ�Ϊ0
/// 判断字符串从第n位开始以后是否都为0
/// </summary>
/// <param name="number">Ҫ�жϵ��ַ���</param>
/// <param name="n">��ʼ��λ��</param>
/// <returns>false����Ϊ0��true��Ϊ0</returns>
/// <param name="number">要判断的字符串</param>
/// <param name="n">开始的位数</param>
/// <returns>false不都为0,true都为0</returns>
public static bool GetStr(string number, int n)
{
for (int i = n; i < number.Length; i++)
@@ -303,11 +303,11 @@ namespace BLL
}
/// <summary>
/// ��ȡ�ַ�������
/// 截取字符串长度
/// </summary>
/// <param name="str">Ҫ��ȡ���ַ���</param>
/// <param name="n">����</param>
/// <returns>��ȡ���ַ���</returns>
/// <param name="str">要截取的字符串</param>
/// <param name="n">长度</param>
/// <returns>截取后字符串</returns>
public static string GetSubStr(object str, object n)
{
if (str != null)
@@ -326,7 +326,7 @@ namespace BLL
/// <summary>
/// �����ı�ת��ʱ������
/// 输入文本转换时间类型
/// </summary>
/// <returns></returns>
public static DateTime? GetNewDateTime(string time)
@@ -350,7 +350,7 @@ namespace BLL
}
/// <summary>
/// �����ı�ת������
/// 输入文本转换数字
/// </summary>
/// <returns></returns>
public static decimal? GetNewDecimal(string value)
@@ -374,7 +374,7 @@ namespace BLL
}
/// <summary>
/// �����ı�ת������
/// 输入文本转换数字
/// </summary>
/// <returns></returns>
public static decimal GetNewDecimalOrZero(string value)
@@ -388,7 +388,7 @@ namespace BLL
}
catch (Exception)
{
// 如果直接解析失败(如带单位 "10M", "5KM", "3KG"),取前面的数字部分
// 如果直接解析失败(如带单位 "10M", "5KM", "3KG"),取前面的数字部分
try
{
Match match = Regex.Match(value, @"\d+\.?\d*");
@@ -408,7 +408,7 @@ namespace BLL
}
/// <summary>
/// 从qty字符串中提取单位(如 "10M" → "M", "5KG" → "KG", "33.4 mm" → "mm", "10" → "")
/// 从qty字符串中提取单位(如 "10M" → "M", "5KG" → "KG", "33.4 mm" → "mm", "10" → "")
/// </summary>
public static string GetUnitFromQty(string value)
{
@@ -419,9 +419,8 @@ namespace BLL
return "";
}
/// <summary>
/// �����ı�ת����������
/// 输入文本转换数字类型
/// </summary>
/// <returns></returns>
public static int? GetNewInt(string value)
@@ -445,7 +444,7 @@ namespace BLL
}
/// <summary>
/// �����ı�ת����������
/// 输入文本转换数字类型
/// </summary>
/// <returns></returns>
public static int GetNewIntOrZero(string value)
@@ -467,7 +466,7 @@ namespace BLL
}
/// <summary>
/// ָ���ϴ��ļ�������
/// 指定上传文件的名称
/// </summary>
/// <returns></returns>
public static string GetNewFileName()
@@ -477,7 +476,7 @@ namespace BLL
}
/// <summary>
/// ���ݱ�ʶ�����ַ���list
/// 根据标识返回字符串list
/// </summary>
/// <param name="str"></param>
/// <param name="n"></param>
@@ -494,24 +493,24 @@ namespace BLL
}
/// <summary>
/// ���ݵ�һҳ�͵ڶ�ҳ�������ܼ�¼����ȷ����Ҫ��ӡ��ҳ
/// 根据第一页和第二页行数及总记录数,确定需要打印几页
/// </summary>
/// <param name="pageSize1">��һҳ����</param>
/// <param name="pageSize2">�ڶ�ҳ����</param>
/// <param name="count">�ܼ�¼��</param>
/// <param name="pageSize1">第一页行数</param>
/// <param name="pageSize2">第二页行数</param>
/// <param name="count">总记录数</param>
/// <returns></returns>
public static int GetPagesCountByPageSize(int pageSize1, int pageSize2, int count)
{
int pagesCount = 0;
if (pageSize1 >= count) //�ܼ�¼��С�ڵ��ڵ�һҳ����
if (pageSize1 >= count) //总记录数小于等于第一页行数
{
pagesCount = 1;
}
else if (count > pageSize1 && count <= (pageSize1 + pageSize2)) //�ܼ�¼�����ڵ�һҳ������С�ڵ��ڵ�һҳ�ӵڶ�ҳ������
else if (count > pageSize1 && count <= (pageSize1 + pageSize2)) //总记录数大于第一页行数且小于等于第一页加第二页总行数
{
pagesCount = 2;
}
else //�ܼ�¼�����ڵ�һҳ�ӵڶ�ҳ������
else //总记录数大于第一页加第二页总行数
{
int lastCount = count - pageSize1;
decimal c = Convert.ToDecimal(Math.Round(Convert.ToDecimal(lastCount) / Convert.ToDecimal(pageSize2), 2));
@@ -530,7 +529,7 @@ namespace BLL
}
/// <summary>
/// ��ȡ�ϴη������
/// 获取上次返修情况
/// </summary>
/// <returns></returns>
public static string GetRepariMark(string repairMark)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>