リビジョン 330
工事情報に部署を登録するように変更
過去部署検索時工事情報より取得する様に変更
一覧等の部署・担当者コンボボックス検索統一化
担当者マスタ・部署移転情報項目追加
請求書作成・印刷処理修正中
branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs | ||
---|---|---|
283 | 283 |
} |
284 | 284 |
#endregion |
285 | 285 |
|
286 |
#region 日付返還変換
|
|
286 |
#region オブジェクトを日付に変換する
|
|
287 | 287 |
/// <summary> |
288 | 288 |
/// 日付返還変換 |
289 | 289 |
/// </summary> |
... | ... | |
1699 | 1699 |
} |
1700 | 1700 |
#endregion |
1701 | 1701 |
|
1702 |
#region 対象日より営業期・工事年度を取得する(実装途中)
|
|
1702 |
#region 対象日より営業期・工事年度を取得する |
|
1703 | 1703 |
/// <summary> |
1704 |
/// 対象日より営業期・工事年度を取得する(実装途中)
|
|
1704 |
/// 対象日より営業期・工事年度を取得する |
|
1705 | 1705 |
/// </summary> |
1706 | 1706 |
/// <param name="NowDay"></param> |
1707 | 1707 |
/// <returns></returns> |
1708 | 1708 |
public static int ConvDate2YearOrPeriod(DateTime NowDay) |
1709 | 1709 |
{ |
1710 |
int nRetVal = 0; |
|
1711 |
// 初期値セット |
|
1712 |
if (m_systemMaster.ConstructionNoBase == (int)SystemMaster.ConstrNoBaseDef.BusinessPeriod) |
|
1713 |
nRetVal = m_systemMaster.BusinessPeriod; |
|
1714 |
else |
|
1715 |
nRetVal = m_systemMaster.ConstrYear; |
|
1710 |
IOMBizPeriodHistory BizHisDB = new IOMBizPeriodHistory(); |
|
1716 | 1711 |
try |
1717 | 1712 |
{ |
1713 |
int nRetVal = 0; |
|
1718 | 1714 |
|
1715 |
// 範囲に入るデータを取得する |
|
1716 |
StringBuilder strSQL = new StringBuilder(); |
|
1719 | 1717 |
|
1718 |
strSQL.AppendFormat(" WHERE (DATE(BeginDate) <= DATE('{0}'))", NowDay.ToShortDateString()); |
|
1719 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(CompleteDate))", NowDay.ToShortDateString()); |
|
1720 |
strSQL.AppendFormat(" And PeriodFlag = {0}", CommonMotions.SystemMasterData.ConstructionNoBase); |
|
1721 |
strSQL.Append(" Order By PeriodFlag Asc, PeriodYear Asc"); |
|
1722 |
|
|
1723 |
List<BizPeriodHistory> BizList = new List<BizPeriodHistory>(); |
|
1724 |
if (!BizHisDB.SelectAction(strSQL.ToString(), ref BizList)) return 0; |
|
1725 |
|
|
1726 |
nRetVal = BizList[0].PeriodYear; |
|
1727 |
|
|
1720 | 1728 |
return nRetVal; |
1721 | 1729 |
} |
1722 | 1730 |
catch (Exception ex) |
1723 | 1731 |
{ |
1724 | 1732 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
1725 |
return nRetVal;
|
|
1733 |
return 0;
|
|
1726 | 1734 |
} |
1735 |
finally |
|
1736 |
{ |
|
1737 |
BizHisDB.close(); BizHisDB = null; |
|
1738 |
} |
|
1727 | 1739 |
} |
1728 | 1740 |
#endregion |
1729 | 1741 |
|
... | ... | |
2826 | 2838 |
} |
2827 | 2839 |
#endregion |
2828 | 2840 |
|
2841 |
#region 部署コンボボックスデータ取得SQL作成 |
|
2842 |
/// <summary> |
|
2843 |
/// 部署コンボボックスデータ取得SQL作成 |
|
2844 |
/// </summary> |
|
2845 |
/// <param name="strSQL"></param> |
|
2846 |
public static void CreateDepCombBoxSQL(ref StringBuilder strSQL, int nTargetCount) |
|
2847 |
{ |
|
2848 |
try |
|
2849 |
{ |
|
2850 |
// 今期のデータかどうかを判定する |
|
2851 |
bool bNowSeason = true; |
|
2852 |
if (nTargetCount != CommonMotions.SystemMasterData.BusinessPeriod) bNowSeason = false; |
|
2853 |
|
|
2854 |
strSQL.Append("SELECT"); |
|
2855 |
strSQL.Append(" A.DEPARTMENTCODE"); |
|
2856 |
strSQL.Append(", A.DEPARTMENTSTRING"); |
|
2857 |
strSQL.Append(", A.DISPLAYORDER"); |
|
2858 |
strSQL.Append(", COUNT(*)"); |
|
2859 |
strSQL.Append(" FROM"); |
|
2860 |
if (bNowSeason) |
|
2861 |
{ |
|
2862 |
// 今期のプライマリテーブルは部署マスタ |
|
2863 |
strSQL.Append(" DEPARTMENTMASTER A"); |
|
2864 |
} |
|
2865 |
else |
|
2866 |
{ // 過去のデータは工事情報より取得する |
|
2867 |
strSQL.Append(" ("); |
|
2868 |
strSQL.Append("Select"); |
|
2869 |
strSQL.Append(" A1.SalesDepCode As DEPARTMENTCODE"); |
|
2870 |
strSQL.Append(", B1.DetailString As DEPARTMENTSTRING"); |
|
2871 |
strSQL.Append(", ifnull(C1.DisplayOrder, 10) As DISPLAYORDER"); |
|
2872 |
strSQL.Append(" From Constructionbaseinfo As A1"); |
|
2873 |
strSQL.Append(" Inner Join constructionbaseinfodetail As B1"); |
|
2874 |
strSQL.Append(" On B1.ConstructionCode = A1.ConstructionCode"); |
|
2875 |
strSQL.AppendFormat(" And B1.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.SalesDepartmentName); |
|
2876 |
strSQL.Append(" Left Join departmentmaster As C1"); |
|
2877 |
strSQL.Append(" On C1.DepartmentCode = A1.SalesDepCode"); |
|
2878 |
strSQL.AppendFormat(" Where A1.ConstructionPeriod = {0}", nTargetCount); |
|
2879 |
|
|
2880 |
strSQL.Append(" Union Select"); |
|
2881 |
strSQL.Append(" A2.ConstrDepCode As DEPARTMENTCODE"); |
|
2882 |
strSQL.Append(" , B2.DetailString As DEPARTMENTSTRING"); |
|
2883 |
strSQL.Append(" , ifnull(C2.DisplayOrder, 10) As DISPLAYORDER"); |
|
2884 |
strSQL.Append(" From Constructionbaseinfo As A2"); |
|
2885 |
strSQL.Append(" Inner Join constructionbaseinfodetail As B2"); |
|
2886 |
strSQL.Append(" On B2.ConstructionCode = A2.ConstructionCode"); |
|
2887 |
strSQL.AppendFormat(" And B2.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrDepartmentName); |
|
2888 |
strSQL.Append(" Left Join departmentmaster As C2"); |
|
2889 |
strSQL.Append(" On C2.DepartmentCode = A2.ConstrDepCode"); |
|
2890 |
strSQL.AppendFormat(" Where A2.ConstructionPeriod = {0}", nTargetCount); |
|
2891 |
|
|
2892 |
strSQL.Append(" Union Select"); |
|
2893 |
strSQL.Append(" A3.ConstrSubDepCode As DEPARTMENTCODE"); |
|
2894 |
strSQL.Append(", B3.DetailString As DEPARTMENTSTRING"); |
|
2895 |
strSQL.Append(", ifnull(C3.DisplayOrder, 10) As DISPLAYORDER"); |
|
2896 |
strSQL.Append(" From Constructionbaseinfo As A3"); |
|
2897 |
strSQL.Append(" Inner Join constructionbaseinfodetail As B3"); |
|
2898 |
strSQL.Append(" On B3.ConstructionCode = A3.ConstructionCode"); |
|
2899 |
strSQL.AppendFormat(" And B3.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.ConstrSubDepartmentName); |
|
2900 |
strSQL.Append(" Left Join departmentmaster As C3"); |
|
2901 |
strSQL.Append(" On C3.DepartmentCode = A3.ConstrSubDepCode"); |
|
2902 |
strSQL.AppendFormat(" Where A3.ConstructionPeriod = {0}", nTargetCount); |
|
2903 |
|
|
2904 |
strSQL.Append(" Union Select"); |
|
2905 |
strSQL.Append(" A4.ConstrInstrDepCode As DEPARTMENTCODE"); |
|
2906 |
strSQL.Append(", B4.DetailString As DEPARTMENTSTRING"); |
|
2907 |
strSQL.Append(", ifnull(C4.DisplayOrder, 10) As DISPLAYORDER"); |
|
2908 |
strSQL.Append(" From Constructionbaseinfo As A4"); |
|
2909 |
strSQL.Append(" Inner Join constructionbaseinfodetail As B4"); |
|
2910 |
strSQL.Append(" On B4.ConstructionCode = A4.ConstructionCode"); |
|
2911 |
strSQL.AppendFormat(" And B4.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DataNoDef.InstrDepartmentName); |
|
2912 |
strSQL.Append(" Left Join departmentmaster As C4"); |
|
2913 |
strSQL.Append(" On C4.DepartmentCode = A4.ConstrInstrDepCode"); |
|
2914 |
strSQL.AppendFormat(" Where A4.ConstructionPeriod = {0}", nTargetCount); |
|
2915 |
strSQL.Append(") As A"); |
|
2916 |
} |
|
2917 |
|
|
2918 |
strSQL.Append(", PERSONINCHARGEMASTER B"); |
|
2919 |
strSQL.Append(", CONSTRUCTIONBASEINFO C"); |
|
2920 |
strSQL.Append(" WHERE"); |
|
2921 |
|
|
2922 |
if (bNowSeason) |
|
2923 |
{ // 今期は削除されていないもの |
|
2924 |
strSQL.Append(" A.DELETEFLG = 0"); |
|
2925 |
|
|
2926 |
// システム管理者以外は部署参照マスタよりデータ取得 |
|
2927 |
if (CommonMotions.LoginUserData.PersonCode != CommonDefine.AdminCode) |
|
2928 |
{ |
|
2929 |
// 参照部署マスタより取得する |
|
2930 |
strSQL.Append(" And A.DEPARTMENTCODE"); |
|
2931 |
strSQL.Append(" IN (SELECT A1.DEPARTMENTCODE FROM PERSONDEPARTMENTMASTER A1"); |
|
2932 |
strSQL.AppendFormat(" WHERE A1.PERSONCODE = {0})", CommonMotions.LoginUserData.PersonCode); |
|
2933 |
} |
|
2934 |
strSQL.Append(" AND"); |
|
2935 |
} |
|
2936 |
strSQL.Append(" A.DEPARTMENTCODE = B.DEPARTMENTCODE"); |
|
2937 |
strSQL.Append(" AND B.PERSONCODE = C.CONSTRUCTIONPERSONCODE"); |
|
2938 |
strSQL.Append(" GROUP BY A.DEPARTMENTCODE, A.DEPARTMENTSTRING, A.DISPLAYORDER"); |
|
2939 |
strSQL.Append(" ORDER BY A.DISPLAYORDER ASC"); |
|
2940 |
} |
|
2941 |
catch (Exception ex) |
|
2942 |
{ |
|
2943 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
2944 |
} |
|
2945 |
} |
|
2829 | 2946 |
#endregion |
2830 | 2947 |
|
2948 |
#region 担当者コンボボックスデータ取得SQL作成 |
|
2949 |
/// <summary> |
|
2950 |
/// 担当者コンボボックスデータ取得SQL作成 |
|
2951 |
/// </summary> |
|
2952 |
/// <param name="strSQL"></param> |
|
2953 |
/// <param name="nTargetYear"></param> |
|
2954 |
public static void CreateManCombBoxSQL(ref StringBuilder strSQL, int nTargetYear, int nDepCode = 0, int nLEDGERFLG = -1) |
|
2955 |
{ |
|
2956 |
try |
|
2957 |
{ |
|
2958 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nTargetYear, true); |
|
2959 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nTargetYear, false); |
|
2960 |
|
|
2961 |
strSQL.Append("Select A.* From"); |
|
2962 |
strSQL.Append(" personinchargemaster As A"); |
|
2963 |
strSQL.Append(" Left Join chgchargedep As B"); |
|
2964 |
strSQL.Append(" On B.PersonCode = A.PersonCode"); |
|
2965 |
|
|
2966 |
strSQL.AppendFormat(" WHERE ((DATE(A.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString()); |
|
2967 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(A.ENDDATE)", dtDefaultStart.ToShortDateString()); |
|
2968 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(A.ENDDATE)))", DateTime.MinValue.ToShortDateString()); |
|
2969 |
strSQL.AppendFormat(" AND ((DATE(B.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString()); |
|
2970 |
strSQL.AppendFormat(" AND(DATE('{0}') <= DATE(B.CompDate)", dtDefaultStart.ToShortDateString()); |
|
2971 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(B.CompDate)))", DateTime.MinValue.ToShortDateString()); |
|
2972 |
|
|
2973 |
if (nDepCode != 0) strSQL.AppendFormat(" AND (B.DEPARTMENTCODE = {0})", nDepCode); |
|
2974 |
|
|
2975 |
if (nLEDGERFLG == -1) strSQL.AppendFormat(" AND A.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget); |
|
2976 |
else if (nLEDGERFLG > -1) strSQL.AppendFormat(" AND A.LEDGERFLG = {0}", nLEDGERFLG); |
|
2977 |
|
|
2978 |
// 今期のデータかどうかを判定する |
|
2979 |
bool bNowSeason = true; |
|
2980 |
string FieldName = string.Empty; |
|
2981 |
if (CommonMotions.SystemMasterData.ConstructionNoBase == (int)SystemMaster.ConstrNoBaseDef.BusinessPeriod) |
|
2982 |
{ |
|
2983 |
FieldName = "ConstructionPeriod"; |
|
2984 |
if (nTargetYear != CommonMotions.SystemMasterData.BusinessPeriod) bNowSeason = false; |
|
2985 |
} |
|
2986 |
else |
|
2987 |
{ |
|
2988 |
FieldName = "ConstructionYear"; |
|
2989 |
if (nTargetYear != CommonMotions.SystemMasterData.ConstrYear) bNowSeason = false; |
|
2990 |
} |
|
2991 |
if (!bNowSeason) |
|
2992 |
{ |
|
2993 |
strSQL.Append(" AND A.DepartmentCode IN(SELECT InDep.DEPARTMENTCODE FROM ("); |
|
2994 |
strSQL.Append(" Select A1.SalesDepCode As DEPARTMENTCODE From Constructionbaseinfo As A1"); |
|
2995 |
strSQL.AppendFormat(" Where A1.{0} = {1}", FieldName, nTargetYear); |
|
2996 |
strSQL.Append(" Union Select A2.ConstrDepCode As DEPARTMENTCODE From Constructionbaseinfo As A2"); |
|
2997 |
strSQL.AppendFormat(" Where A2.{0} = {1}", FieldName, nTargetYear); |
|
2998 |
strSQL.Append(" Union Select A3.ConstrSubDepCode As DEPARTMENTCODE From Constructionbaseinfo As A3"); |
|
2999 |
strSQL.AppendFormat(" Where A3.{0} = {1}", FieldName, nTargetYear); |
|
3000 |
strSQL.Append(" Union Select A4.ConstrInstrDepCode As DEPARTMENTCODE From Constructionbaseinfo As A4"); |
|
3001 |
strSQL.AppendFormat(" Where A4.{0} = {1}", FieldName, nTargetYear); |
|
3002 |
strSQL.Append(" ) As InDep"); |
|
3003 |
strSQL.Append(" GROUP BY InDep.DEPARTMENTCODE) "); |
|
3004 |
} |
|
3005 |
|
|
3006 |
strSQL.Append(" Order By A.DeleteFlg ASC, A.EmployeeClassFlg ASC, A.DisplayOrder ASC"); |
|
3007 |
} |
|
3008 |
catch (Exception ex) |
|
3009 |
{ |
|
3010 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
3011 |
} |
|
3012 |
} |
|
3013 |
#endregion |
|
3014 |
|
|
3015 |
#region 担当者より指定年度の部署を取得するSQL作成 |
|
3016 |
/// <summary> |
|
3017 |
/// 担当者より指定年度の部署を取得するSQL作成 |
|
3018 |
/// </summary> |
|
3019 |
public static void CreateMan2DepSQL(ref StringBuilder strSQL, int nTargetYear, int nPersonCode) |
|
3020 |
{ |
|
3021 |
try |
|
3022 |
{ |
|
3023 |
DateTime dtDefaultStart = CommonMotions.GetOpeningEndDate(nTargetYear, true); |
|
3024 |
DateTime dtDefaultEnd = CommonMotions.GetOpeningEndDate(nTargetYear, false); |
|
3025 |
|
|
3026 |
strSQL.Append("Select"); |
|
3027 |
strSQL.Append(" A.PersonCode"); |
|
3028 |
strSQL.Append(", A.PersonName"); |
|
3029 |
strSQL.Append(", B.DepartmentCode"); |
|
3030 |
strSQL.Append(", B.DepartmentName"); |
|
3031 |
strSQL.Append(" From"); |
|
3032 |
strSQL.Append(" personinchargemaster As A"); |
|
3033 |
strSQL.Append(" Left Join chgchargedep As B"); |
|
3034 |
strSQL.Append(" On B.PersonCode = A.PersonCode"); |
|
3035 |
|
|
3036 |
strSQL.AppendFormat(" WHERE ((DATE(A.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString()); |
|
3037 |
strSQL.AppendFormat(" AND (DATE('{0}') <= DATE(A.ENDDATE)", dtDefaultStart.ToShortDateString()); |
|
3038 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(A.ENDDATE)))", DateTime.MinValue.ToShortDateString()); |
|
3039 |
strSQL.AppendFormat(" AND ((DATE(B.STARTDATE) <= DATE('{0}'))", dtDefaultEnd.ToShortDateString()); |
|
3040 |
strSQL.AppendFormat(" AND(DATE('{0}') <= DATE(B.CompDate)", dtDefaultStart.ToShortDateString()); |
|
3041 |
strSQL.AppendFormat(" OR DATE('{0}') = DATE(B.CompDate)))", DateTime.MinValue.ToShortDateString()); |
|
3042 |
|
|
3043 |
strSQL.AppendFormat(" AND A.PersonCode = {0}", nPersonCode); |
|
3044 |
} |
|
3045 |
catch (Exception ex) |
|
3046 |
{ |
|
3047 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message); |
|
3048 |
} |
|
3049 |
} |
|
3050 |
#endregion |
|
3051 |
|
|
3052 |
#endregion |
|
3053 |
|
|
2831 | 3054 |
#region ---------- Excel向け操作メソッド |
2832 | 3055 |
#region オブジェクト開放 |
2833 | 3056 |
/// <summary> |
branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs | ||
---|---|---|
14 | 14 |
/// <summary> |
15 | 15 |
/// 本体バージョン |
16 | 16 |
/// </summary> |
17 |
public static int s_SystemVersion = 154;
|
|
17 |
public static int s_SystemVersion = 155;
|
|
18 | 18 |
|
19 | 19 |
/// <summary> |
20 | 20 |
/// コピー・環境バージョン |
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeBaseInfoData.cs | ||
---|---|---|
390 | 390 |
|
391 | 391 |
FuncCnt++; |
392 | 392 |
|
393 |
if (DataList.Count == 0)
|
|
393 |
if (DataList.Count < 1)
|
|
394 | 394 |
{ |
395 | 395 |
if (FuncCnt > 2) return; |
396 | 396 |
|
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsMessageBoradAccess.cs | ||
---|---|---|
255 | 255 |
strSECSQL.Append(" PERSONINCHARGEMASTER A"); |
256 | 256 |
strSECSQL.Append(", SECURITYMASTER B"); |
257 | 257 |
strSECSQL.Append(" WHERE"); |
258 |
strSECSQL.AppendFormat(" DEPARTMENTCODE = {0}", FromCode); |
|
258 |
strSECSQL.AppendFormat(" A.DEPARTMENTCODE = {0}", FromCode);
|
|
259 | 259 |
strSECSQL.Append(" AND B.SECCODE = A.SECCODE"); |
260 | 260 |
|
261 | 261 |
ArrayList SecarList = new ArrayList(); |
... | ... | |
322 | 322 |
{ |
323 | 323 |
// 権限ランク取得 |
324 | 324 |
int SRank = (int)CommonDefine.SecurityRankPos.SpecialAuthority; // 経営者アクセス |
325 |
//int FRank = (int)CommonDefine.SecurityRankPos.FreeAuthority; // 統括者アクセス |
|
326 |
//int LRank = (int)CommonDefine.SecurityRankPos.LimitedAuthority; // 所属長アクセス |
|
327 |
int NRank = (int)CommonDefine.SecurityRankPos.NormalAuthority; // 一般者アクセス |
|
328 | 325 |
|
329 |
if (CommonMotions.LoginUserData.PersonCode == CommonDefine.AdminCode) |
|
326 |
if (CommonMotions.LoginUserData.PersonCode == CommonDefine.AdminCode |
|
327 |
|| CommonMotions.LoginUserSecurity.SecRank == CommonDefine.SecurityRankList[SRank].Key) |
|
330 | 328 |
{ |
331 | 329 |
// ----- システム管理者(すべて対象) |
332 |
return true; |
|
333 |
} |
|
334 |
else if (CommonMotions.LoginUserSecurity.SecRank == CommonDefine.SecurityRankList[SRank].Key) |
|
335 |
{ |
|
336 | 330 |
// ----- 経営者アクセス(すべて対象) |
337 | 331 |
return true; |
338 | 332 |
} |
... | ... | |
343 | 337 |
if (!GetReadTarget(mbtDB, RecoadNo, BuranchNo, ref TargetList)) return false; |
344 | 338 |
if (TargetList.Count == 0) return false; |
345 | 339 |
|
346 |
// 対象テーブルにあるか? |
|
347 | 340 |
int TergetCnt = Enum.GetNames(typeof(IOMessageBoardTerget.NameColumn)).Length; |
341 |
|
|
342 |
// 書込み者は最上位者か? |
|
348 | 343 |
object[] objFirst = (object[])TargetList[0]; |
349 |
// 書込み者は最上位者か? |
|
350 | 344 |
int WriterCode = CommonMotions.cnvInt(objFirst[TergetCnt + (int)GetTarget.FromCode]); |
351 | 345 |
bool bProtect = DecideLockData(WriterCode); |
352 |
|
|
353 |
// 書込み側対象者判定 |
|
354 |
if (WriterCode < 99999) |
|
346 |
if (!bProtect) |
|
355 | 347 |
{ |
356 |
// 対象者コードが5桁以下ならば部署コード |
|
357 |
if (WriterCode == CommonMotions.LoginUserData.DepartmentCode) return true; |
|
348 |
// 読込者は最上位者が含まれているか? |
|
349 |
int ReadCode = 0; |
|
350 |
foreach (object[] objRec in TargetList) |
|
351 |
{ |
|
352 |
ReadCode = CommonMotions.cnvInt(objFirst[(int)IOMessageBoardTerget.NameColumn.ToCode]); |
|
353 |
bProtect = DecideLockData(ReadCode); |
|
354 |
if (bProtect) break; |
|
355 |
} |
|
358 | 356 |
} |
357 |
|
|
358 |
// ----- 書込み側対象者判定 |
|
359 |
if (bProtect) |
|
360 |
{ // 最上位者ロック有 |
|
361 |
if (WriterCode < 99999) |
|
362 |
{ |
|
363 |
// 対象者コードが5桁以下ならば部署コード |
|
364 |
if (WriterCode == CommonMotions.LoginUserData.DepartmentCode) return true; |
|
365 |
} |
|
366 |
else |
|
367 |
{ |
|
368 |
if (WriterCode == CommonMotions.LoginUserData.PersonCode) return true; |
|
369 |
} |
|
370 |
} |
|
359 | 371 |
else |
360 |
{ |
|
361 |
if (WriterCode == CommonMotions.LoginUserData.PersonCode) return true;
|
|
372 |
{ // 最上位者ロック無
|
|
373 |
if (DataReadPermission(WriterCode)) return true;
|
|
362 | 374 |
} |
363 | 375 |
|
376 |
// ----- 読込側対象者判定 |
|
377 |
// 読込対象テーブルにあるか? 読込対象者をチェックする |
|
364 | 378 |
MessageBoardTerget wrkRec = new MessageBoardTerget(); |
365 | 379 |
foreach (object[] objRec in TargetList) |
366 | 380 |
{ |
367 | 381 |
mbtDB.ClearStruct(ref wrkRec); |
368 | 382 |
mbtDB.Reader2Struct(objRec, ref wrkRec); |
369 | 383 |
|
370 |
// ---------- |
|
371 |
int CurRecRank = 0; |
|
372 |
int DepCode = 0; |
|
373 |
// 対象者コードが5桁以下ならば部署コード |
|
374 |
if (wrkRec.ToCode < 99999) |
|
384 |
if (bProtect) |
|
375 | 385 |
{ |
376 |
// 所属部署が対象ならばOK |
|
377 |
if (wrkRec.ToCode == CommonMotions.LoginUserData.DepartmentCode) return true; |
|
386 |
// ----- 最上位者ロック有(対象のみ) |
|
387 |
if (wrkRec.ToCode < 99999) |
|
388 |
{ // 対象者コードが5桁以下ならば部署コード |
|
389 |
// 所属部署が対象ならばOK |
|
390 |
if (wrkRec.ToCode == CommonMotions.LoginUserData.DepartmentCode) return true; |
|
391 |
} |
|
392 |
else |
|
393 |
{ // 以外は担当者コード |
|
394 |
// 全員の場合はOK |
|
395 |
if (wrkRec.ToCode == CommonDefine.s_AllMembersCode) return true; |
|
378 | 396 |
|
379 |
// 管理者対象フラグがONの時にログイン者が一般ユーザーの場合はメッセージを見せない |
|
380 |
if (CommonMotions.LoginUserSecurity.SecRank == CommonDefine.SecurityRankList[NRank].Key) |
|
381 |
{ |
|
382 |
int ShareFlag = CommonMotions.cnvInt(objRec[TergetCnt + (int)GetTarget.ShareFlag]); |
|
383 |
if (ShareFlag != 0) return false; |
|
397 |
// 対象に自分があればOK |
|
398 |
if (wrkRec.ToCode == CommonMotions.LoginUserData.PersonCode) return true; |
|
384 | 399 |
} |
385 |
DepCode = wrkRec.ToCode; |
|
386 | 400 |
} |
387 | 401 |
else |
388 |
{ // ----- 以外は担当者コード |
|
389 |
// 全員の場合はOK |
|
390 |
if (wrkRec.ToCode == CommonDefine.s_AllMembersCode) return true; |
|
391 |
|
|
392 |
// 対象に自分があればOK |
|
393 |
if (wrkRec.ToCode == CommonMotions.LoginUserData.PersonCode) return true; |
|
394 |
|
|
395 |
// 読込対象者の所属部署を取得する |
|
396 |
DepCode = CommonMotions.cnvInt(objRec[TergetCnt + (int)GetTarget.DepartmentCode]); |
|
397 |
|
|
402 |
{ |
|
403 |
// 最上位者ロック無(参照部署を含めて対象) |
|
404 |
// 参照部署にあるかのチェック |
|
405 |
bool bmatch = DataReadPermission(wrkRec.ToCode); |
|
406 |
// 参照部署に無ければ次へ |
|
407 |
if (!bmatch) continue; |
|
408 |
|
|
398 | 409 |
// アクセスランクを取得する |
399 |
CurRecRank = CommonMotions.cnvInt(objRec[TergetCnt + (int)GetTarget.SecRank]); |
|
410 |
int CurRecRank = CommonMotions.cnvInt(objRec[TergetCnt + (int)GetTarget.SecRank]);
|
|
400 | 411 |
// ランク無は最大値をセット |
401 | 412 |
if (CurRecRank == 0) CurRecRank = 9; |
413 |
// 書込み者が自分より上位者では無い場合は読み込める |
|
414 |
if (CommonMotions.LoginUserSecurity.SecRank <= CurRecRank) return true; |
|
402 | 415 |
} |
403 |
|
|
404 |
if (!bProtect) |
|
405 |
{ |
|
406 |
// 参照部署にあるかのチェック |
|
407 |
foreach (PersonDepartmentMaster RefDepRec in CommonMotions.LoginUserRefDepartment) |
|
408 |
{ |
|
409 |
if (DepCode == RefDepRec.DepartmentCode) |
|
410 |
{ |
|
411 |
if (wrkRec.ToCode < 99999) |
|
412 |
{ |
|
413 |
return true; |
|
414 |
} |
|
415 |
else |
|
416 |
{ |
|
417 |
// 書込み者が自分より上位者では無い場合は読み込める |
|
418 |
if (CommonMotions.LoginUserSecurity.SecRank <= CurRecRank) return true; |
|
419 |
} |
|
420 |
} |
|
421 |
} |
|
422 |
} |
|
423 | 416 |
} |
424 | 417 |
|
425 | 418 |
return false; |
... | ... | |
502 | 495 |
} |
503 | 496 |
|
504 | 497 |
// アクセス権対象部署の場合はOK |
505 |
foreach (PersonDepartmentMaster wrkRec in CommonMotions.LoginUserRefDepartment) |
|
498 |
PersonDepartmentMaster FindDepRec = CommonMotions.LoginUserRefDepartment.Find(x => x.DepartmentCode == SourceCode); |
|
499 |
if (FindDepRec != null) |
|
506 | 500 |
{ |
507 |
if (SourceCode == wrkRec.DepartmentCode) |
|
508 |
{ |
|
509 |
return true; |
|
510 |
} |
|
501 |
if (FindDepRec.DepartmentCode > 0) return true; |
|
511 | 502 |
} |
512 | 503 |
|
513 | 504 |
return false; |
514 | 505 |
} |
515 | 506 |
|
516 | 507 |
// ----- 5桁より大きいならば担当者コード |
508 |
// 全員の場合は無条件にOK |
|
509 |
if (SourceCode == CommonDefine.s_AllMembersCode) return true; |
|
510 |
|
|
517 | 511 |
// ログイン者ならばOK |
518 |
if (SourceCode == CommonMotions.LoginUserData.PersonCode) |
|
519 |
{ |
|
520 |
return true; |
|
521 |
} |
|
512 |
if (SourceCode == CommonMotions.LoginUserData.PersonCode) return true; |
|
522 | 513 |
|
523 | 514 |
// 対象者の個人情報データを取得する |
524 | 515 |
StringBuilder strSQL = new StringBuilder(); |
525 | 516 |
strSQL.Append(PersonDB.CreatePrimarykeyString(SourceCode)); |
526 | 517 |
PersonInChargeMaster PersonRec = new PersonInChargeMaster(); |
527 |
if (!PersonDB.SelectAction(strSQL.ToString(), ref PersonRec)) |
|
528 |
{ |
|
529 |
return false; |
|
530 |
} |
|
518 |
if (!PersonDB.SelectAction(strSQL.ToString(), ref PersonRec)) return false; |
|
531 | 519 |
|
532 | 520 |
// 対象部署所属者はOK |
533 |
foreach (PersonDepartmentMaster wrkRec in CommonMotions.LoginUserRefDepartment) |
|
521 |
PersonDepartmentMaster FindRec = CommonMotions.LoginUserRefDepartment.Find(x => x.DepartmentCode == PersonRec.DepartmentCode); |
|
522 |
if (FindRec != null) |
|
534 | 523 |
{ |
535 |
if (PersonRec.DepartmentCode == wrkRec.DepartmentCode) |
|
536 |
{ |
|
537 |
return true; |
|
538 |
} |
|
524 |
if (FindRec.DepartmentCode > 0) return true; |
|
539 | 525 |
} |
540 | 526 |
|
541 | 527 |
return false; |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOConstructionBaseInfo.cs | ||
---|---|---|
51 | 51 |
NonOrderDate, |
52 | 52 |
OrdersDecisionPrice, |
53 | 53 |
OrdersDecisionPriceInTax, |
54 |
SalesDepCode, |
|
54 | 55 |
SalesPersonCode, |
56 |
ConstrDepCode, |
|
55 | 57 |
ConstructionPersonCode, |
58 |
ConstrSubDepCode, |
|
56 | 59 |
ConstrSubPersonCode, |
60 |
ConstrInstrDepCode, |
|
57 | 61 |
ConstructionInstructor, |
58 | 62 |
TransferConstruction, |
59 | 63 |
TransferConstructionDate, |
... | ... | |
173 | 177 |
#endregion |
174 | 178 |
|
175 | 179 |
#region 複数データ読込み処理 |
180 |
/// <summary> |
|
181 |
/// 複数データ読込み処理 |
|
182 |
/// </summary> |
|
183 |
/// <returns></returns> |
|
176 | 184 |
public bool SelectAction(string AddSQLString, ref List<ConstructionBaseInfo> data, bool bConnect = true) |
177 | 185 |
{ |
178 | 186 |
// インターフェース |
... | ... | |
207 | 215 |
#endregion |
208 | 216 |
|
209 | 217 |
#region 1件データ読込処理 |
218 |
/// <summary> |
|
219 |
/// 1件データ読込処理 |
|
220 |
/// </summary> |
|
221 |
/// <returns></returns> |
|
210 | 222 |
public bool SelectAction(string AddSQLString, ref ConstructionBaseInfo data, bool bConnect = true) |
211 | 223 |
{ |
212 | 224 |
// インターフェース |
... | ... | |
284 | 296 |
strcmd.AppendFormat(", {0}", data.OrdersDecisionPrice); |
285 | 297 |
strcmd.AppendFormat(", {0}", data.OrdersDecisionPriceInTax); |
286 | 298 |
|
299 |
strcmd.AppendFormat(", {0}", data.SalesDepCode); |
|
287 | 300 |
strcmd.AppendFormat(", {0}", data.SalesPersonCode); |
301 |
strcmd.AppendFormat(", {0}", data.ConstrDepCode); |
|
288 | 302 |
strcmd.AppendFormat(", {0}", data.ConstructionPersonCode); |
303 |
strcmd.AppendFormat(", {0}", data.ConstrSubDepCode); |
|
289 | 304 |
strcmd.AppendFormat(", {0}", data.ConstrSubPersonCode); |
305 |
strcmd.AppendFormat(", {0}", data.ConstrInstrDepCode); |
|
290 | 306 |
strcmd.AppendFormat(", {0}", data.ConstructionInstructor); |
291 | 307 |
|
292 | 308 |
strcmd.AppendFormat(", {0}", data.TransferConstruction); |
... | ... | |
389 | 405 |
strcmd.AppendFormat(", {0}", work.OrdersDecisionPrice); |
390 | 406 |
strcmd.AppendFormat(", {0}", work.OrdersDecisionPriceInTax); |
391 | 407 |
|
408 |
strcmd.AppendFormat(", {0}", work.SalesDepCode); |
|
392 | 409 |
strcmd.AppendFormat(", {0}", work.SalesPersonCode); |
410 |
strcmd.AppendFormat(", {0}", work.ConstrDepCode); |
|
393 | 411 |
strcmd.AppendFormat(", {0}", work.ConstructionPersonCode); |
412 |
strcmd.AppendFormat(", {0}", work.ConstrSubDepCode); |
|
394 | 413 |
strcmd.AppendFormat(", {0}", work.ConstrSubPersonCode); |
414 |
strcmd.AppendFormat(", {0}", work.ConstrInstrDepCode); |
|
395 | 415 |
strcmd.AppendFormat(", {0}", work.ConstructionInstructor); |
396 | 416 |
|
397 | 417 |
strcmd.AppendFormat(", {0}", work.TransferConstruction); |
... | ... | |
486 | 506 |
strcmd.AppendFormat(", OrdersDecisionPrice = {0}", data.OrdersDecisionPrice); |
487 | 507 |
strcmd.AppendFormat(", OrdersDecisionPriceInTax = {0}", data.OrdersDecisionPriceInTax); |
488 | 508 |
|
509 |
strcmd.AppendFormat(", SalesDepCode = {0}", data.SalesDepCode); |
|
489 | 510 |
strcmd.AppendFormat(", SalesPersonCode = {0}", data.SalesPersonCode); |
511 |
strcmd.AppendFormat(", ConstrDepCode = {0}", data.ConstrDepCode); |
|
490 | 512 |
strcmd.AppendFormat(", ConstructionPersonCode = {0}", data.ConstructionPersonCode); |
513 |
strcmd.AppendFormat(", ConstrSubDepCode = {0}", data.ConstrSubDepCode); |
|
491 | 514 |
strcmd.AppendFormat(", ConstrSubPersonCode = {0}", data.ConstrSubPersonCode); |
515 |
strcmd.AppendFormat(", ConstrInstrDepCode = {0}", data.ConstrInstrDepCode); |
|
492 | 516 |
strcmd.AppendFormat(", ConstructionInstructor = {0}", data.ConstructionInstructor); |
493 | 517 |
|
494 | 518 |
strcmd.AppendFormat(", TransferConstruction = {0}", data.TransferConstruction); |
... | ... | |
600 | 624 |
wrk.OrdersDecisionPrice = CommonMotions.cnvDouble(objwrk[(int)TableColumn.OrdersDecisionPrice]); |
601 | 625 |
wrk.OrdersDecisionPriceInTax = CommonMotions.cnvDouble(objwrk[(int)TableColumn.OrdersDecisionPriceInTax]); |
602 | 626 |
|
627 |
wrk.SalesDepCode = int.Parse(objwrk[(int)TableColumn.SalesDepCode].ToString()); |
|
603 | 628 |
wrk.SalesPersonCode = int.Parse(objwrk[(int)TableColumn.SalesPersonCode].ToString()); |
629 |
wrk.ConstrDepCode = int.Parse(objwrk[(int)TableColumn.ConstrDepCode].ToString()); |
|
604 | 630 |
wrk.ConstructionPersonCode = int.Parse(objwrk[(int)TableColumn.ConstructionPersonCode].ToString()); |
631 |
wrk.ConstrSubDepCode = int.Parse(objwrk[(int)TableColumn.ConstrSubDepCode].ToString()); |
|
605 | 632 |
wrk.ConstrSubPersonCode = int.Parse(objwrk[(int)TableColumn.ConstrSubPersonCode].ToString()); |
633 |
wrk.ConstrInstrDepCode = int.Parse(objwrk[(int)TableColumn.ConstrInstrDepCode].ToString()); |
|
606 | 634 |
wrk.ConstructionInstructor = int.Parse(objwrk[(int)TableColumn.ConstructionInstructor].ToString()); |
607 | 635 |
|
608 | 636 |
wrk.TransferConstruction = int.Parse(objwrk[(int)TableColumn.TransferConstruction].ToString()); |
... | ... | |
731 | 759 |
case (int)TableColumn.OrdersDecisionPriceInTax: |
732 | 760 |
strcmd.AppendFormat(" OrdersDecisionPriceInTax = {0}", ((int)value).ToString()); |
733 | 761 |
break; |
762 |
case (int)TableColumn.SalesDepCode: |
|
763 |
strcmd.AppendFormat(" SalesDepCode = {0}", ((int)value).ToString()); |
|
764 |
break; |
|
734 | 765 |
case (int)TableColumn.SalesPersonCode: |
735 | 766 |
strcmd.AppendFormat(" SalesPersonCode = {0}", ((int)value).ToString()); |
736 | 767 |
break; |
768 |
case (int)TableColumn.ConstrDepCode: |
|
769 |
strcmd.AppendFormat(" ConstrDepCode = {0}", ((int)value).ToString()); |
|
770 |
break; |
|
737 | 771 |
case (int)TableColumn.ConstructionPersonCode: |
738 | 772 |
strcmd.AppendFormat(" ConstructionPersonCode = {0}", ((int)value).ToString()); |
739 | 773 |
break; |
774 |
case (int)TableColumn.ConstrSubDepCode: |
|
775 |
strcmd.AppendFormat(" ConstrSubDepCode = {0}", ((int)value).ToString()); |
|
776 |
break; |
|
740 | 777 |
case (int)TableColumn.ConstrSubPersonCode: |
741 | 778 |
strcmd.AppendFormat(" ConstrSubPersonCode = {0}", ((int)value).ToString()); |
742 | 779 |
break; |
780 |
case (int)TableColumn.ConstrInstrDepCode: |
|
781 |
strcmd.AppendFormat(" ConstrInstrDepCode = {0}", ((int)value).ToString()); |
|
782 |
break; |
|
743 | 783 |
case (int)TableColumn.ConstructionInstructor: |
744 | 784 |
strcmd.AppendFormat(" ConstructionInstructor = {0}", ((int)value).ToString()); |
745 | 785 |
break; |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOConstructionBaseInfoDetail.cs | ||
---|---|---|
153 | 153 |
} |
154 | 154 |
#endregion |
155 | 155 |
|
156 |
#region 追加処理
|
|
156 |
#region 工事基本情報明細追加(1件)
|
|
157 | 157 |
/// <summary> |
158 |
/// 工事基本情報明細追加 |
|
158 |
/// 工事基本情報明細追加(1件)
|
|
159 | 159 |
/// </summary> |
160 | 160 |
/// <param name="data">工事基本情報データ</param> |
161 | 161 |
/// <returns>true:成功 false:失敗</returns> |
... | ... | |
193 | 193 |
return false; |
194 | 194 |
} |
195 | 195 |
} |
196 |
#endregion |
|
197 |
|
|
198 |
#region 工事基本情報明細追加(複数) |
|
196 | 199 |
/// <summary> |
197 |
/// 工事基本情報明細追加 |
|
200 |
/// 工事基本情報明細追加(複数)
|
|
198 | 201 |
/// </summary> |
199 | 202 |
/// <param name="data">工事基本情報データ</param> |
200 | 203 |
/// <returns>true:成功 false:失敗</returns> |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOCostomerRegist.cs | ||
---|---|---|
33 | 33 |
/// </summary> |
34 | 34 |
public enum TableColumn |
35 | 35 |
{ |
36 |
PersonCode = 0, |
|
36 |
CreatePersonCode = 0,
|
|
37 | 37 |
CreateDate, |
38 | 38 |
SeqNo, |
39 | 39 |
DataMode, |
... | ... | |
46 | 46 |
OrderersName1, |
47 | 47 |
OrderersName2, |
48 | 48 |
DepartmentName, |
49 |
ChargePersonName,
|
|
49 |
PersonName, |
|
50 | 50 |
ZipCode, |
51 | 51 |
Address1, |
52 | 52 |
Address2, |
... | ... | |
58 | 58 |
OrderCotegory, |
59 | 59 |
OrderDate, |
60 | 60 |
OrderNo, |
61 |
CreateDepartmentCode, |
|
62 |
CreateDepartmentName, |
|
61 | 63 |
EntryDate, |
62 | 64 |
UpdateDate, |
63 | 65 |
} |
... | ... | |
86 | 88 |
{ |
87 | 89 |
StringBuilder strcmd = new StringBuilder(); |
88 | 90 |
strcmd.Append("SELECT"); |
89 |
strcmd.Append(" PersonCode"); |
|
90 |
strcmd.Append(" ,DATE_FORMAT(CreateDate, '%Y/%m/%d')");
|
|
91 |
strcmd.Append(" ,SeqNo");
|
|
91 |
strcmd.Append(" CreatePersonCode");
|
|
92 |
strcmd.Append(", DATE_FORMAT(CreateDate, '%Y/%m/%d')");
|
|
93 |
strcmd.Append(", SeqNo");
|
|
92 | 94 |
|
93 |
strcmd.Append(" ,DataMode"); |
|
94 |
strcmd.Append(" ,SourceCotegory"); |
|
95 |
strcmd.Append(" ,SourceCode"); |
|
96 |
strcmd.Append(" ,PetitionPeriod"); |
|
97 |
strcmd.Append(" ,OrderFlg"); |
|
98 |
strcmd.Append(" ,CorporateStatusName"); |
|
99 |
strcmd.Append(" ,CorporateStatusPoint"); |
|
100 |
strcmd.Append(" ,OrderersName1"); |
|
101 |
strcmd.Append(" ,OrderersName2"); |
|
102 |
strcmd.Append(" ,DepartmentName"); |
|
103 |
strcmd.Append(" ,ChargePersonName"); |
|
104 |
strcmd.Append(" ,ZipCode"); |
|
105 |
strcmd.Append(" ,Address1"); |
|
106 |
strcmd.Append(" ,Address2"); |
|
107 |
strcmd.Append(" ,Address3"); |
|
108 |
strcmd.Append(" ,PhoneNumber"); |
|
109 |
strcmd.Append(" ,FaxNumber"); |
|
110 |
strcmd.Append(" ,MailAddress"); |
|
111 |
strcmd.Append(" ,Note"); |
|
112 |
strcmd.Append(" ,OrderCotegory"); |
|
113 |
strcmd.Append(" ,DATE_FORMAT(OrderDate, '%Y/%m/%d')"); |
|
114 |
strcmd.Append(" ,OrderNo"); |
|
95 |
strcmd.Append(", DataMode"); |
|
96 |
strcmd.Append(", SourceCotegory"); |
|
97 |
strcmd.Append(", SourceCode"); |
|
98 |
strcmd.Append(", PetitionPeriod"); |
|
99 |
strcmd.Append(", OrderFlg"); |
|
100 |
strcmd.Append(", CorporateStatusName"); |
|
101 |
strcmd.Append(", CorporateStatusPoint"); |
|
102 |
strcmd.Append(", OrderersName1"); |
|
103 |
strcmd.Append(", OrderersName2"); |
|
104 |
strcmd.Append(", DepartmentName"); |
|
105 |
strcmd.Append(", PersonName"); |
|
106 |
strcmd.Append(", ZipCode"); |
|
107 |
strcmd.Append(", Address1"); |
|
108 |
strcmd.Append(", Address2"); |
|
109 |
strcmd.Append(", Address3"); |
|
110 |
strcmd.Append(", PhoneNumber"); |
|
111 |
strcmd.Append(", FaxNumber"); |
|
112 |
strcmd.Append(", MailAddress"); |
|
113 |
strcmd.Append(", Note"); |
|
114 |
strcmd.Append(", OrderCotegory"); |
|
115 |
strcmd.Append(", DATE_FORMAT(OrderDate, '%Y/%m/%d')"); |
|
116 |
strcmd.Append(", OrderNo"); |
|
117 |
strcmd.Append(", CreateDepartmentCode"); |
|
118 |
strcmd.Append(", CreateDepartmentName"); |
|
115 | 119 |
|
116 | 120 |
strcmd.Append(", DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')"); |
117 | 121 |
strcmd.Append(", DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')"); |
... | ... | |
226 | 230 |
|
227 | 231 |
strcmd.Append(") VALUES ("); |
228 | 232 |
|
229 |
strcmd.AppendFormat(" {0}", work.PersonCode); |
|
233 |
strcmd.AppendFormat(" {0}", work.CreatePersonCode);
|
|
230 | 234 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d')", work.CreateDate.ToShortDateString()); |
231 | 235 |
strcmd.AppendFormat(", {0}", work.SeqNo); |
232 | 236 |
strcmd.AppendFormat(", {0}", work.DataMode); |
... | ... | |
239 | 243 |
strcmd.AppendFormat(", '{0}'", work.OrderersName1); |
240 | 244 |
strcmd.AppendFormat(", '{0}'", work.OrderersName2); |
241 | 245 |
strcmd.AppendFormat(", '{0}'", work.DepartmentName); |
242 |
strcmd.AppendFormat(", '{0}'", work.ChargePersonName);
|
|
246 |
strcmd.AppendFormat(", '{0}'", work.PersonName); |
|
243 | 247 |
strcmd.AppendFormat(", '{0}'", work.ZipCode); |
244 | 248 |
strcmd.AppendFormat(", '{0}'", work.Address1); |
245 | 249 |
strcmd.AppendFormat(", '{0}'", work.Address2); |
... | ... | |
251 | 255 |
strcmd.AppendFormat(", {0}", work.OrderCotegory); |
252 | 256 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d')", work.OrderDate.ToShortDateString()); |
253 | 257 |
strcmd.AppendFormat(", {0}", work.OrderNo); |
258 |
strcmd.AppendFormat(", {0}", work.CreateDepartmentCode); |
|
259 |
strcmd.AppendFormat(", '{0}'", work.CreateDepartmentName); |
|
254 | 260 |
|
255 | 261 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate); |
256 | 262 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate); |
... | ... | |
296 | 302 |
if (bDataFirst) strcmd.Append(" ("); |
297 | 303 |
else strcmd.Append(", ("); |
298 | 304 |
|
299 |
strcmd.AppendFormat(" {0}", work.PersonCode); |
|
305 |
strcmd.AppendFormat(" {0}", work.CreatePersonCode);
|
|
300 | 306 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d')", work.CreateDate.ToShortDateString()); |
301 | 307 |
strcmd.AppendFormat(", {0}", work.SeqNo); |
302 | 308 |
strcmd.AppendFormat(", {0}", work.DataMode); |
... | ... | |
309 | 315 |
strcmd.AppendFormat(", '{0}'", work.OrderersName1); |
310 | 316 |
strcmd.AppendFormat(", '{0}'", work.OrderersName2); |
311 | 317 |
strcmd.AppendFormat(", '{0}'", work.DepartmentName); |
312 |
strcmd.AppendFormat(", '{0}'", work.ChargePersonName);
|
|
318 |
strcmd.AppendFormat(", '{0}'", work.PersonName); |
|
313 | 319 |
strcmd.AppendFormat(", '{0}'", work.ZipCode); |
314 | 320 |
strcmd.AppendFormat(", '{0}'", work.Address1); |
315 | 321 |
strcmd.AppendFormat(", '{0}'", work.Address2); |
... | ... | |
321 | 327 |
strcmd.AppendFormat(", {0}", work.OrderCotegory); |
322 | 328 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d')", work.OrderDate.ToShortDateString()); |
323 | 329 |
strcmd.AppendFormat(", {0}", work.OrderNo); |
330 |
strcmd.AppendFormat(", {0}", work.CreateDepartmentCode); |
|
331 |
strcmd.AppendFormat(", '{0}'", work.CreateDepartmentName); |
|
324 | 332 |
|
325 | 333 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate); |
326 | 334 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate); |
... | ... | |
358 | 366 |
|
359 | 367 |
strcmd.Append(" SET"); |
360 | 368 |
|
361 |
strcmd.AppendFormat(" PersonCode = {0}", data.PersonCode);
|
|
369 |
strcmd.AppendFormat(" CreatePersonCode = {0}", data.CreatePersonCode);
|
|
362 | 370 |
strcmd.AppendFormat(", CreateDate = STR_TO_DATE('{0}','%Y/%m/%d')", data.CreateDate.ToShortDateString()); |
363 | 371 |
strcmd.AppendFormat(", SeqNo = {0}", data.SeqNo); |
364 | 372 |
strcmd.AppendFormat(", DataMode = {0}", data.DataMode); |
... | ... | |
371 | 379 |
strcmd.AppendFormat(", OrderersName1 = '{0}'", data.OrderersName1); |
372 | 380 |
strcmd.AppendFormat(", OrderersName2 = '{0}'", data.OrderersName2); |
373 | 381 |
strcmd.AppendFormat(", DepartmentName = '{0}'", data.DepartmentName); |
374 |
strcmd.AppendFormat(", ChargePersonName = '{0}'", data.ChargePersonName);
|
|
382 |
strcmd.AppendFormat(", PersonName = '{0}'", data.PersonName);
|
|
375 | 383 |
strcmd.AppendFormat(", ZipCode = '{0}'", data.ZipCode); |
376 | 384 |
strcmd.AppendFormat(", Address1 = '{0}'", data.Address1); |
377 | 385 |
strcmd.AppendFormat(", Address2 = '{0}'", data.Address2); |
... | ... | |
383 | 391 |
strcmd.AppendFormat(", OrderCotegory = {0}", data.OrderCotegory); |
384 | 392 |
strcmd.AppendFormat(", OrderDate = STR_TO_DATE('{0}','%Y/%m/%d')", data.OrderDate.ToShortDateString()); |
385 | 393 |
strcmd.AppendFormat(", OrderNo = {0}", data.OrderNo); |
394 |
strcmd.AppendFormat(", CreateDepartmentCode = '{0}'", data.CreateDepartmentCode); |
|
395 |
strcmd.AppendFormat(", CreateDepartmentName = '{0}'", data.CreateDepartmentName); |
|
386 | 396 |
|
387 | 397 |
strcmd.Append(", UpdateDate = NOW()"); |
388 | 398 |
strcmd.Append(AddSQLString); |
... | ... | |
441 | 451 |
strcmd.Append(" SET"); |
442 | 452 |
switch (FeildNo) |
443 | 453 |
{ |
444 |
case (int)TableColumn.PersonCode: |
|
445 |
strcmd.AppendFormat(" PersonCode = {0}", ((int)value).ToString()); |
|
454 |
case (int)TableColumn.CreatePersonCode:
|
|
455 |
strcmd.AppendFormat(" CreatePersonCode = {0}", ((int)value).ToString());
|
|
446 | 456 |
break; |
447 | 457 |
case (int)TableColumn.CreateDate: |
448 | 458 |
strcmd.AppendFormat(" CreateDate = STR_TO_DATE('{0}','%Y/%m/%d')", ((DateTime)value).ToShortDateString()); |
... | ... | |
480 | 490 |
case (int)TableColumn.DepartmentName: |
481 | 491 |
strcmd.AppendFormat(" DepartmentName = '{0}'", value.ToString()); |
482 | 492 |
break; |
483 |
case (int)TableColumn.ChargePersonName:
|
|
484 |
strcmd.AppendFormat(" ChargePersonName = '{0}'", value.ToString());
|
|
493 |
case (int)TableColumn.PersonName: |
|
494 |
strcmd.AppendFormat(" PersonName = '{0}'", value.ToString()); |
|
485 | 495 |
break; |
486 | 496 |
case (int)TableColumn.ZipCode: |
487 | 497 |
strcmd.AppendFormat(" ZipCode = '{0}'", value.ToString()); |
... | ... | |
516 | 526 |
case (int)TableColumn.OrderNo: |
517 | 527 |
strcmd.AppendFormat(" OrderNo = {0}", ((int)value).ToString()); |
518 | 528 |
break; |
529 |
case (int)TableColumn.CreateDepartmentCode: |
|
530 |
strcmd.AppendFormat(" CreateDepartmentCode = {0}", ((int)value).ToString()); |
|
531 |
break; |
|
532 |
case (int)TableColumn.CreateDepartmentName: |
|
533 |
strcmd.AppendFormat(" CreateDepartmentName = '{0}'", value.ToString()); |
|
534 |
break; |
|
519 | 535 |
} |
520 | 536 |
|
521 | 537 |
strcmd.Append(", UpdateDate = NOW()"); |
... | ... | |
544 | 560 |
try |
545 | 561 |
{ |
546 | 562 |
// データ取得 |
547 |
wrk.PersonCode = int.Parse(objwrk[(int)TableColumn.PersonCode].ToString());
|
|
563 |
wrk.CreatePersonCode = int.Parse(objwrk[(int)TableColumn.CreatePersonCode].ToString());
|
|
548 | 564 |
wrk.CreateDate = DateTime.Parse(objwrk[(int)TableColumn.CreateDate].ToString()); |
549 | 565 |
wrk.SeqNo = int.Parse(objwrk[(int)TableColumn.SeqNo].ToString()); |
550 | 566 |
|
... | ... | |
559 | 575 |
wrk.OrderersName1 = objwrk[(int)TableColumn.OrderersName1].ToString(); |
560 | 576 |
wrk.OrderersName2 = objwrk[(int)TableColumn.OrderersName2].ToString(); |
561 | 577 |
wrk.DepartmentName = objwrk[(int)TableColumn.DepartmentName].ToString(); |
562 |
wrk.ChargePersonName = objwrk[(int)TableColumn.ChargePersonName].ToString();
|
|
578 |
wrk.PersonName = objwrk[(int)TableColumn.PersonName].ToString();
|
|
563 | 579 |
wrk.ZipCode = objwrk[(int)TableColumn.ZipCode].ToString(); |
564 | 580 |
wrk.Address1 = objwrk[(int)TableColumn.Address1].ToString(); |
565 | 581 |
wrk.Address2 = objwrk[(int)TableColumn.Address2].ToString(); |
... | ... | |
571 | 587 |
wrk.OrderCotegory = int.Parse(objwrk[(int)TableColumn.OrderCotegory].ToString()); |
572 | 588 |
wrk.OrderDate = DateTime.Parse(objwrk[(int)TableColumn.OrderDate].ToString()); |
573 | 589 |
wrk.OrderNo = int.Parse(objwrk[(int)TableColumn.OrderNo].ToString()); |
590 |
wrk.CreateDepartmentCode = int.Parse(objwrk[(int)TableColumn.CreateDepartmentCode].ToString()); |
|
591 |
wrk.CreateDepartmentName = objwrk[(int)TableColumn.CreateDepartmentName].ToString(); |
|
574 | 592 |
|
575 | 593 |
wrk.EntryDate = DateTime.Parse(objwrk[(int)TableColumn.EntryDate].ToString()); |
576 | 594 |
wrk.UpdateDate = DateTime.Parse(objwrk[(int)TableColumn.UpdateDate].ToString()); |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMChgChargeDep.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Data; |
|
6 |
using System.Collections; |
|
7 |
|
|
8 |
using log4net; |
|
9 |
using MySql.Data.MySqlClient; // Data Provider for MySql |
|
10 |
|
|
11 |
using ProcessManagement.DB.MySql; |
|
12 |
using ProcessManagement.DB.Core; |
|
13 |
using ProcessManagement.DataModel; |
|
14 |
|
|
15 |
using ProcessManagement.Common; |
|
16 |
|
|
17 |
namespace ProcessManagement.DB.IOAccess |
|
18 |
{ |
|
19 |
/// <summary> |
|
20 |
/// 担当者部署履歴データDBアクセス |
|
21 |
/// </summary> |
|
22 |
public class IOMChgChargeDep : MySqlProcess |
|
23 |
{ |
|
24 |
#region 定義部 |
|
25 |
/// <summary> |
|
26 |
/// log4netログを使用する |
|
27 |
/// </summary> |
|
28 |
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
29 |
#endregion |
|
30 |
|
|
31 |
#region 定数 |
|
32 |
/// <summary> |
|
33 |
/// 担当者部署履歴データフィールド並び |
|
34 |
/// </summary> |
|
35 |
public enum ColumnCnt |
|
36 |
{ |
|
37 |
PersonCode = 0, |
|
38 |
StartDate, |
|
39 |
CompDate, |
|
40 |
DepartmentCode, |
|
41 |
DepartmentName, |
|
42 |
EntryDate, |
|
43 |
UpdateDate, |
|
44 |
} |
|
45 |
#endregion |
|
46 |
|
|
47 |
#region コンストラクタ |
|
48 |
/// <summary> |
|
49 |
/// コンストラクタ |
|
50 |
/// </summary> |
|
51 |
/// <param name="ConnectionString"></param> |
|
52 |
public IOMChgChargeDep() |
|
53 |
: base(DBCommon.Instance.DBConnectString) |
|
54 |
{ |
|
55 |
} |
|
56 |
|
|
57 |
#endregion |
|
58 |
|
|
59 |
#region 担当者部署履歴データ検索文字列作成 |
|
60 |
/// <summary> |
|
61 |
/// 担当者部署履歴データ検索文字列作成 |
|
62 |
/// </summary> |
|
63 |
/// <param name="AddSQLString">検索条件SQL文字列</param> |
|
64 |
/// <param name="data">担当者部署履歴データデータ</param> |
|
65 |
/// <returns>true:成功 false:失敗</returns> |
|
66 |
private string CreateSelectSQL() |
|
67 |
{ |
|
68 |
StringBuilder strcmd = new StringBuilder(); |
|
69 |
strcmd.Append("SELECT"); |
|
70 |
strcmd.Append(" PersonCode"); |
|
71 |
strcmd.Append(", DATE_FORMAT(StartDate, '%Y/%m/%d')"); |
|
72 |
|
|
73 |
strcmd.Append(", DATE_FORMAT(CompDate, '%Y/%m/%d')"); |
|
74 |
strcmd.Append(", DepartmentCode"); |
|
75 |
strcmd.Append(", DepartmentName"); |
|
76 |
|
|
77 |
strcmd.Append(", DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')"); |
|
78 |
strcmd.Append(", DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')"); |
|
79 |
|
|
80 |
strcmd.Append(" FROM ChgChargeDep"); |
|
81 |
|
|
82 |
return strcmd.ToString(); |
|
83 |
} |
|
84 |
#endregion |
|
85 |
|
|
86 |
#region 担当者部署履歴データ複数検索 |
|
87 |
/// <summary> |
|
88 |
/// 担当者部署履歴データ複数検索 |
|
89 |
/// </summary> |
|
90 |
/// <param name="AddSQLString"></param> |
|
91 |
/// <param name="data"></param> |
|
92 |
/// <param name="bConnect"></param> |
|
93 |
/// <returns></returns> |
|
94 |
public bool SelectAction(string AddSQLString, ref List<ChgChargeDep> data, bool bConnect = true) |
|
95 |
{ |
|
96 |
// インターフェース |
|
97 |
StringBuilder strcmd = new StringBuilder();; |
|
98 |
ArrayList arData = new ArrayList(); |
|
99 |
|
|
100 |
try |
|
101 |
{ |
|
102 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
|
103 |
strcmd.Append(CreateSelectSQL()); |
|
104 |
strcmd.Append(AddSQLString); |
|
105 |
|
|
106 |
// SQL実行 |
|
107 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false; |
|
108 |
|
|
109 |
// データセット |
|
110 |
foreach (object[] objwrk in arData) |
|
111 |
{ |
|
112 |
ChgChargeDep work = new ChgChargeDep(); |
|
113 |
Reader2Struct(objwrk, ref work); |
|
114 |
data.Add(work); |
|
115 |
} |
|
116 |
|
|
117 |
return true; |
|
118 |
} |
|
119 |
catch (Exception ex) |
|
120 |
{ |
|
121 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
122 |
return false; |
|
123 |
} |
|
124 |
} |
|
125 |
#endregion |
|
126 |
|
|
127 |
#region 担当者部署履歴データ1件検索 |
|
128 |
/// <summary> |
|
129 |
/// 担当者部署履歴データ1件検索 |
|
130 |
/// </summary> |
|
131 |
/// <param name="AddSQLString"></param> |
|
132 |
/// <param name="data"></param> |
|
133 |
/// <param name="bConnect"></param> |
|
134 |
/// <returns></returns> |
|
135 |
public bool SelectAction(string AddSQLString, ref ChgChargeDep data, bool bConnect = true) |
|
136 |
{ |
|
137 |
// インターフェース |
|
138 |
StringBuilder strcmd = new StringBuilder();; |
|
139 |
ArrayList arData = new ArrayList(); |
|
140 |
|
|
141 |
try |
|
142 |
{ |
|
143 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
|
144 |
strcmd.Append(CreateSelectSQL()); |
|
145 |
strcmd.Append(AddSQLString); |
|
146 |
|
|
147 |
// SQL実行 |
|
148 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false; |
|
149 |
if (arData.Count == 0) return false; |
|
150 |
|
|
151 |
// データセット |
|
152 |
object[] objwrk = (object[])arData[0]; |
|
153 |
Reader2Struct(objwrk, ref data); |
|
154 |
|
|
155 |
return true; |
|
156 |
} |
|
157 |
catch (Exception ex) |
|
158 |
{ |
|
159 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
160 |
return false; |
|
161 |
} |
|
162 |
} |
|
163 |
#endregion |
|
164 |
|
|
165 |
#region 担当者マスタ追加(1件) |
|
166 |
/// <summary> |
|
167 |
/// 担当者マスタ追加(1件) |
|
168 |
/// </summary> |
|
169 |
/// <param name="data">担当者マスタデータ</param> |
|
170 |
/// <returns>true:成功 false:失敗</returns> |
|
171 |
public bool InsertAction(ChgChargeDep work, bool bConnect = true) |
|
172 |
{ |
|
173 |
StringBuilder strcmd = new StringBuilder(); |
|
174 |
try |
|
175 |
{ |
|
176 |
|
|
177 |
strcmd.Append("INSERT INTO ChgChargeDep"); |
|
178 |
strcmd.Append(" ("); |
|
179 |
|
|
180 |
bool bFirst = true; |
|
181 |
foreach (var gender in Enum.GetValues(typeof(ColumnCnt))) |
|
182 |
{ |
|
183 |
if (!bFirst) strcmd.Append(" ,"); |
|
184 |
strcmd.Append(gender.ToString()); |
|
185 |
bFirst = false; |
|
186 |
} |
|
187 |
|
|
188 |
strcmd.Append(") VALUES ("); |
|
189 |
|
|
190 |
strcmd.AppendFormat(" {0}", work.PersonCode); |
|
191 |
strcmd.AppendFormat(", STR_TO_DATE('{0}', '%Y/%m/%d')", work.StartDate.ToShortDateString()); |
|
192 |
|
|
193 |
strcmd.AppendFormat(", STR_TO_DATE('{0}', '%Y/%m/%d')", work.CompDate.ToShortDateString()); |
|
194 |
strcmd.AppendFormat(", {0}", work.DepartmentCode); |
|
195 |
strcmd.AppendFormat(",'{0}'", work.DepartmentName); |
|
196 |
|
|
197 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate); |
|
198 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate); |
|
199 |
strcmd.Append(")"); |
|
200 |
|
|
201 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false; |
|
202 |
|
|
203 |
return true; |
|
204 |
} |
|
205 |
catch (Exception ex) |
|
206 |
{ |
|
207 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
208 |
return false; |
|
209 |
} |
|
210 |
} |
|
211 |
#endregion |
|
212 |
|
|
213 |
#region 担当者部署履歴データ追加(複数) |
|
214 |
/// <summary> |
|
215 |
/// 担当者部署履歴データ追加(複数) |
|
216 |
/// </summary> |
|
217 |
/// <param name="data">担当者部署履歴データデータ</param> |
|
218 |
/// <returns>true:成功 false:失敗</returns> |
|
219 |
public bool InsertAction(List<ChgChargeDep> data, bool bConnect = true) |
|
220 |
{ |
|
221 |
StringBuilder strcmd = new StringBuilder();; |
|
222 |
try |
|
223 |
{ |
|
224 |
bool bColFirst = true; |
|
225 |
strcmd.Append("INSERT INTO ChgChargeDep"); |
|
226 |
strcmd.Append(" ("); |
|
227 |
foreach (var gender in Enum.GetValues(typeof(ColumnCnt))) |
|
228 |
{ |
|
229 |
if (!bColFirst) strcmd.Append(", "); |
|
230 |
strcmd.Append(gender.ToString()); |
|
231 |
bColFirst = false; |
|
232 |
} |
|
233 |
strcmd.Append(") VALUES"); |
|
234 |
|
|
235 |
bool bDataFirst = true; |
|
236 |
foreach (ChgChargeDep work in data) |
|
237 |
{ |
|
238 |
if (bDataFirst) strcmd.Append(" ("); |
|
239 |
else strcmd.Append(", ("); |
|
240 |
|
|
241 |
strcmd.AppendFormat(" {0}", work.PersonCode); |
|
242 |
strcmd.AppendFormat(", STR_TO_DATE('{0}', '%Y/%m/%d')", work.StartDate.ToShortDateString()); |
|
243 |
|
|
244 |
strcmd.AppendFormat(", STR_TO_DATE('{0}', '%Y/%m/%d')", work.CompDate.ToShortDateString()); |
|
245 |
strcmd.AppendFormat(", {0}", work.DepartmentCode); |
|
246 |
strcmd.AppendFormat(",'{0}'", work.DepartmentName); |
|
247 |
|
|
248 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate); |
|
249 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate); |
|
250 |
strcmd.Append(")"); |
|
251 |
|
|
252 |
bDataFirst = false; |
|
253 |
} |
|
254 |
|
|
255 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false; |
|
256 |
|
|
257 |
return true; |
|
258 |
} |
|
259 |
catch (Exception ex) |
|
260 |
{ |
|
261 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
262 |
return false; |
|
263 |
} |
|
264 |
} |
|
265 |
#endregion |
|
266 |
|
|
267 |
#region 担当者部署履歴データ更新 |
|
268 |
/// <summary> |
|
269 |
/// 担当者部署履歴データ更新 |
|
270 |
/// </summary> |
|
271 |
/// <param name="AddSQLString">更新条件SQL文字列</param> |
|
272 |
/// <param name="data">担当者部署履歴データデータ</param> |
|
273 |
/// <returns>true:成功 false:失敗</returns> |
|
274 |
public bool UpdateAction(string AddSQLString, ChgChargeDep data, bool bConnect = true) |
|
275 |
{ |
|
276 |
StringBuilder strcmd = new StringBuilder();; |
|
277 |
try |
|
278 |
{ |
|
279 |
|
|
280 |
strcmd.Append("UPDATE ChgChargeDep"); |
|
281 |
|
|
282 |
strcmd.Append(" SET"); |
|
283 |
|
|
284 |
strcmd.AppendFormat(" PersonCode = {0}", data.PersonCode); |
|
285 |
|
|
286 |
strcmd.AppendFormat(", StartDate = STR_TO_DATE('{0}' ,'%Y/%m/%d')", data.StartDate.ToShortDateString()); |
|
287 |
strcmd.AppendFormat(", CompDate = STR_TO_DATE('{0}' ,'%Y/%m/%d')", data.CompDate.ToShortDateString()); |
|
288 |
|
|
289 |
strcmd.AppendFormat(", DepartmentCode = {0}", data.DepartmentCode); |
|
290 |
strcmd.AppendFormat(", DepartmentName = '{0}'", data.DepartmentName); |
|
291 |
|
|
292 |
strcmd.Append(", UpdateDate = NOW()"); |
|
293 |
strcmd.Append(AddSQLString); |
|
294 |
|
|
295 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false; |
|
296 |
|
|
297 |
return true; |
|
298 |
} |
|
299 |
catch (Exception ex) |
|
300 |
{ |
|
301 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
302 |
return false; |
|
303 |
} |
|
304 |
} |
|
305 |
#endregion |
|
306 |
|
|
307 |
#region 担当者部署履歴データ削除 |
|
308 |
/// <summary> |
|
309 |
/// 担当者部署履歴データ削除 |
|
310 |
/// </summary> |
|
311 |
/// <param name="AddSQLString">削除条件SQL文字列</param> |
|
312 |
/// <param name="data">担当者部署履歴データデータ</param> |
|
313 |
/// <returns>true:成功 false:失敗</returns> |
|
314 |
public bool DeleteAction(string AddSQLString, bool bConnect = true) |
|
315 |
{ |
|
316 |
// インターフェース |
|
317 |
StringBuilder strcmd = new StringBuilder();; |
|
318 |
try |
|
319 |
{ |
|
320 |
strcmd.AppendFormat("{0}{1}", "DELETE FROM ChgChargeDep", AddSQLString); |
|
321 |
|
|
322 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false; |
|
323 |
|
|
324 |
return true; |
|
325 |
} |
|
326 |
catch (Exception ex) |
|
327 |
{ |
|
328 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
329 |
return false; |
|
330 |
} |
|
331 |
} |
|
332 |
#endregion |
|
333 |
|
|
334 |
#region 1項目更新処理 |
|
335 |
/// <summary> |
|
336 |
/// 1項目の更新を行う |
|
337 |
/// </summary> |
|
338 |
/// <param name="PersonCode"></param> |
|
339 |
/// <param name="FeildNo"></param> |
|
340 |
/// <param name="value"></param> |
|
341 |
/// <param name="bConnect"></param> |
|
342 |
/// <returns></returns> |
|
343 |
public bool UpdateFeild(int PersonCode, DateTime StartDate, int FeildNo, object value, bool bConnect = true) |
|
344 |
{ |
|
345 |
StringBuilder strcmd = new StringBuilder();; |
|
346 |
try |
|
347 |
{ |
|
348 |
strcmd.Append("UPDATE ChgChargeDep"); |
|
349 |
|
|
350 |
strcmd.Append(" SET"); |
|
351 |
switch (FeildNo) |
|
352 |
{ |
|
353 |
case (int)ColumnCnt.PersonCode: |
|
354 |
strcmd.AppendFormat(" PersonCode = {0}", ((int)value).ToString()); |
|
355 |
break; |
|
356 |
case (int)ColumnCnt.StartDate: |
|
357 |
strcmd.AppendFormat(" StartDate = STR_TO_DATE('{0}','%Y/%m/%d')", ((DateTime)value).ToShortDateString()); |
|
358 |
break; |
|
359 |
case (int)ColumnCnt.CompDate: |
|
360 |
strcmd.AppendFormat(" CompDate = STR_TO_DATE('{0}','%Y/%m/%d')", ((DateTime)value).ToShortDateString()); |
|
361 |
break; |
|
362 |
case (int)ColumnCnt.DepartmentCode: |
|
363 |
strcmd.AppendFormat(" DepartmentCode = {0}", ((int)value).ToString()); |
|
364 |
break; |
|
365 |
case (int)ColumnCnt.DepartmentName: |
|
366 |
strcmd.AppendFormat(" DepartmentName = '{0}'", value.ToString()); |
|
367 |
break; |
|
368 |
} |
|
369 |
|
|
370 |
strcmd.Append(", UpdateDate = NOW()"); |
|
371 |
strcmd.Append(CreatePrimarykeyString(PersonCode, StartDate)); |
|
372 |
|
|
373 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false; |
|
374 |
|
|
375 |
return true; |
|
376 |
} |
|
377 |
catch (Exception ex) |
|
378 |
{ |
|
379 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
380 |
return false; |
|
381 |
} |
|
382 |
} |
|
383 |
#endregion |
|
384 |
|
|
385 |
#region MySQLDataReaderより構造体へセットする |
|
386 |
/// <summary> |
|
387 |
/// MySQLDataReaderより構造体へセットする |
|
388 |
/// </summary> |
|
389 |
/// <param name="reader">MySQLDataReader</param> |
|
390 |
/// <param name="wrk">構造体</param> |
|
391 |
public void Reader2Struct(object[] objwrk, ref ChgChargeDep wrk) |
|
392 |
{ |
|
393 |
try |
|
394 |
{ |
|
395 |
// データ取得 |
|
396 |
wrk.PersonCode = int.Parse(objwrk[(int)ColumnCnt.PersonCode].ToString()); |
|
397 |
wrk.StartDate = DateTime.Parse(objwrk[(int)ColumnCnt.StartDate].ToString()); |
|
398 |
|
|
399 |
wrk.CompDate = DateTime.Parse(objwrk[(int)ColumnCnt.CompDate].ToString()); |
|
400 |
wrk.DepartmentCode = int.Parse(objwrk[(int)ColumnCnt.DepartmentCode].ToString()); |
|
401 |
wrk.DepartmentName = objwrk[(int)ColumnCnt.DepartmentName].ToString(); |
|
402 |
|
|
403 |
wrk.EntryDate = DateTime.Parse(objwrk[(int)ColumnCnt.EntryDate].ToString()); |
|
404 |
wrk.UpdateDate = DateTime.Parse(objwrk[(int)ColumnCnt.UpdateDate].ToString()); |
|
405 |
} |
|
406 |
catch (MySqlException myex) |
|
407 |
{ |
|
408 |
logger.ErrorFormat("MySQLエラー:{0}:{1}", CommonMotions.GetMethodName(2), myex.Message); |
|
409 |
} |
|
410 |
catch (Exception ex) |
|
411 |
{ |
|
412 |
logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(2), ex.Message); |
|
413 |
} |
|
414 |
} |
|
415 |
#endregion |
|
416 |
|
|
417 |
#region 構造体クリア |
|
418 |
/// <summary> |
|
419 |
/// 構造体クリア |
|
420 |
/// </summary> |
|
421 |
/// <param name="wrk"></param> |
|
422 |
public void ClearStruct(ref ChgChargeDep wrk) |
|
423 |
{ |
|
424 |
wrk.PersonCode = 0; // 担当者コード |
|
425 |
wrk.StartDate = DateTime.MinValue; // マスタ使用開始年月日付 |
|
426 |
|
|
427 |
wrk.CompDate = DateTime.MinValue; // マスタ使用終了年月日付 |
|
428 |
wrk.DepartmentCode = 0; // 部署コード |
|
429 |
wrk.DepartmentName = string.Empty; // 部署名 |
|
430 |
|
|
431 |
wrk.EntryDate = DateTime.MinValue; // 登録日付 |
|
432 |
wrk.UpdateDate = DateTime.MinValue; // 更新日付 |
|
433 |
} |
|
434 |
#endregion |
|
435 |
|
|
436 |
#region 主キー検索の文字列を返す |
|
437 |
/// <summary> |
|
438 |
/// 主キー検索の文字列を返す |
|
439 |
/// </summary> |
|
440 |
/// <param name="ItemCode">大工種キー</param> |
|
441 |
/// <returns>Where文字列</returns> |
|
442 |
public string CreatePrimarykeyString(int PersonCode, DateTime StartDate) |
|
443 |
{ |
|
444 |
StringBuilder strWork = new StringBuilder(); |
|
445 |
try |
|
446 |
{ |
|
447 |
strWork.AppendFormat(" Where PersonCode = {0}", PersonCode); |
|
448 |
if (StartDate != DateTime.MinValue) |
|
449 |
strWork.AppendFormat(" And StartDate = STR_TO_DATE('{0}','%Y/%m/%d')", StartDate.ToShortDateString()); |
|
450 |
} |
|
451 |
catch (Exception ex) |
|
452 |
{ |
|
453 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString()); |
|
454 |
} |
|
455 |
|
|
456 |
return strWork.ToString(); |
|
457 |
} |
|
458 |
#endregion |
|
459 |
} |
|
460 |
} |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMPersonInCharge.cs | ||
---|---|---|
190 | 190 |
} |
191 | 191 |
#endregion |
192 | 192 |
|
193 |
#region 担当者マスタ追加 |
|
193 |
#region 担当者マスタ追加(1件)
|
|
194 | 194 |
/// <summary> |
195 |
/// 担当者マスタ追加 |
|
195 |
/// 担当者マスタ追加(1件)
|
|
196 | 196 |
/// </summary> |
197 | 197 |
/// <param name="data">担当者マスタデータ</param> |
198 | 198 |
/// <returns>true:成功 false:失敗</returns> |
199 |
public bool InsertAction(PersonInChargeMaster work, bool bConnect = true) |
|
200 |
{ |
|
201 |
StringBuilder strcmd = new StringBuilder(); |
|
202 |
try |
|
203 |
{ |
|
204 |
|
|
205 |
strcmd.Append("INSERT INTO PersonInChargeMaster"); |
|
206 |
strcmd.Append(" ("); |
|
207 |
|
|
208 |
bool bFirst = true; |
|
209 |
foreach (var gender in Enum.GetValues(typeof(ColumnCnt))) |
|
210 |
{ |
|
211 |
if (!bFirst) strcmd.Append(" ,"); |
|
212 |
strcmd.Append(gender.ToString()); |
|
213 |
bFirst = false; |
|
214 |
} |
|
215 |
|
|
216 |
strcmd.Append(") VALUES ("); |
|
217 |
|
|
218 |
strcmd.AppendFormat(" {0}", work.PersonCode); |
|
219 |
strcmd.AppendFormat(", {0}", work.DisplayOrder); |
|
220 |
strcmd.AppendFormat(", '{0}'", work.PersonName); |
|
221 |
strcmd.AppendFormat(", STR_TO_DATE('{0}' ,'%Y/%m/%d')", work.StartDate.ToShortDateString()); |
|
222 |
strcmd.AppendFormat(", STR_TO_DATE('{0}' ,'%Y/%m/%d')", work.EndDate.ToShortDateString()); |
|
223 |
strcmd.AppendFormat(", '{0}'", work.PassWord); |
|
224 |
strcmd.AppendFormat(", {0}", work.SecurityManagement); |
|
225 |
strcmd.AppendFormat(", {0}", work.SecCode); |
|
226 |
strcmd.AppendFormat(", '{0}'", work.MsgBackColor); |
|
227 |
strcmd.AppendFormat(", '{0}'", work.DisplayString); |
|
228 |
strcmd.AppendFormat(", {0}", work.DepartmentCode); |
|
229 |
strcmd.AppendFormat(", {0}", work.MonthlySalary); |
|
230 |
strcmd.AppendFormat(", {0}", work.YearSalary); |
|
231 |
strcmd.AppendFormat(", '{0}'", work.Qualification); |
|
232 |
strcmd.AppendFormat(", '{0}'", work.SealPrintName); |
|
233 |
strcmd.AppendFormat(", {0}", work.EmployeeClassFlg); |
|
234 |
strcmd.AppendFormat(", {0}", work.LedgerFlg); |
|
235 |
strcmd.AppendFormat(", {0}", work.CommutingDistance); |
|
236 |
strcmd.AppendFormat(", {0}", work.CommuteCosts); |
|
237 |
strcmd.AppendFormat(", {0}", work.DeleteFlg); |
|
238 |
|
|
239 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate); |
|
240 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate); |
|
241 |
strcmd.Append(")"); |
|
242 |
|
|
243 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false; |
|
244 |
|
|
245 |
return true; |
|
246 |
} |
|
247 |
catch (Exception ex) |
|
248 |
{ |
|
249 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString()); |
|
250 |
return false; |
|
251 |
} |
|
252 |
} |
|
253 |
#endregion |
|
254 |
|
|
255 |
#region 担当者マスタ追加(複数) |
|
256 |
/// <summary> |
|
257 |
/// 担当者マスタ追加(複数) |
|
258 |
/// </summary> |
|
259 |
/// <param name="data">担当者マスタデータ</param> |
|
260 |
/// <returns>true:成功 false:失敗</returns> |
|
199 | 261 |
public bool InsertAction(List<PersonInChargeMaster> data, bool bConnect = true) |
200 | 262 |
{ |
201 | 263 |
StringBuilder strcmd = new StringBuilder();; |
... | ... | |
491 | 553 |
wrk.DisplayOrder = 0; // 表示順 |
492 | 554 |
wrk.PersonName = string.Empty; // 担当者名 |
493 | 555 |
wrk.StartDate = DateTime.MinValue; // マスタ使用開始年月日付 |
494 |
wrk.EndDate = DateTime.MinValue; // マスタ使用開始年月日付
|
|
556 |
wrk.EndDate = DateTime.MinValue; // マスタ使用終了年月日付
|
|
495 | 557 |
wrk.PassWord = string.Empty; // パスワード |
496 | 558 |
wrk.SecurityManagement = 0; // 機密区分 |
497 | 559 |
wrk.SecCode = 0; // 保護区分番号 |
branches/src/ProcessManagement/ProcessManagement/DataModel/ChgChargeDep.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
|
|
6 |
namespace ProcessManagement.DataModel |
|
7 |
{ |
|
8 |
/// <summary> |
|
9 |
/// 担当者部署履歴データ |
|
10 |
/// </summary> |
|
11 |
public class ChgChargeDep |
|
12 |
{ |
|
13 |
#region 定数 |
|
14 |
#region 担当者マスタ:社員区分 |
|
15 |
/// <summary> |
|
16 |
/// 社員区分 |
|
17 |
/// </summary> |
|
18 |
public enum EmployeeClassFlgDef |
|
19 |
{ |
他の形式にエクスポート: Unified diff