You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
491 lines
20 KiB
491 lines
20 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using OT.IDAL;
|
|
using OT.DALFactory;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
|
|
namespace OT.BLL
|
|
{
|
|
public class CommonClass
|
|
{
|
|
|
|
private readonly ICommonClass dal = DataAccess.Create<ICommonClass>("CommonClass");
|
|
private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString();
|
|
private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "CommonClass.asmx";
|
|
public CommonClass()
|
|
{ }
|
|
|
|
#region 下拉選單
|
|
|
|
/// <summary>
|
|
/// 依據LoginId查詢所有模組
|
|
/// </summary>
|
|
/// 使用地方: Menu.aspx.cs by Gary 2013/12/23
|
|
public DataSet GetDDLModuleList(string UserRoleId)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetDDLModuleList(UserRoleId);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = UserRoleId;
|
|
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetDDLModuleList", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 依據模組代號和User的LoginId取程式列表
|
|
/// </summary>
|
|
/// <param name="ModuleID">模組代號</param>
|
|
/// <param name="LoginId">登入帳號</param>
|
|
/// <returns></returns>
|
|
/// 使用地方: ModuleDefault.aspx.cs by Gary 2013/12/23
|
|
public DataSet GetProgramListByModuleID(string ModuleID, string LoginId)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetProgramListByModuleID(ModuleID, LoginId);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[2];
|
|
aryParam[0] = ModuleID;
|
|
aryParam[1] = LoginId;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetProgramListByModuleID", aryParam);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 取得目前系統內所有有效的人員名稱
|
|
/// </summary>
|
|
/// <param name="NULL"></param>
|
|
/// <returns></returns>
|
|
/// 使用地方: RoleMaintain_Upd.aspx.cs by Gary 2013/12/23
|
|
public DataSet GetUSERACCOUNTList(string NULL)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetUSERACCOUNTList(null);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = null;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetUSERACCOUNTList", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 取得目前系統內所有沒有被館別使用的大分類
|
|
/// </summary>
|
|
/// <param name="NULL"></param>
|
|
/// <returns></returns>
|
|
/// 使用地方: TvlShopMaintain_Upd.aspx.cs by Alina 2014/9/24
|
|
public DataSet GetChinWDCCOUNTList(string NULL)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetChinWDCCOUNTList(null);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = null;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetChinWDCCOUNTList", aryParam);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region 取流水號
|
|
/// <summary>
|
|
/// 獲取大類別編號的最大數字
|
|
/// </summary>
|
|
/// <param name="ArgumentClassID">大類別代號</param>
|
|
/// <returns>該類別的最大編號</returns>
|
|
/// 使用地方: BasePage.cs by Gary 2013/12/23
|
|
public int GetArgumentClassMaxNumber(string ArgumentClassID, string ModifyUser)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetArgumentClassMaxNumber(ArgumentClassID, ModifyUser);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[2];
|
|
aryParam[0] = ArgumentClassID;
|
|
aryParam[1] = ModifyUser;
|
|
return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetArgumentClassMaxNumber", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 獲取小類別編號的最大數字
|
|
/// </summary>
|
|
/// <param name="ArgumentClassID">大類別代號</param>
|
|
/// <param name="ArgumentID">小類別代號</param>
|
|
/// <returns></returns>
|
|
/// 使用地方: BasePage.cs by Gary 2013/12/23
|
|
public int GetArgumentMaxNumber(string ArgumentClassID, string ArgumentID, string ModifyUser)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetArgumentMaxNumber(ArgumentClassID, ArgumentID, ModifyUser);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[3];
|
|
aryParam[0] = ArgumentClassID;
|
|
aryParam[1] = ArgumentID;
|
|
aryParam[2] = ModifyUser;
|
|
return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetArgumentMaxNumber", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 自動獲取大類別編號
|
|
/// </summary>
|
|
/// <param name="ArgumentClassID">大類別代號</param>
|
|
/// <param name="intLen">返回字符長度</param>
|
|
/// <returns>該類別的最大編號</returns>
|
|
/// 使用地方: BasePage.cs by Gary 2013/12/23
|
|
public string GetArgumentClassMaxNumber(string ArgumentClassID, string ModifyUser, int intLen)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetArgumentClassMaxNumber(ArgumentClassID, ModifyUser).ToString().PadLeft(intLen, '0');
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[2];
|
|
aryParam[0] = ArgumentClassID;
|
|
aryParam[1] = ModifyUser;
|
|
return OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetArgumentClassMaxNumber", aryParam).ToString().PadLeft(intLen, '0');
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 自動獲取小類別編號
|
|
/// </summary>
|
|
/// <param name="ArgumentClassID">大類別代號</param>
|
|
/// <param name="ArgumentID">小類別代號</param>
|
|
/// <param name="intLen">返回字符長度</param>
|
|
/// <returns></returns>
|
|
/// 使用地方: BasePage.cs by Gary 2013/12/23
|
|
public string GetArgumentMaxNumber(string ArgumentClassID, string ArgumentID, string ModifyUser, int intLen)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetArgumentMaxNumber(ArgumentClassID, ArgumentID, ModifyUser).ToString().PadLeft(intLen, '0');
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[3];
|
|
aryParam[0] = ArgumentClassID;
|
|
aryParam[1] = ArgumentID;
|
|
aryParam[2] = ModifyUser;
|
|
return OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetArgumentMaxNumber", aryParam).ToString().PadLeft(intLen, '0');
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 獲取最大編號
|
|
/// </summary>
|
|
/// <param name="Type">類型</param>
|
|
/// <returns>該類型的最大編號</returns>
|
|
/// 使用地方:BasePage.cs 、 QuotationBorneMaintain_Upd.aspx.cs 、 QuotationWorkMaintain_Upd.aspx.cs 、
|
|
/// ArgumentClassMaintain_Upd.aspx.cs 、 ModuleMaintain_Upd.aspx.cs 、 RoleMaintain_Upd.aspx.cs by Gary 2013/12/23
|
|
public int GetMaxNumberByType(string Type, string Flag, string ModifyUser)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetMaxNumberByType(Type, Flag, ModifyUser);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[3];
|
|
aryParam[0] = Type;
|
|
aryParam[1] = Flag;
|
|
aryParam[2] = ModifyUser;
|
|
return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetMaxNumberByType", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 獲取最大編號
|
|
/// </summary>
|
|
/// <param name="Type">類型</param>
|
|
/// <param name="intLen">返回編號最大位數</param>
|
|
/// <returns>該類型的最大編號</returns>
|
|
/// 使用地方:BasePage.cs 、 QuotationBorneMaintain_Upd.aspx.cs 、 QuotationWorkMaintain_Upd.aspx.cs 、
|
|
/// ArgumentClassMaintain_Upd.aspx.cs 、 ModuleMaintain_Upd.aspx.cs 、 RoleMaintain_Upd.aspx.cs by Gary 2013/12/23
|
|
public string GetMaxNumberByType(string Type, string Flag, string ModifyUser, int intLen)
|
|
{
|
|
return GetMaxNumberByType(Type, Flag, ModifyUser).ToString().PadLeft(intLen, '0');
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 取程式列表
|
|
|
|
#region GetProgramListByRuleId
|
|
/// <summary>
|
|
/// 依據角色ID取得程式列表信息
|
|
/// </summary>
|
|
/// <param name="strRuleId">角色ID</param>
|
|
/// <returns>程式列表信息</returns>
|
|
/// 使用地方: AuthantedPrograms.aspx.cs by Gary 2013/12/23
|
|
public DataSet GetProgramListByRuleId(string strRuleId)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetProgramListByRuleId(strRuleId);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = strRuleId;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetProgramListByRuleId", aryParam);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 取Text值
|
|
|
|
|
|
|
|
|
|
/// 詢問過Dean 主要工作取日期用 by Gary 2013/12/23
|
|
public string GetDate()
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetDate();
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[0];
|
|
return (string)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetDate", aryParam);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 取參數值列表
|
|
|
|
#region GetArgumentListByArgumentClassID
|
|
/// <summary>
|
|
/// 依據參數類別ID取得參數值
|
|
/// </summary>
|
|
/// <param name="strArgumentClassID">參數類別ID</param>
|
|
/// <returns>參數值列表信息</returns>
|
|
/// 使用地方:HRMMaintain_Upd.aspx.cs 、 MemberMaintain_Upd.aspx.cs by Gary 2013/12/23
|
|
public DataSet GetArgumentListByArgumentClassID(string strArgumentClassID)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetArgumentListByArgumentClassID(strArgumentClassID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = strArgumentClassID;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetArgumentListByArgumentClassID", aryParam);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 獲取系統設定值
|
|
|
|
public string GetSystemSetting(string strItem, string SettingValueOrMemo)
|
|
{
|
|
return dal.GetSystemSetting(strItem, SettingValueOrMemo);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GetFileListBySourceRelationID
|
|
/// <summary>
|
|
/// 依據文件來源編號獲取文件列表
|
|
/// </summary>
|
|
/// <param name="SourceRelationID"></param>
|
|
/// <returns></returns>
|
|
/// 使用地方:AsyncFileUpload.ascx.cs 、 AsyncFileUploadClass.aspx.cs 、 AsyncFileUploadPrtOrPub.aspx.cs 、
|
|
/// AsyncFileUpView.aspx.cs 、 UploadFileView.aspx.cs 、 UploadHandler.aspx.cs by Gary 2013/12/23
|
|
public DataSet GetFileListBySourceRelationID(string SourceRelationID)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetFileListBySourceRelationID(SourceRelationID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = SourceRelationID;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetFileListBySourceRelationID", aryParam);
|
|
}
|
|
}
|
|
#endregion
|
|
#region GetContractListFileListByProjectID
|
|
/// <summary>
|
|
/// 通過專案編號獲取該專案中所有合約的附件資料列表
|
|
/// </summary>
|
|
/// <param name="SourceRelationID"></param>
|
|
/// <returns></returns>
|
|
/// 使用地方:UpLoadCTListFileView.ascx.cs by Gary 2013/12/23
|
|
public DataSet GetContractListFileListByProjectID(string ProjectID)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetContractListFileListByProjectID(ProjectID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = ProjectID;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetFileListBySourceRelationID", aryParam);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 獲得資料列表
|
|
/// </summary>
|
|
/// 使用地方:ucExportEquList.ascx.cs by Gary 2013/12/23
|
|
public DataSet GetList(int StartRecordIndex, int EndRecordIndex, string CustomerClass, string CustomerID, string CustomerName, string ContectName, string TEL, string TaxNumber, string Status, string SortExpression)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetList(StartRecordIndex, EndRecordIndex, CustomerClass, CustomerID, CustomerName, ContectName, TEL, TaxNumber, Status, SortExpression);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[10];
|
|
aryParam[0] = StartRecordIndex.ToString();
|
|
aryParam[1] = EndRecordIndex.ToString();
|
|
aryParam[2] = CustomerClass;
|
|
aryParam[3] = CustomerID;
|
|
aryParam[4] = CustomerName;
|
|
aryParam[5] = ContectName;
|
|
aryParam[6] = TEL;
|
|
aryParam[7] = TaxNumber;
|
|
aryParam[8] = Status;
|
|
aryParam[9] = SortExpression;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetList", aryParam);
|
|
}
|
|
}
|
|
|
|
|
|
//public DataSet ExistsFunc(string FUNC_ID, string USER_GUID)
|
|
//{
|
|
// if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
// {
|
|
// return dal.ExistsFunc(FUNC_ID, USER_GUID);
|
|
// }
|
|
// else
|
|
// {
|
|
// string[] aryParam = new string[2];
|
|
// aryParam[0] = FUNC_ID;
|
|
// aryParam[1] = USER_GUID;
|
|
// return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_ExistsFunc", aryParam);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 更新排序欄位
|
|
/// </summary>
|
|
/// 使用地方:CaseTypeMaintain_Qry.aspx.cs 、 ProgramMaintain_Qry.aspx.cs 、
|
|
/// ModuleMaintain_Qry.aspx.cs 、 ArgumentClassMaintain_Qry.aspx.cs 、
|
|
/// QuotationWorkMaintain_Qry.aspx.cs 、 QuotationBorneMaintain_Qry.aspx.cs 、
|
|
/// AuthantedPrograms.aspx.cs by Gary 2013/12/23
|
|
public bool UpdateOrderByValue(string OldOrderByValue, string NewOrderByValue, string FeildName, string MDFUserFeild, string ModifyUser, string MDFDateFeild, string TableName, string Where1, string Where2)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.UpdateOrderByValue(OldOrderByValue, NewOrderByValue, FeildName, MDFUserFeild, ModifyUser, MDFDateFeild, TableName, Where1, Where2);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[9];
|
|
aryParam[0] = OldOrderByValue;
|
|
aryParam[1] = NewOrderByValue;
|
|
aryParam[2] = FeildName;
|
|
aryParam[3] = MDFUserFeild;
|
|
aryParam[4] = ModifyUser;
|
|
aryParam[5] = MDFDateFeild;
|
|
aryParam[6] = TableName;
|
|
aryParam[7] = Where1;
|
|
aryParam[8] = Where2;
|
|
return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_UpdateOrderByValue", aryParam);
|
|
}
|
|
}
|
|
|
|
|
|
public DataSet GetTrWord(string strWhere) {
|
|
return dal.GetTrWord(strWhere);
|
|
}
|
|
#region 共用型更改MemberID
|
|
/// <summary>
|
|
/// 共用型更改MemberID
|
|
/// Create by Gary 2014/08/13
|
|
/// </summary>
|
|
/// <param name="strTableName">資料表名稱</param>
|
|
/// <param name="strMemberField">MemberField欄位名稱</param>
|
|
/// <param name="strMemberID">新的MemberID</param>
|
|
/// <param name="strModifyField">更改人欄位</param>
|
|
/// <param name="strUserID">更改人ID</param>
|
|
/// <param name="strModifyDateField">更改時間欄位</param>
|
|
/// <param name="strWhere">Where條件,請務必給正確的條件,以免更新錯誤</param>
|
|
/// <returns>是否更新成功</returns>
|
|
/// 使用地方: ChangeMember_Pop.aspx.cs by Gary 2014/08/13
|
|
public bool UpdateMemberID(string strTableName, string strMemberField, string strMemberID, string strModifyField, string strUserID, string strModifyDateField, string strWhere)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.UpdateMemberID(strTableName, strMemberField, strMemberID, strModifyField, strUserID, strModifyDateField, strWhere);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[2];
|
|
aryParam[0] = strMemberID;
|
|
aryParam[1] = strUserID;
|
|
return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_UpdateMemberID", aryParam);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 可刪除的資料
|
|
|
|
///// 使用地方: 無! by Gary 2013/12/23
|
|
//public DataSet GetEmailByCatagoryID(string CatagoryID)
|
|
//{
|
|
// if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
// {
|
|
// return dal.GetEmailByCatagoryID(CatagoryID);
|
|
// }
|
|
// else
|
|
// {
|
|
|
|
// string[] aryParam = new string[1];
|
|
// aryParam[0] = CatagoryID;
|
|
// return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetEmailByCatagoryID", aryParam);
|
|
// }
|
|
//}
|
|
#endregion
|
|
}
|
|
}
|