public void LockPg(string random, string pgId, string lockId, int type) { #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { return; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UnLockPg(認証処理)", ex); return; } #endregion try { ExMySQLData db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString); DataPgLock.geLovkFlg lockFlg; if (type == 0) { DataPgLock.DelLockPg(companyId, userId, pgId, lockId, ipAdress, true, db); } else { DataPgLock.SetLockPg(companyId, userId, pgId, lockId, ipAdress, db, out lockFlg); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UnLockPg", ex); return; } }
public string ChkClassExist(string random, int classKbn, string Id) { #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { return(_message); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".ChkClassExist(認証処理)", ex); return(CLASS_NM + ".ChkClassExist : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString());; } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); int _classKbn = ((classKbn - 1)) * 3 + 1; #region Exist Data bool _ret = false; switch (_classKbn) { case 1: // 得意先分類 _ret = DataExists.IsExistData(db, companyId, "", "M_CUSTOMER", "GROUP1_ID", string.Format("{0:000", ExCast.zCInt(Id)), CommonUtl.geStrOrNumKbn.String); if (_ret == true) { return("得意先分類ID : " + Id + " は得意先マスタで使用されている為、削除できません。"); } break; case 2: // 商品分類 _ret = DataExists.IsExistData(db, companyId, "", "M_COMMODITY", "GROUP1_ID", string.Format("{0:000", ExCast.zCInt(Id)), CommonUtl.geStrOrNumKbn.String); if (_ret == true) { return("商品分類ID : " + Id + " は商品マスタで使用されている為、削除できません。"); } break; case 3: // 仕入先分類 _ret = DataExists.IsExistData(db, companyId, "", "M_PURCHASE", "GROUP1_ID", string.Format("{0:000", ExCast.zCInt(Id)), CommonUtl.geStrOrNumKbn.String); if (_ret == true) { return("仕入先分類ID : " + Id + " は仕入先マスタで使用されている為、削除できません。"); } break; } #endregion } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".ChkClassExist", ex); return(CLASS_NM + ".ChkClassExist : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString()); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, ""); return(""); }
public EntityCommodity GetCommodity(string random, string Id) { EntityCommodity entity; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityCommodity(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetCommodity(認証処理)", ex); entity = new EntityCommodity(); entity.MESSAGE = CLASS_NM + ".GetCommodity : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,PU.NAME AS MAIN_PURCHASE_NAME " + Environment.NewLine); sb.Append(" ,NM1.DESCRIPTION AS UNIT_NAME " + Environment.NewLine); sb.Append(" ,NM2.DESCRIPTION AS TAXATION_DIVISION_NAME " + Environment.NewLine); sb.Append(" ,NM3.DESCRIPTION AS INVENTORY_MANAGEMENT_DIVISION_NAME " + Environment.NewLine); sb.Append(" ,NM4.DESCRIPTION AS INVENTORY_EVALUATION_NAME " + Environment.NewLine); sb.Append(" ,CL1.NAME AS GROUP1_NAME " + Environment.NewLine); sb.Append(" ,CL2.NAME AS GROUP2_NAME " + Environment.NewLine); sb.Append(" ,CL3.NAME AS GROUP3_NAME " + Environment.NewLine); sb.Append(" ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine); sb.Append(" FROM M_COMMODITY AS MT" + Environment.NewLine); #region Join // 仕入先 sb.Append(" LEFT JOIN M_PURCHASE AS PU" + Environment.NewLine); sb.Append(" ON PU.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND PU.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND PU.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND PU.ID = MT.MAIN_PURCHASE_ID" + Environment.NewLine); // 単位 sb.Append(" LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine); sb.Append(" ON NM1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.UNIT_ID + Environment.NewLine); sb.Append(" AND NM1.ID = MT.UNIT_ID" + Environment.NewLine); // 課税区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM2" + Environment.NewLine); sb.Append(" ON NM2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM2.DIVISION_ID = " + (int)CommonUtl.geNameKbn.TAX_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM2.ID = MT.TAXATION_DIVISION_ID" + Environment.NewLine); // 在庫管理区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM3" + Environment.NewLine); sb.Append(" ON NM3.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM3.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM3.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INVENTORY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM3.ID = MT.INVENTORY_MANAGEMENT_DIVISION_ID" + Environment.NewLine); // 在庫評価 sb.Append(" LEFT JOIN SYS_M_NAME AS NM4" + Environment.NewLine); sb.Append(" ON NM4.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM4.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM4.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INVENTORY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM4.ID = MT.INVENTORY_EVALUATION_ID" + Environment.NewLine); // 商品分類1 sb.Append(" LEFT JOIN M_CLASS AS CL1" + Environment.NewLine); sb.Append(" ON CL1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CL1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CL1.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND CL1.CLASS_DIVISION_ID = " + (int)CommonUtl.geMGroupKbn.CommodityGrouop1 + Environment.NewLine); sb.Append(" AND CL1.ID = MT.GROUP1_ID" + Environment.NewLine); // 商品分類2 sb.Append(" LEFT JOIN M_CLASS AS CL2" + Environment.NewLine); sb.Append(" ON CL2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CL2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CL2.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND CL2.CLASS_DIVISION_ID = " + (int)CommonUtl.geMGroupKbn.CommodityGrouop2 + Environment.NewLine); sb.Append(" AND CL2.ID = MT.GROUP2_ID" + Environment.NewLine); // 商品分類3 sb.Append(" LEFT JOIN M_CLASS AS CL3" + Environment.NewLine); sb.Append(" ON CL3.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CL3.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CL3.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND CL3.CLASS_DIVISION_ID = " + (int)CommonUtl.geMGroupKbn.CommodityGrouop3 + Environment.NewLine); sb.Append(" AND CL3.ID = MT.GROUP3_ID" + Environment.NewLine); // 表示区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine); sb.Append(" ON NM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM.ID = MT.DISPLAY_FLG" + Environment.NewLine); #endregion sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.SET_COMMODITY_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine); sb.Append(" ,MT.ID " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { entity = new EntityCommodity(); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, ExCast.zNumZeroNothingFormat(Id), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetCommodity : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } #region Set Entity entity.id = ExCast.zCStr(dt.DefaultView[0]["ID"]); entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]); entity.kana = ExCast.zCStr(dt.DefaultView[0]["KANA"]); entity.unit_id = ExCast.zCInt(dt.DefaultView[0]["UNIT_ID"]); entity.unit_nm = ExCast.zCStr(dt.DefaultView[0]["UNIT_NAME"]); entity.enter_number = ExCast.zCDbl(dt.DefaultView[0]["ENTER_NUMBER"]); entity.number_decimal_digit = ExCast.zCInt(dt.DefaultView[0]["NUMBER_DECIMAL_DIGIT"]); entity.unit_decimal_digit = ExCast.zCInt(dt.DefaultView[0]["UNIT_DECIMAL_DIGIT"]); entity.taxation_divition_id = ExCast.zCInt(dt.DefaultView[0]["TAXATION_DIVISION_ID"]); entity.taxation_divition_nm = ExCast.zCStr(dt.DefaultView[0]["TAXATION_DIVISION_NAME"]); entity.inventory_management_division_id = ExCast.zCInt(dt.DefaultView[0]["INVENTORY_MANAGEMENT_DIVISION_ID"]); entity.inventory_management_division_nm = ExCast.zCStr(dt.DefaultView[0]["INVENTORY_MANAGEMENT_DIVISION_NAME"]); entity.purchase_lot = ExCast.zCDbl(dt.DefaultView[0]["PURCHASE_LOT"]); entity.lead_time = ExCast.zCInt(dt.DefaultView[0]["LEAD_TIME"]); entity.just_inventory_number = ExCast.zCDbl(dt.DefaultView[0]["JUST_INVENTORY_NUMBER"]); entity.inventory_number = ExCast.zCDbl(dt.DefaultView[0]["INVENTORY_NUMBER"]); entity.inventory_evaluation_id = ExCast.zCInt(dt.DefaultView[0]["INVENTORY_EVALUATION_ID"]); entity.inventory_evaluation_nm = ExCast.zCStr(dt.DefaultView[0]["INVENTORY_EVALUATION_NAME"]); entity.main_purchase_id = ExCast.zCStr(dt.DefaultView[0]["MAIN_PURCHASE_ID"]); entity.main_purchase_nm = ExCast.zCStr(dt.DefaultView[0]["MAIN_PURCHASE_NAME"]); entity.retail_price_skip_tax = ExCast.zCDbl(dt.DefaultView[0]["RETAIL_PRICE_SKIP_TAX"]); entity.retail_price_before_tax = ExCast.zCDbl(dt.DefaultView[0]["RETAIL_PRICE_BEFORE_TAX"]); entity.sales_unit_price_skip_tax = ExCast.zCDbl(dt.DefaultView[0]["SALES_UNIT_PRICE_SKIP_TAX"]); entity.sales_unit_price_before_tax = ExCast.zCDbl(dt.DefaultView[0]["SALES_UNIT_PRICE_BEFORE_TAX"]); entity.sales_cost_price_skip_tax = ExCast.zCDbl(dt.DefaultView[0]["SALES_COST_PRICE_SKIP_TAX"]); entity.sales_cost_price_before_tax = ExCast.zCDbl(dt.DefaultView[0]["SALES_COST_PRICE_BEFORE_TAX"]); entity.purchase_unit_price_skip_tax = ExCast.zCDbl(dt.DefaultView[0]["PURCHASE_UNIT_PRICE_SKIP_TAX"]); entity.purchase_unit_price_before_tax = ExCast.zCDbl(dt.DefaultView[0]["PURCHASE_UNIT_PRICE_BEFORE_TAX"]); entity.group1_id = ExCast.zCStr(dt.DefaultView[0]["GROUP1_ID"]); entity.group1_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP1_NAME"]); entity.group2_id = ExCast.zCStr(dt.DefaultView[0]["GROUP2_ID"]); entity.group2_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP2_NAME"]); entity.group3_id = ExCast.zCStr(dt.DefaultView[0]["GROUP3_ID"]); entity.group3_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP3_NAME"]); entity.display_division_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]); entity.display_division_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]); entity.memo = ExCast.zCStr(dt.DefaultView[0]["MEMO"]); entity.lock_flg = (int)lockFlg; #endregion } else { entity = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetCommodity", ex); entity = new EntityCommodity(); entity.MESSAGE = CLASS_NM + ".GetCommodity : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "ID:" + Id.ToString()); return(entity); }
public List <EntityAuthority> GetAuthority(string random, int _user_id) { EntityAuthority entity; List <EntityAuthority> entityList = new List <EntityAuthority>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityAuthority(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".GetAuthority(認証処理)", ex); entity = new EntityAuthority(); entity.MESSAGE = Authority_NM + ".GetAuthority : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT IFNULL(AR.USER_ID, " + _user_id.ToString() + ") AS USER_ID" + Environment.NewLine); sb.Append(" ,MT.ID AS PG_ID " + Environment.NewLine); sb.Append(" ,IFNULL(AR.AUTHORITY_KBN, 0) AS AUTHORITY_KBN" + Environment.NewLine); sb.Append(" ,IFNULL(AR.MEMO, '') AS MEMO" + Environment.NewLine); sb.Append(" ,IFNULL(AR.DISPLAY_INDEX, 0) AS DISPLAY_INDEX" + Environment.NewLine); sb.Append(" FROM SYS_M_PG AS MT" + Environment.NewLine); #region Join sb.Append(" LEFT JOIN M_AUTHORITY AS AR" + Environment.NewLine); sb.Append(" ON AR.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND AR.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND AR.USER_ID = " + _user_id + Environment.NewLine); sb.Append(" AND AR.PG_ID = MT.ID " + Environment.NewLine); #endregion sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.DISPLAY_FLG = 1 " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, _user_id.ToString(), ipAdress, db, out lockFlg); if (strErr != "") { entity = new EntityAuthority(); entity.MESSAGE = Authority_NM + ".GetAuthority : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; entityList.Add(entity); return(entityList); } if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { #region Set Entity entity = new EntityAuthority(); entity.user_id = ExCast.zCInt(dt.DefaultView[i]["USER_ID"]); entity.pg_id = ExCast.zCStr(dt.DefaultView[i]["PG_ID"]); entity.authority_kbn = ExCast.zCInt(dt.DefaultView[i]["AUTHORITY_KBN"]); entity.display_index = ExCast.zCInt(dt.DefaultView[i]["DISPLAY_INDEX"]); entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]); entity.lock_flg = (int)lockFlg; if (entity.pg_id == "ReportTotal" && _user_id == ExCast.zCInt(userId)) { HttpContext.Current.Session[ExSession.REPORT_TOTAL_AUTHORITY_KBN] = entity.authority_kbn; } entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".GetAuthority", ex); entityList.Clear(); entity = new EntityAuthority(); entity.MESSAGE = Authority_NM + ".GetAuthority : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); entityList.Add(entity); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, ""); return(entityList); }
public string UpdateAuthority(string random, List <EntityAuthority> entity, int _user_id) { #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; string personId = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); personId = ExCast.zCStr(HttpContext.Current.Session[ExSession.PERSON_ID]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { return(_message); } } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(認証処理)", ex); return(Authority_NM + ".UpdateAuthority : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString()); } #endregion #region Field StringBuilder sb = new StringBuilder(); DataTable dt; ExMySQLData db = null; string str_authority_kbn = ""; #endregion #region 権限不可ユーザ0件チェック try { bool _flg = true; for (int i = 0; i <= entity.Count - 1; i++) { if (entity[i].authority_kbn < 2 && entity[i].pg_id == "AuthorityMst") { _flg = false; } } if (_flg == false) { ExMySQLData dbSelect = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); #region SQL sb.Append("SELECT MT.USER_ID " + Environment.NewLine); sb.Append(" FROM M_AUTHORITY AS MT" + Environment.NewLine); #region Join sb.Append(" INNER JOIN SYS_M_USER AS UR" + Environment.NewLine); sb.Append(" ON UR.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND UR.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND UR.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND UR.ID = MT.USER_ID " + Environment.NewLine); sb.Append(" AND UR.ID <> " + _user_id + Environment.NewLine); #endregion sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.PG_ID = 'AuthorityMst' " + Environment.NewLine); sb.Append(" AND MT.AUTHORITY_KBN >= 2 " + Environment.NewLine); #endregion dt = dbSelect.GetDataTable(sb.ToString()); if (dt.DefaultView.Count == 0) { return("権限を付加できるユーザが0件になる為、更新できません。"); } dbSelect = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(Check)", ex); return(Authority_NM + ".UpdateAuthority(Check) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Databese Open try { db = new ExMySQLData(ExCast.zCStr(HttpContext.Current.Session[ExSession.DB_CONNECTION_STR])); db.DbOpen(); } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(DbOpen)", ex); return(Authority_NM + ".UpdateAuthority(DbOpen) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region BeginTransaction try { db.ExBeginTransaction(); } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(BeginTransaction)", ex); return(Authority_NM + ".UpdateAuthority(BeginTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Delete try { #region Delete SQL sb.Length = 0; sb.Append("DELETE FROM M_AUTHORITY " + Environment.NewLine); sb.Append(" WHERE USER_ID = " + _user_id + Environment.NewLine); #endregion db.ExecuteSQL(sb.ToString(), false); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(Delete)", ex); return(Authority_NM + ".UpdateAuthority(Delete) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Insert try { for (int i = 0; i <= entity.Count - 1; i++) { #region Insert SQL sb.Length = 0; sb.Append("INSERT INTO M_AUTHORITY " + Environment.NewLine); sb.Append(" ( USER_ID" + Environment.NewLine); sb.Append(" , PG_ID" + Environment.NewLine); sb.Append(" , AUTHORITY_KBN" + Environment.NewLine); sb.Append(" , MEMO" + Environment.NewLine); sb.Append(" , DISPLAY_INDEX" + Environment.NewLine); sb.Append(" , DISPLAY_FLG" + Environment.NewLine); sb.Append(" , UPDATE_FLG" + Environment.NewLine); sb.Append(" , DELETE_FLG" + Environment.NewLine); sb.Append(" , CREATE_PG_ID" + Environment.NewLine); sb.Append(" , CREATE_ADRESS" + Environment.NewLine); sb.Append(" , CREATE_USER_ID" + Environment.NewLine); sb.Append(" , CREATE_PERSON_ID" + Environment.NewLine); sb.Append(" , CREATE_DATE" + Environment.NewLine); sb.Append(" , CREATE_TIME" + Environment.NewLine); sb.Append(" , UPDATE_PG_ID" + Environment.NewLine); sb.Append(" , UPDATE_ADRESS" + Environment.NewLine); sb.Append(" , UPDATE_USER_ID" + Environment.NewLine); sb.Append(" , UPDATE_PERSON_ID" + Environment.NewLine); sb.Append(" , UPDATE_DATE" + Environment.NewLine); sb.Append(" , UPDATE_TIME" + Environment.NewLine); sb.Append(")" + Environment.NewLine); sb.Append("SELECT " + _user_id + Environment.NewLine); // USER_ID sb.Append(" ," + ExEscape.zRepStr(entity[i].pg_id) + Environment.NewLine); // PG_ID sb.Append(" ," + entity[i].authority_kbn + Environment.NewLine); // AUTHORITY_KBN sb.Append(" ," + ExEscape.zRepStr(entity[i].memo) + Environment.NewLine); // MEMO sb.Append(" ," + entity[i].display_index + Environment.NewLine); // DISPLAY_INDEX sb.Append(" ,1" + Environment.NewLine); // DISPLAY_FLG sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins, PG_NM, "M_AUTHORITY", ExCast.zCInt(personId), _user_id.ToString(), ipAdress, userId)); #endregion db.ExecuteSQL(sb.ToString(), false); if (entity[i].pg_id == "ReportTotal" && _user_id == ExCast.zCInt(userId)) { str_authority_kbn = ExCast.zCStr(entity[i].authority_kbn); HttpContext.Current.Session[ExSession.REPORT_TOTAL_AUTHORITY_KBN] = entity[i].authority_kbn; } } } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(Insert)", ex); return(Authority_NM + ".UpdateAuthority(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region PG排他制御 try { DataPgLock.DelLockPg(companyId, userId, PG_NM, "", ipAdress, false, db); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(DelLockPg)", ex); return(Authority_NM + ".UpdateAuthority(DelLockPg) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region CommitTransaction try { db.ExCommitTransaction(); } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(CommitTransaction)", ex); return(Authority_NM + ".UpdateAuthority(CommitTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Database Close try { db.DbClose(); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(DbClose)", ex); return(Authority_NM + ".UpdateAuthority(DbClose) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } finally { db = null; } #endregion #region Add Evidence try { svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.DeleteAndInsert, ""); } catch (Exception ex) { CommonUtl.ExLogger.Error(Authority_NM + ".UpdateAuthority(Add Evidence)", ex); return(Authority_NM + ".UpdateAuthority(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion if (str_authority_kbn != "") { HttpContext.Current.Session[ExSession.REPORT_TOTAL_AUTHORITY_KBN] = ExCast.zCInt(str_authority_kbn); } return(""); }
public List <EntityInvoiceBalance> GetInvoiceBalanceList(string random, string strWhereSql, string strOrderBySql) { List <EntityInvoiceBalance> entityList = new List <EntityInvoiceBalance>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; int idFigureCommodity = 0; int idFigureCustomer = 0; int idFigurePurchase = 0; int idFigureSlipNo = 0; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); idFigureCommodity = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_GOODS]); idFigureCustomer = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]); idFigurePurchase = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_PURCHASE]); idFigureSlipNo = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_SLIP_NO]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetInvoiceBalanceList(認証処理)", ex); EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); ExReportManeger rptMgr = new ExReportManeger(); rptMgr.idFigureCommodity = idFigureCommodity; rptMgr.idFigureCustomer = idFigureCustomer; rptMgr.idFigurePurchase = idFigurePurchase; rptMgr.idFigureSlipNo = idFigureSlipNo; sb.Append(rptMgr.GetInvoiceBalanceListReportSQL(companyId, groupId, strWhereSql, strOrderBySql)); dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { #region Set Entity EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.no = ExCast.zCStr(dt.DefaultView[i]["NO"]); entity.invoice_id = ExCast.zCStr(dt.DefaultView[i]["INVOICE_ID"]); entity.invoice_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_NM"]); entity.invoice_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["INVOICE_YYYYMMDD"]); entity.summing_up_group_id = ExCast.zCStr(dt.DefaultView[i]["SUMMING_UP_GROUP_ID"]); entity.summing_up_group_nm = ExCast.zCStr(dt.DefaultView[i]["SUMMING_UP_GROUP_NM"]); entity.person_id = ExCast.zCInt(dt.DefaultView[i]["INPUT_PERSON"]); entity.person_nm = ExCast.zCStr(dt.DefaultView[i]["INPUT_PERSON_NM"]); entity.collect_plan_day = ExCast.zDateNullToDefault(dt.DefaultView[i]["COLLECT_PLAN_DAY"]); entity.collect_day = ExCast.zCInt(dt.DefaultView[i]["COLLECT_DAY"]); entity.before_invoice_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["BEFORE_INVOICE_YYYYMMDD"]); entity.before_invoice_price = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_INVOICE_PRICE"]); entity.before_invoice_price_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_INVOICE_PRICE"]); entity.receipt_price = ExCast.zCDbl(dt.DefaultView[i]["RECEIPT_PRICE"]); entity.transfer_price = ExCast.zCDbl(dt.DefaultView[i]["TRANSFER_PRICE"]); entity.sales_price = ExCast.zCDbl(dt.DefaultView[i]["SALES_PRICE"]); entity.no_tax_sales_price = ExCast.zCDbl(dt.DefaultView[i]["NO_TAX_SALES_PRICE"]); entity.tax = ExCast.zCDbl(dt.DefaultView[i]["TAX"]); entity.invoice_price = ExCast.zCDbl(dt.DefaultView[i]["INVOICE_PRICE"]); entity.invoice_kbn = ExCast.zCInt(dt.DefaultView[i]["INVOICE_KBN"]); entity.invoice_kbn_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_KBN_NM"]); entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]); entity.invoice_exists_flg = 0; entity.exec_flg = false; entity.lock_flg = 0; entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetInvoiceBalanceList", ex); entityList.Clear(); EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.MESSAGE = CLASS_NM + ".GetInvoiceBalanceList : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); entityList.Add(entity); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, DataPgEvidence.PGName.Order.OrderList, DataPgEvidence.geOperationType.Select, "Where:" + strWhereSql + ",Orderby:" + strOrderBySql); return(entityList); }
public List <EntityDuties> GetDuties(string random, long no, int kbn) { List <EntityDuties> entityList = new List <EntityDuties>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { EntityDuties entity = new EntityDuties(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetDuties(認証処理)", ex); EntityDuties entity = new EntityDuties(); entity.MESSAGE = CLASS_NM + ".GetDuties : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL // 返答時 sb.Append("SELECT T.COMPANY_ID " + Environment.NewLine); sb.Append(" ,CP.NAME AS COMPANY_NAME " + Environment.NewLine); sb.Append(" ,T.NO " + Environment.NewLine); sb.Append(" ,T.GROUP_ID " + Environment.NewLine); sb.Append(" ,GP.NAME AS GROUP_NAME " + Environment.NewLine); sb.Append(" ,T.DATE " + Environment.NewLine); sb.Append(" ,T.TIME " + Environment.NewLine); sb.Append(" ,T.PERSON_ID " + Environment.NewLine); sb.Append(" ,PS.NAME AS PERSON_NAME " + Environment.NewLine); sb.Append(" ,T.DUTIES_LEVEL_ID " + Environment.NewLine); sb.Append(" ,NM1.DESCRIPTION AS DUTIES_LEVEL_NAME " + Environment.NewLine); sb.Append(" ,T.DUTIES_STATE_ID " + Environment.NewLine); sb.Append(" ,NM2.DESCRIPTION AS DUTIES_STATE_NAME " + Environment.NewLine); sb.Append(" ,T.TITLE " + Environment.NewLine); sb.Append(" ,T.CONTENT " + Environment.NewLine); sb.Append(" ,T.UPLOAD_FILE_PATH1 " + Environment.NewLine); sb.Append(" ,T.UPLOAD_FILE_PATH2 " + Environment.NewLine); sb.Append(" ,T.UPLOAD_FILE_PATH3 " + Environment.NewLine); sb.Append(" ,T.UPLOAD_FILE_PATH4 " + Environment.NewLine); sb.Append(" ,T.UPLOAD_FILE_PATH5 " + Environment.NewLine); sb.Append(" ,T.MEMO " + Environment.NewLine); sb.Append(" FROM T_DUTIES_COMMUNICATION AS T" + Environment.NewLine); #region Join // 会社 sb.Append(" LEFT JOIN SYS_M_COMPANY AS CP" + Environment.NewLine); sb.Append(" ON CP.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CP.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CP.ID = T.COMPANY_ID " + Environment.NewLine); // グループ sb.Append(" LEFT JOIN SYS_M_COMPANY_GROUP AS GP" + Environment.NewLine); sb.Append(" ON GP.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND GP.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND GP.ID = T.GROUP_ID " + Environment.NewLine); // 担当者 sb.Append(" LEFT JOIN M_PERSON AS PS" + Environment.NewLine); sb.Append(" ON PS.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND PS.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND PS.COMPANY_ID = T.COMPANY_ID " + Environment.NewLine); sb.Append(" AND PS.ID = T.PERSON_ID" + Environment.NewLine); // レベルID sb.Append(" LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine); sb.Append(" ON NM1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.LEVEL_ID + Environment.NewLine); sb.Append(" AND NM1.ID = T.DUTIES_LEVEL_ID" + Environment.NewLine); // 状態ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM2" + Environment.NewLine); sb.Append(" ON NM2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM2.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM2.ID = T.DUTIES_STATE_ID" + Environment.NewLine); #endregion sb.Append(" WHERE T.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND T.DELETE_FLG = 0 " + Environment.NewLine); if (no != 0) { sb.Append(" AND T.NO = " + no + Environment.NewLine); } // 参照確認時 if (kbn == 1) { sb.Append(" AND T.DUTIES_STATE_ID = 1 " + Environment.NewLine); // 表示区分 1:表示するのみ sb.Append(" AND (T.GROUP_ID = " + groupId + " OR T.GROUP_ID = 0)" + Environment.NewLine); } sb.Append(" ORDER BY T.DATE DESC " + Environment.NewLine); sb.Append(" ,T.TIME DESC " + Environment.NewLine); sb.Append(" ,T.NO DESC " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { EntityDuties entity = new EntityDuties(); // 排他制御 DataPgLock.geLovkFlg lockFlg = DataPgLock.geLovkFlg.UnLock; if (no != 0) // 返答時 { string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, no.ToString(), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetDuties : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } } #region Set Entity entity.company_id = ExCast.zCInt(dt.DefaultView[i]["COMPANY_ID"]); entity.company_nm = ExCast.zCStr(dt.DefaultView[i]["COMPANY_NAME"]); entity.no = ExCast.zCLng(dt.DefaultView[i]["NO"]); entity.gropu_id = ExCast.zCInt(dt.DefaultView[i]["GROUP_ID"]); entity.gropu_nm = ExCast.zCStr(dt.DefaultView[i]["GROUP_NAME"]); if (entity.gropu_id == 0) { entity.gropu_nm = "全グループ"; } entity.duties_ymd = ExCast.zDateNullToDefault(dt.DefaultView[i]["DATE"]); entity.duties_time = ExCast.zCStr(dt.DefaultView[i]["TIME"]); entity.duties_date_time = ExCast.zDateNullToDefault(dt.DefaultView[i]["DATE"]) + " " + ExCast.zCStr(dt.DefaultView[i]["TIME"]); entity.person_id = ExCast.zCInt(dt.DefaultView[i]["PERSON_ID"]); entity.person_nm = ExCast.zCStr(dt.DefaultView[i]["PERSON_NAME"]); entity.duties_level_id = ExCast.zCInt(dt.DefaultView[i]["DUTIES_LEVEL_ID"]); entity.duties_level_nm = ExCast.zCStr(dt.DefaultView[i]["DUTIES_LEVEL_NAME"]); entity.duties_state_id = ExCast.zCInt(dt.DefaultView[i]["DUTIES_STATE_ID"]); entity.duties_state_nm = ExCast.zCStr(dt.DefaultView[i]["DUTIES_STATE_NAME"]); entity.title = ExCast.zCStr(dt.DefaultView[i]["TITLE"]); entity.content = ExCast.zCStr(dt.DefaultView[i]["CONTENT"]); entity.upload_file_path1 = ExCast.zCStr(dt.DefaultView[i]["UPLOAD_FILE_PATH1"]); entity.upload_file_path2 = ExCast.zCStr(dt.DefaultView[i]["UPLOAD_FILE_PATH2"]); entity.upload_file_path3 = ExCast.zCStr(dt.DefaultView[i]["UPLOAD_FILE_PATH3"]); entity.upload_file_path4 = ExCast.zCStr(dt.DefaultView[i]["UPLOAD_FILE_PATH4"]); entity.upload_file_path5 = ExCast.zCStr(dt.DefaultView[i]["UPLOAD_FILE_PATH5"]); if (!string.IsNullOrEmpty(entity.upload_file_path1)) { entity.upload_file_name1 = System.IO.Path.GetFileName(entity.upload_file_path1); } if (!string.IsNullOrEmpty(entity.upload_file_path2)) { entity.upload_file_name2 = System.IO.Path.GetFileName(entity.upload_file_path2); } if (!string.IsNullOrEmpty(entity.upload_file_path3)) { entity.upload_file_name3 = System.IO.Path.GetFileName(entity.upload_file_path3); } if (!string.IsNullOrEmpty(entity.upload_file_path4)) { entity.upload_file_name4 = System.IO.Path.GetFileName(entity.upload_file_path4); } if (!string.IsNullOrEmpty(entity.upload_file_path5)) { entity.upload_file_name5 = System.IO.Path.GetFileName(entity.upload_file_path5); } entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]); #endregion entityList.Add(entity); } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetDuties", ex); entityList.Clear(); EntityDuties entity = new EntityDuties(); entity.MESSAGE = CLASS_NM + ".GetDuties : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "NO:" + no.ToString()); return(entityList); }
public List <EntityStockInventory> GetStockInventoryList(string random, string strWhereSql, string strOrderBySql) { List <EntityStockInventory> entityList = new List <EntityStockInventory>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; int idFigureCommodity = 0; int idFigureCustomer = 0; int idFigurePurchase = 0; int idFigureSlipNo = 0; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); idFigureCommodity = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_GOODS]); idFigureCustomer = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]); idFigurePurchase = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_PURCHASE]); idFigureSlipNo = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_SLIP_NO]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { EntityStockInventory entity = new EntityStockInventory(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetStockInventoryList(認証処理)", ex); EntityStockInventory entity = new EntityStockInventory(); entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); ExReportManeger rptMgr = new ExReportManeger(); rptMgr.idFigureCommodity = idFigureCommodity; rptMgr.idFigureCustomer = idFigureCustomer; rptMgr.idFigurePurchase = idFigurePurchase; rptMgr.idFigureSlipNo = idFigureSlipNo; sb.Append(rptMgr.GetStockInventoryListReportSQL(companyId, groupId, strWhereSql, strOrderBySql)); dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { #region Set Entity EntityStockInventory entity = new EntityStockInventory(); entity.commodity_id = ExCast.zCStr(dt.DefaultView[i]["COMMODITY_ID"]); entity.commodity_name = ExCast.zCStr(dt.DefaultView[i]["COMMODITY_NAME"]); entity.account_inventory_number = ExCast.zCDbl(dt.DefaultView[i]["INVENTORY_NUMBER"]); entity.practice_inventory_number = ExCast.zCDbl(dt.DefaultView[i]["INVENTORY_NUMBER"]); entity.diff_number = 0; entity.exec_flg = false; entity.lock_flg = 0; entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetStockInventoryList", ex); entityList.Clear(); EntityStockInventory entity = new EntityStockInventory(); entity.MESSAGE = CLASS_NM + ".GetStockInventoryList : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); entityList.Add(entity); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, DataPgEvidence.PGName.StockInventory.StockInventoryInp, DataPgEvidence.geOperationType.Select, "Where:" + strWhereSql + ",Orderby:" + strOrderBySql); return(entityList); }
public List <EntityInquiry> GetInquiry(string random, long no) { List <EntityInquiry> entityList = new List <EntityInquiry>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { EntityInquiry entity = new EntityInquiry(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetInquiry(認証処理)", ex); EntityInquiry entity = new EntityInquiry(); entity.MESSAGE = CLASS_NM + ".GetInquiry : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); if (no == 0) { // 一覧表示時 #region SQL // 返答時 sb.Append("SELECT DISTINCT " + Environment.NewLine); sb.Append(" IH.NO " + Environment.NewLine); sb.Append(" ,IH.DATE " + Environment.NewLine); sb.Append(" ,IH.TIME " + Environment.NewLine); sb.Append(" ,IH.INQUIRY_DIVISION_ID " + Environment.NewLine); sb.Append(" ,NM1.DESCRIPTION AS INQUIRY_DIVISION_NAME " + Environment.NewLine); sb.Append(" ,IH.TITLE " + Environment.NewLine); sb.Append(" ,IH.INQUIRY_STATE_ID " + Environment.NewLine); sb.Append(" ,NM3.DESCRIPTION AS INQUIRY_STATE_NAME " + Environment.NewLine); sb.Append(" ,IH.INQUIRY_LEVEL_ID " + Environment.NewLine); sb.Append(" ,NM2.DESCRIPTION AS INQUIRY_LEVEL_NAME " + Environment.NewLine); sb.Append(" FROM SYS_T_INQUIRY_H AS IH" + Environment.NewLine); #region Join // 担当者(ヘッダ) sb.Append(" LEFT JOIN M_PERSON AS PS" + Environment.NewLine); sb.Append(" ON PS.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND PS.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND PS.COMPANY_ID = IH.COMPANY_ID " + Environment.NewLine); sb.Append(" AND PS.ID = IH.PERSON_ID" + Environment.NewLine); // 問い合わせ区分ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine); sb.Append(" ON NM1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INQUIRY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM1.ID = IH.INQUIRY_DIVISION_ID" + Environment.NewLine); // 問い合わせ緊急度ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM2" + Environment.NewLine); sb.Append(" ON NM2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM2.DIVISION_ID = " + (int)CommonUtl.geNameKbn.LEVEL_ID + Environment.NewLine); sb.Append(" AND NM2.ID = IH.INQUIRY_LEVEL_ID" + Environment.NewLine); // 問い合わせ状態ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM3" + Environment.NewLine); sb.Append(" ON NM3.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM3.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM3.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INQUIRY_STATE_ID + Environment.NewLine); sb.Append(" AND NM3.ID = IH.INQUIRY_STATE_ID" + Environment.NewLine); #endregion sb.Append(" WHERE IH.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND IH.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" ORDER BY IH.DATE DESC " + Environment.NewLine); sb.Append(" ,IH.TIME DESC " + Environment.NewLine); #endregion } else { #region SQL // 返答時 sb.Append("SELECT IH.NO " + Environment.NewLine); sb.Append(" ,IH.COMPANY_ID " + Environment.NewLine); sb.Append(" ,CP.NAME AS COMPANY_NAME " + Environment.NewLine); sb.Append(" ,IH.GROUP_ID " + Environment.NewLine); sb.Append(" ,GP.NAME AS GROUP_NAME " + Environment.NewLine); sb.Append(" ,IH.PERSON_ID " + Environment.NewLine); sb.Append(" ,PS.NAME AS PERSON_NAME " + Environment.NewLine); sb.Append(" ,IH.DATE " + Environment.NewLine); sb.Append(" ,IH.TIME " + Environment.NewLine); sb.Append(" ,IH.TITLE " + Environment.NewLine); sb.Append(" ,IH.INQUIRY_DIVISION_ID " + Environment.NewLine); sb.Append(" ,NM1.DESCRIPTION AS INQUIRY_DIVISION_NAME " + Environment.NewLine); sb.Append(" ,IH.INQUIRY_LEVEL_ID " + Environment.NewLine); sb.Append(" ,NM2.DESCRIPTION AS INQUIRY_LEVEL_NAME " + Environment.NewLine); sb.Append(" ,IH.INQUIRY_STATE_ID " + Environment.NewLine); sb.Append(" ,NM3.DESCRIPTION AS INQUIRY_STATE_NAME " + Environment.NewLine); sb.Append(" ,IH.MEMO " + Environment.NewLine); sb.Append(" ,ID.REC_NO " + Environment.NewLine); sb.Append(" ,ID.DATE AS D_DATE" + Environment.NewLine); sb.Append(" ,ID.TIME AS D_TIME" + Environment.NewLine); sb.Append(" ,ID.KBN " + Environment.NewLine); sb.Append(" ,ID.PERSON_ID AS D_PERSON_ID " + Environment.NewLine); sb.Append(" ,PS2.NAME AS D_PERSON_NAME " + Environment.NewLine); sb.Append(" ,ID.SUPPORT_PERSON_NAME " + Environment.NewLine); sb.Append(" ,ID.UPLOAD_FILE_PATH1 " + Environment.NewLine); sb.Append(" ,ID.UPLOAD_FILE_PATH2 " + Environment.NewLine); sb.Append(" ,ID.UPLOAD_FILE_PATH3 " + Environment.NewLine); sb.Append(" ,ID.UPLOAD_FILE_PATH4 " + Environment.NewLine); sb.Append(" ,ID.UPLOAD_FILE_PATH5 " + Environment.NewLine); sb.Append(" ,ID.CONTENT " + Environment.NewLine); sb.Append(" FROM SYS_T_INQUIRY_H AS IH" + Environment.NewLine); #region Join sb.Append(" INNER JOIN SYS_T_INQUIRY_D AS ID" + Environment.NewLine); sb.Append(" ON ID.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND ID.NO = IH.NO" + Environment.NewLine); // 会社 sb.Append(" LEFT JOIN SYS_M_COMPANY AS CP" + Environment.NewLine); sb.Append(" ON CP.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CP.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CP.ID = IH.COMPANY_ID " + Environment.NewLine); // グループ sb.Append(" LEFT JOIN SYS_M_COMPANY_GROUP AS GP" + Environment.NewLine); sb.Append(" ON GP.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND GP.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND GP.ID = IH.GROUP_ID " + Environment.NewLine); // 担当者(ヘッダ) sb.Append(" LEFT JOIN M_PERSON AS PS" + Environment.NewLine); sb.Append(" ON PS.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND PS.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND PS.COMPANY_ID = IH.COMPANY_ID " + Environment.NewLine); sb.Append(" AND PS.ID = IH.PERSON_ID" + Environment.NewLine); // 担当者(明細) sb.Append(" LEFT JOIN M_PERSON AS PS2" + Environment.NewLine); sb.Append(" ON PS2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND PS2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND PS2.COMPANY_ID = IH.COMPANY_ID " + Environment.NewLine); sb.Append(" AND PS2.ID = ID.PERSON_ID" + Environment.NewLine); // 問い合わせ区分ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine); sb.Append(" ON NM1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INQUIRY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM1.ID = IH.INQUIRY_DIVISION_ID" + Environment.NewLine); // 問い合わせ緊急度ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM2" + Environment.NewLine); sb.Append(" ON NM2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM2.DIVISION_ID = " + (int)CommonUtl.geNameKbn.LEVEL_ID + Environment.NewLine); sb.Append(" AND NM2.ID = IH.INQUIRY_LEVEL_ID" + Environment.NewLine); // 問い合わせ緊急度ID sb.Append(" LEFT JOIN SYS_M_NAME AS NM3" + Environment.NewLine); sb.Append(" ON NM3.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM3.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM3.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INQUIRY_STATE_ID + Environment.NewLine); sb.Append(" AND NM3.ID = IH.INQUIRY_STATE_ID" + Environment.NewLine); #endregion sb.Append(" WHERE IH.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND IH.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND IH.NO = " + no + Environment.NewLine); sb.Append(" ORDER BY IH.DATE DESC " + Environment.NewLine); sb.Append(" ,IH.TIME DESC " + Environment.NewLine); sb.Append(" ,ID.REC_NO DESC " + Environment.NewLine); #endregion } dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { EntityInquiry entity = new EntityInquiry(); // 排他制御 DataPgLock.geLovkFlg lockFlg = DataPgLock.geLovkFlg.UnLock; if (no != 0) // 返答時 { string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, no.ToString(), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetInquiry : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } } #region Set Entity entity.no = ExCast.zCLng(dt.DefaultView[i]["NO"]); entity.date_time = ExCast.zDateNullToDefault(dt.DefaultView[i]["DATE"]) + " " + ExCast.zCStr(dt.DefaultView[i]["TIME"]); entity.title = ExCast.zCStr(dt.DefaultView[i]["TITLE"]); entity.inquiry_division_id = ExCast.zCInt(dt.DefaultView[i]["INQUIRY_DIVISION_ID"]); entity.inquiry_division_nm = ExCast.zCStr(dt.DefaultView[i]["INQUIRY_DIVISION_NAME"]); entity.inquiry_level_id = ExCast.zCInt(dt.DefaultView[i]["INQUIRY_LEVEL_ID"]); entity.inquiry_level_nm = ExCast.zCStr(dt.DefaultView[i]["INQUIRY_LEVEL_NAME"]); entity.inquiry_level_state_id = ExCast.zCInt(dt.DefaultView[i]["INQUIRY_STATE_ID"]); entity.inquiry_level_state_nm = ExCast.zCStr(dt.DefaultView[i]["INQUIRY_STATE_NAME"]); if (no != 0) { // 返答時 entity.company_id = ExCast.zCInt(dt.DefaultView[i]["COMPANY_ID"]); entity.company_nm = ExCast.zCStr(dt.DefaultView[i]["COMPANY_NAME"]); entity.gropu_id = ExCast.zCInt(dt.DefaultView[i]["GROUP_ID"]); entity.gropu_nm = ExCast.zCStr(dt.DefaultView[i]["GROUP_NAME"]); entity.person_id = ExCast.zCInt(dt.DefaultView[i]["PERSON_ID"]); entity.person_nm = ExCast.zCStr(dt.DefaultView[i]["PERSON_NAME"]); entity.rec_no = ExCast.zCInt(dt.DefaultView[i]["REC_NO"]); entity.d_date_time = ExCast.zDateNullToDefault(dt.DefaultView[i]["D_DATE"]) + " " + ExCast.zCStr(dt.DefaultView[i]["D_TIME"]); entity.kbn = ExCast.zCInt(dt.DefaultView[i]["KBN"]); entity.d_person_id = ExCast.zCInt(dt.DefaultView[i]["D_PERSON_ID"]); entity.d_person_nm = ExCast.zCStr(dt.DefaultView[i]["D_PERSON_NAME"]); entity.support_person_nm = ExCast.zCStr(dt.DefaultView[i]["SUPPORT_PERSON_NAME"]); entity.content = ExCast.zCStr(dt.DefaultView[i]["CONTENT"]); entity.lock_flg = (int)lockFlg; entity.memo = ExCast.zCStr(dt.DefaultView[0]["MEMO"]); } #endregion entityList.Add(entity); } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetInquiry", ex); entityList.Clear(); EntityInquiry entity = new EntityInquiry(); entity.MESSAGE = CLASS_NM + ".GetInquiry : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "NO:" + no.ToString()); return(entityList); }
public EntityUser GetUser(string random, int Id) { EntityUser entity = null; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityUser(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetUserList(認証処理)", ex); entity = new EntityUser(); entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine); sb.Append(" ,SG.NAME AS GROUP_NAME " + Environment.NewLine); sb.Append(" ,PS.NAME AS PERSON_NAME " + Environment.NewLine); sb.Append(" FROM SYS_M_USER AS MT" + Environment.NewLine); // 表示区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine); sb.Append(" ON NM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine); sb.Append(" AND MT.DISPLAY_FLG = NM.ID" + Environment.NewLine); // グループ sb.Append(" LEFT JOIN SYS_M_COMPANY_GROUP AS SG" + Environment.NewLine); sb.Append(" ON SG.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND SG.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND SG.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND SG.ID = MT.GROUP_ID" + Environment.NewLine); // 担当 sb.Append(" LEFT JOIN M_PERSON AS PS" + Environment.NewLine); sb.Append(" ON PS.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND PS.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND PS.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND PS.ID = MT.PERSON_ID" + Environment.NewLine); sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.ID = " + Id.ToString() + Environment.NewLine); sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine); sb.Append(" ,MT.ID " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { entity = new EntityUser(); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, Id.ToString(), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetUser : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } #region Set Entity entity.id = ExCast.zCInt(dt.DefaultView[0]["ID"]); entity.company_id = ExCast.zCInt(dt.DefaultView[0]["COMPANY_ID"]); entity.group_id = ExCast.zCInt(dt.DefaultView[0]["GROUP_ID"]); entity.group_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP_NAME"]); entity.login_id = ExCast.zCStr(dt.DefaultView[0]["LOGIN_ID"]); entity.after_login_id = ExCast.zCStr(dt.DefaultView[0]["LOGIN_ID"]); entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]); entity.login_password = ExCast.zCStr(dt.DefaultView[0]["PASSWORD"]); entity.person_id = ExCast.zCInt(dt.DefaultView[0]["PERSON_ID"]); entity.person_nm = ExCast.zCStr(dt.DefaultView[0]["PERSON_NAME"]); entity.memo = ExCast.zCStr(dt.DefaultView[0]["MEMO"]); entity.display_division_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]); entity.display_division_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]); entity.lock_flg = (int)lockFlg; #endregion } else { entity = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetUser", ex); entity = new EntityUser(); entity.MESSAGE = CLASS_NM + ".GetUser : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "ID:" + Id.ToString()); return(entity); }
public EntitySupplier GetSupplier(string random, string CustomerId, string Id) { EntitySupplier entity; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntitySupplier(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier(認証処理)", ex); entity = new EntitySupplier(); entity.MESSAGE = CLASS_NM + ".GetSupplier : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,CM.NAME AS CUSTOMER_NAME " + Environment.NewLine); sb.Append(" ,NM1.DESCRIPTION AS DIVIDE_PERMISSION_NAME " + Environment.NewLine); sb.Append(" ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine); sb.Append(" FROM M_SUPPLIER AS MT" + Environment.NewLine); #region Join // 得意先 sb.Append(" LEFT JOIN M_CUSTOMER AS CM" + Environment.NewLine); sb.Append(" ON CM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND CM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND CM.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine); sb.Append(" AND CM.ID = MT.CUSTOMER_ID" + Environment.NewLine); // 分納許可 sb.Append(" LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine); sb.Append(" ON NM1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DIVIDE_PERMISSION_ID + Environment.NewLine); sb.Append(" AND NM1.ID = MT.DIVIDE_PERMISSION_ID" + Environment.NewLine); // 表示区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine); sb.Append(" ON NM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM.ID = MT.DISPLAY_FLG" + Environment.NewLine); #endregion sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine); sb.Append(" AND MT.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine); sb.Append(" ,MT.ID " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { entity = new EntitySupplier(); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, ExCast.zNumZeroNothingFormat(CustomerId) + "-" + ExCast.zNumZeroNothingFormat(Id), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetSupplier : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } #region Set Entity entity.id = ExCast.zCStr(dt.DefaultView[0]["ID"]); entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]); entity.kana = ExCast.zCStr(dt.DefaultView[0]["KANA"]); entity.about_name = ExCast.zCStr(dt.DefaultView[0]["ABOUT_NAME"]); string _zip = ExCast.zCStr(dt.DefaultView[0]["ZIP_CODE"]); if (!string.IsNullOrEmpty(_zip) && ExCast.zCStr(_zip) != "0") { _zip = string.Format("{0:0000000}", ExCast.zCDbl(_zip)); entity.zip_code_from = _zip.Substring(0, 3); entity.zip_code_to = _zip.Substring(3, 4); } else { entity.zip_code_from = ""; entity.zip_code_to = ""; } entity.prefecture_id = ExCast.zCInt(dt.DefaultView[0]["PREFECTURE_ID"]); entity.city_id = ExCast.zCInt(dt.DefaultView[0]["CITY_ID"]); entity.town_id = ExCast.zCInt(dt.DefaultView[0]["TOWN_ID"]); entity.adress_city = ExCast.zCStr(dt.DefaultView[0]["ADRESS_CITY"]); entity.adress_town = ExCast.zCStr(dt.DefaultView[0]["ADRESS_TOWN"]); entity.adress1 = ExCast.zCStr(dt.DefaultView[0]["ADRESS1"]); entity.adress2 = ExCast.zCStr(dt.DefaultView[0]["ADRESS2"]); entity.station_name = ExCast.zCStr(dt.DefaultView[0]["STATION_NAME"]); entity.post_name = ExCast.zCStr(dt.DefaultView[0]["POST_NAME"]); entity.person_name = ExCast.zCStr(dt.DefaultView[0]["PERSON_NAME"]); entity.title_id = ExCast.zCInt(dt.DefaultView[0]["TITLE_ID"]); entity.title_name = ExCast.zCStr(dt.DefaultView[0]["TITLE_NAME"]); entity.tel = ExCast.zCStr(dt.DefaultView[0]["TEL"]); entity.fax = ExCast.zCStr(dt.DefaultView[0]["FAX"]); entity.mail_adress = ExCast.zCStr(dt.DefaultView[0]["MAIL_ADRESS"]); entity.mobile_tel = ExCast.zCStr(dt.DefaultView[0]["MOBILE_TEL"]); entity.mobile_adress = ExCast.zCStr(dt.DefaultView[0]["MOBILE_ADRESS"]); entity.url = ExCast.zCStr(dt.DefaultView[0]["URL"]); entity.customer_id = ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_ID"]); entity.customer_nm = ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_NAME"]); entity.divide_permission_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]); entity.divide_permission_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]); entity.display_division_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]); entity.display_division_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]); entity.lock_flg = (int)lockFlg; entity.memo = ExCast.zCStr(dt.DefaultView[0]["MEMO"]); #endregion } else { entity = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier", ex); entity = new EntitySupplier(); entity.MESSAGE = CLASS_NM + ".GetSupplier : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "ID:" + Id.ToString()); return(entity); }
public EntityReport ReportOut(string random, string rptKbn, string pgId, string parameters) { EntityReport entity; EntityReportSetting entitySetting; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; int reportSizeUser = 0; int idFigureCommodity = 0; int idFigureCustomer = 0; int idFigurePurchase = 0; int idFigureSlipNo = 0; int rpTotalAuthorityKbn = 0; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); reportSizeUser = ExCast.zCInt(HttpContext.Current.Session[ExSession.REPORT_SAVE_SIZE_USER]); idFigureCommodity = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_GOODS]); idFigureCustomer = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]); idFigurePurchase = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_PURCHASE]); idFigureSlipNo = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_SLIP_NO]); rpTotalAuthorityKbn = ExCast.zCInt(HttpContext.Current.Session[ExSession.REPORT_TOTAL_AUTHORITY_KBN]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityReport(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".ReportOut(認証処理)", ex); entity = new EntityReport(); entity.MESSAGE = CLASS_NM + ".ReportOut : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString(); return(entity); } #endregion ExMySQLData db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString); try { #region Get Report Setting entitySetting = GetReportSetting(random, pgId); if (entitySetting == null) { entitySetting = new EntityReportSetting(); entitySetting.user_id = ExCast.zCInt(userId); entitySetting.pg_id = pgId; entitySetting.group_id_from = ExCast.zCInt(groupId).ToString(); entitySetting.group_id_to = ExCast.zCInt(groupId).ToString(); } else if (entitySetting != null) { if (!string.IsNullOrEmpty(entitySetting.MESSAGE)) { entitySetting = new EntityReportSetting(); entitySetting.user_id = ExCast.zCInt(userId); entitySetting.pg_id = pgId; entitySetting.group_id_from = ExCast.zCInt(groupId).ToString(); entitySetting.group_id_to = ExCast.zCInt(groupId).ToString(); } else { if (ExCast.zCInt(entitySetting.group_id_from) == 0 && ExCast.zCInt(entitySetting.group_id_to) == 0) { entitySetting.group_id_from = ExCast.zCInt(groupId).ToString(); entitySetting.group_id_to = ExCast.zCInt(groupId).ToString(); } } } if (rpTotalAuthorityKbn < 2) { entitySetting.group_id_from = ExCast.zCInt(groupId).ToString(); entitySetting.group_id_to = ExCast.zCInt(groupId).ToString(); } #endregion entity = new EntityReport(); DataReport.geReportKbn kbn = (DataReport.geReportKbn)ExCast.zCInt(rptKbn); ExReportManeger rptMgr = new ExReportManeger(); rptMgr.idFigureCommodity = idFigureCommodity; rptMgr.idFigureCustomer = idFigureCustomer; rptMgr.idFigurePurchase = idFigurePurchase; rptMgr.idFigureSlipNo = idFigureSlipNo; rptMgr.entitySetting = entitySetting; rptMgr.rptKbn = kbn; #region Report FilePath Setting bool _ret = rptMgr.GetReportFilePath(pgId, companyId, userId); if (_ret == false) { entity.MESSAGE = CommonUtl.gstrErrMsg; return(entity); } entity.downLoadFilePath = rptMgr.reportFilePath; entity.downLoadFileName = rptMgr.reportFileName; entity.downLoadFileSize = rptMgr.reportFileSize.ToString(); entity.downLoadUrl = CommonUtl.gstrMainUrl + rptMgr.reportDir; #endregion DataSet ds = db.GetDataSet(rptMgr.ReportSQL(pgId, companyId, groupId, parameters), rptMgr.GetPGIDXsd(pgId)); #region Export xsd System.IO.StreamWriter xmlSW = null; try { xmlSW = new System.IO.StreamWriter(CommonUtl.gstrReportTemp + rptMgr.GetPGIDXsd(pgId) + ".xsd"); ds.WriteXmlSchema(xmlSW); xmlSW.Close(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".WriteXmlSchema", ex); } finally { if (xmlSW != null) { xmlSW.Dispose(); xmlSW = null; } } #endregion if (ds.Tables[0].Rows.Count == 0) { entity.MESSAGE = "データが存在しません。"; entity.ret = false; return(entity); } string _fileType = ""; string _DownloadType = ""; switch (kbn) { case DataReport.geReportKbn.OutPut: _fileType = "PDF"; _DownloadType = "出力"; if (rptMgr.ReportToPdf(ds, pgId) == true) { entity.ret = true; } else { entity.MESSAGE = CommonUtl.gstrErrMsg; entity.ret = false; } break; case DataReport.geReportKbn.Download: _fileType = "PDF"; _DownloadType = "ダウンロード"; if (rptMgr.ReportToPdf(ds, pgId) == true) { entity.ret = true; } else { entity.MESSAGE = CommonUtl.gstrErrMsg; entity.ret = false; } break; case DataReport.geReportKbn.Csv: _fileType = "CSV"; _DownloadType = "ダウンロード"; if (rptMgr.DataTableToCsv(ds.Tables[0]) == true) { entity.ret = true; } else { entity.MESSAGE = CommonUtl.gstrErrMsg; entity.ret = false; } break; default: break; } //entity.downLoadFilePath = @"d:\HostingSpaces\Users\EW20121725\Sales.system-innovation.net\wwwroot\temp\顧客マスタ一覧.csv"; //System.IO.FileInfo fi = new System.IO.FileInfo(entity.downLoadFilePath); //entity.downLoadFileSize = fi.Length.ToString(); if (reportSizeUser < ExCast.zCDbl(entity.downLoadFileSize) / 1000000) { entity.MESSAGE = _fileType + "ファイルのサイズが" + reportSizeUser.ToString() + "Mバイトを超える為、" + _DownloadType + "できません。"; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".ReportOut", ex); entity = new EntityReport(); entity.MESSAGE = CLASS_NM + ".ReportOut : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); return(entity); } return(entity); }
public EntityReportSetting GetReportSetting(string random, string Id) { EntityReportSetting entity; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityReportSetting(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetReportSetting(認証処理)", ex); entity = new EntityReportSetting(); entity.MESSAGE = CLASS_NM + ".GetReportSetting : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,SG1.NAME AS GROUP_NAME_FROM " + Environment.NewLine); sb.Append(" ,SG2.NAME AS GROUP_NAME_TO " + Environment.NewLine); sb.Append(" FROM M_REPORT_SETTING AS MT" + Environment.NewLine); #region Join // ユーザ sb.Append(" LEFT JOIN SYS_M_USER AS UR" + Environment.NewLine); sb.Append(" ON UR.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND UR.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND UR.ID = MT.USER_ID" + Environment.NewLine); // グループFrom sb.Append(" LEFT JOIN SYS_M_COMPANY_GROUP AS SG1" + Environment.NewLine); sb.Append(" ON SG1.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND SG1.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND SG1.COMPANY_ID = UR.COMPANY_ID" + Environment.NewLine); sb.Append(" AND SG1.ID = MT.GROUP_ID_FROM" + Environment.NewLine); // グループTo sb.Append(" LEFT JOIN SYS_M_COMPANY_GROUP AS SG2" + Environment.NewLine); sb.Append(" ON SG2.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND SG2.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND SG2.COMPANY_ID = UR.COMPANY_ID" + Environment.NewLine); sb.Append(" AND SG2.ID = MT.GROUP_ID_TO" + Environment.NewLine); #endregion sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.USER_ID = " + userId + Environment.NewLine); sb.Append(" AND MT.PG_ID = " + ExEscape.zRepStr(Id) + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { entity = new EntityReportSetting(); // 排他制御 //DataPgLock.geLovkFlg lockFlg; //string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, Id.ToString(), ipAdress, db, out lockFlg); //if (strErr != "") //{ // entity.MESSAGE = CLASS_NM + ".GetReportSetting : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; //} #region Set Entity entity.user_id = ExCast.zCInt(dt.DefaultView[0]["USER_ID"]); entity.pg_id = Id; entity.size = ExCast.zCInt(dt.DefaultView[0]["SIZE"]); entity.orientation = ExCast.zCInt(dt.DefaultView[0]["ORIENTATION"]); entity.left_margin = ExCast.zCDbl(dt.DefaultView[0]["LEFT_MARGIN"]); entity.right_margin = ExCast.zCDbl(dt.DefaultView[0]["RIGHT_MARGIN"]); entity.top_margin = ExCast.zCDbl(dt.DefaultView[0]["TOP_MARGIN"]); entity.bottom_margin = ExCast.zCDbl(dt.DefaultView[0]["BOTTOM_MARGIN"]); if (ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_FROM"]) != 0) { entity.group_id_from = string.Format("{0:000}", ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_FROM"])); } entity.group_nm_from = ExCast.zCStr(dt.DefaultView[0]["GROUP_NAME_FROM"]); if (ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_TO"]) != 0) { entity.group_id_to = string.Format("{0:000}", ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_TO"])); } entity.group_nm_to = ExCast.zCStr(dt.DefaultView[0]["GROUP_NAME_TO"]); entity.group_total = ExCast.zCInt(dt.DefaultView[0]["GROUP_TOTAL"]); entity.total_kbn = ExCast.zCInt(dt.DefaultView[0]["TOTAL_KBN"]); #endregion } else { entity = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetReportSetting", ex); entity = new EntityReportSetting(); entity.MESSAGE = CLASS_NM + ".GetReportSetting : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "ID:" + Id.ToString()); return(entity); }
public List <EntitySalesCreditBalance> GetSalesCreditBalanaceList(string random, string strWhereSql, string strOrderBySql) { List <EntitySalesCreditBalance> entityList = new List <EntitySalesCreditBalance>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; int idFigureCommodity = 0; int idFigureCustomer = 0; int idFigurePurchase = 0; int idFigureSlipNo = 0; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); idFigureCommodity = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_GOODS]); idFigureCustomer = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]); idFigurePurchase = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_PURCHASE]); idFigureSlipNo = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_SLIP_NO]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { EntitySalesCreditBalance entity = new EntitySalesCreditBalance(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetSalesCreditBalanaceList(認証処理)", ex); EntitySalesCreditBalance entity = new EntitySalesCreditBalance(); entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; long rec_no = 0; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); ExReportManeger rptMgr = new ExReportManeger(); rptMgr.idFigureCommodity = idFigureCommodity; rptMgr.idFigureCustomer = idFigureCustomer; rptMgr.idFigurePurchase = idFigurePurchase; rptMgr.idFigureSlipNo = idFigureSlipNo; sb.Append(rptMgr.GetSalesCreditBalanaceListReportSQL(companyId, groupId, strWhereSql, strOrderBySql)); dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { #region Set Entity rec_no += 1; EntitySalesCreditBalance entity = new EntitySalesCreditBalance(); entity.rec_no = rec_no; entity.ym = ExCast.zCStr(dt.DefaultView[i]["YM"]); entity.invoice_id = ExCast.zCStr(dt.DefaultView[i]["INVOICE_ID"]); entity.invoice_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_NAME"]); entity.before_sales_credit_balacne = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_SALES_CREDIT_BALANCE"]); entity.before_sales_credit_balacne_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_SALES_CREDIT_BALANCE"]); entity.this_receipt_price = ExCast.zCDbl(dt.DefaultView[i]["THIS_RECEIPT_PRICE"]); entity.this_receipt_percent = ExCast.zCDbl(dt.DefaultView[i]["THIS_RECEIPT_PERCENT"]); entity.this_sales_credit_price = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_PRICE"]); entity.this_tax = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_TAX"]); entity.this_sales_credit_balance = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_CREDIT_BALANCE"]); entity.exec_flg = false; entity.lock_flg = 0; entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetSalesCreditBalanaceList", ex); entityList.Clear(); EntitySalesCreditBalance entity = new EntitySalesCreditBalance(); entity.MESSAGE = CLASS_NM + ".GetSalesCreditBalanaceList : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); entityList.Add(entity); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, DataPgEvidence.PGName.Order.OrderList, DataPgEvidence.geOperationType.Select, "Where:" + strWhereSql + ",Orderby:" + strOrderBySql); return(entityList); }
public string UpdateClass(string random, List <EntityClass> entity, int classKbn) { #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; string personId = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); personId = ExCast.zCStr(HttpContext.Current.Session[ExSession.PERSON_ID]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { return(_message); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(認証処理)", ex); return(CLASS_NM + ".UpdateClass : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString()); } #endregion #region Field StringBuilder sb = new StringBuilder(); DataTable dt; ExMySQLData db = null; string _Id = ""; int _classKbn = 0; #endregion #region データ存在チェック sb = new StringBuilder(); #region SQL _classKbn = ((classKbn - 1)) * 3 + 1; sb.Length = 0; sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" FROM M_CLASS AS MT" + Environment.NewLine); sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.CLASS_DIVISION_ID = " + _classKbn.ToString() + Environment.NewLine); sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine); sb.Append(" ,MT.ID " + Environment.NewLine); #endregion db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); dt = db.GetDataTable(sb.ToString()); string ret_msg = ""; if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { long lngClassId = ExCast.zCLng(dt.DefaultView[i]["ID"]); bool exists_flg = false; for (int i_ = 0; i_ <= entity.Count - 1; i_++) { if (ExCast.zCLng(entity[i_].id) == lngClassId) { exists_flg = true; } } string strClassId = string.Format("{0:000}", ExCast.zCDbl(lngClassId)); if (exists_flg == false) { bool _ret = false; switch (classKbn) { case 1: // 得意先分類 _ret = DataExists.IsExistData(db, companyId, "", "M_CUSTOMER", "GROUP1_ID", strClassId, CommonUtl.geStrOrNumKbn.String); if (_ret == true) { ret_msg += "得意先分類ID : " + strClassId + " は得意先マスタで使用されている為、削除できません。" + Environment.NewLine; } break; case 2: // 商品分類 _ret = DataExists.IsExistData(db, companyId, "", "M_COMMODITY", "GROUP1_ID", strClassId, CommonUtl.geStrOrNumKbn.String); if (_ret == true) { ret_msg += "商品分類ID : " + strClassId + " は商品マスタで使用されている為、削除できません。" + Environment.NewLine; } break; case 3: // 仕入先分類 _ret = DataExists.IsExistData(db, companyId, "", "M_PURCHASE", "GROUP1_ID", strClassId, CommonUtl.geStrOrNumKbn.String); if (_ret == true) { ret_msg += "仕入先分類ID : " + strClassId + " は仕入先マスタで使用されている為、削除できません。" + Environment.NewLine; } break; } } } if (!string.IsNullOrEmpty(ret_msg)) { return(ret_msg); } } #endregion #region Databese Open try { db = new ExMySQLData(ExCast.zCStr(HttpContext.Current.Session[ExSession.DB_CONNECTION_STR])); db.DbOpen(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(DbOpen)", ex); return(CLASS_NM + ".UpdateClass(DbOpen) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region BeginTransaction try { db.ExBeginTransaction(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(BeginTransaction)", ex); return(CLASS_NM + ".UpdateClass(BeginTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Delete try { #region Delete SQL _classKbn = ((classKbn - 1)) * 3 + 1; sb.Length = 0; sb.Append("DELETE FROM M_CLASS " + Environment.NewLine); sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND CLASS_DIVISION_ID = " + _classKbn.ToString() + Environment.NewLine); #endregion db.ExecuteSQL(sb.ToString(), false); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(Delete)", ex); return(CLASS_NM + ".UpdateClass(Delete) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Insert try { for (int i = 0; i <= entity.Count - 1; i++) { // 空行は無視する if (!string.IsNullOrEmpty(entity[i].id)) { #region Insert SQL sb.Length = 0; sb.Append("INSERT INTO M_CLASS " + Environment.NewLine); sb.Append(" ( COMPANY_ID" + Environment.NewLine); sb.Append(" , CLASS_DIVISION_ID" + Environment.NewLine); sb.Append(" , ID" + Environment.NewLine); sb.Append(" , NAME" + Environment.NewLine); sb.Append(" , MEMO" + Environment.NewLine); sb.Append(" , DISPLAY_FLG" + Environment.NewLine); sb.Append(" , UPDATE_FLG" + Environment.NewLine); sb.Append(" , DELETE_FLG" + Environment.NewLine); sb.Append(" , CREATE_PG_ID" + Environment.NewLine); sb.Append(" , CREATE_ADRESS" + Environment.NewLine); sb.Append(" , CREATE_USER_ID" + Environment.NewLine); sb.Append(" , CREATE_PERSON_ID" + Environment.NewLine); sb.Append(" , CREATE_DATE" + Environment.NewLine); sb.Append(" , CREATE_TIME" + Environment.NewLine); sb.Append(" , UPDATE_PG_ID" + Environment.NewLine); sb.Append(" , UPDATE_ADRESS" + Environment.NewLine); sb.Append(" , UPDATE_USER_ID" + Environment.NewLine); sb.Append(" , UPDATE_PERSON_ID" + Environment.NewLine); sb.Append(" , UPDATE_DATE" + Environment.NewLine); sb.Append(" , UPDATE_TIME" + Environment.NewLine); sb.Append(")" + Environment.NewLine); sb.Append("SELECT " + companyId + Environment.NewLine); // COMPANY_ID sb.Append(" ," + _classKbn.ToString() + Environment.NewLine); // Class_DIVISION_ID sb.Append(" ," + ExEscape.zRepStr(ExCast.zNumZeroFormat("{0:000}", entity[i].id)) + Environment.NewLine); // ID sb.Append(" ," + ExEscape.zRepStr(entity[i].name) + Environment.NewLine); // NAME sb.Append(" ," + ExEscape.zRepStr(entity[i].memo) + Environment.NewLine); // MEMO sb.Append(" ," + entity[i].display_division_id + Environment.NewLine); // DISPLAY_FLG sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins, PG_NM, "M_Class", ExCast.zCInt(personId), _Id, ipAdress, userId)); #endregion db.ExecuteSQL(sb.ToString(), false); } } } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(Insert)", ex); return(CLASS_NM + ".UpdateClass(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region PG排他制御 try { DataPgLock.DelLockPg(companyId, userId, PG_NM, "", ipAdress, false, db); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(DelLockPg)", ex); return(CLASS_NM + ".UpdateClass(DelLockPg) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region CommitTransaction try { db.ExCommitTransaction(); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(CommitTransaction)", ex); return(CLASS_NM + ".UpdateClass(CommitTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion #region Database Close try { db.DbClose(); } catch (Exception ex) { db.ExRollbackTransaction(); CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(DbClose)", ex); return(CLASS_NM + ".UpdateClass(DbClose) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } finally { db = null; } #endregion #region Add Evidence try { svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.DeleteAndInsert, ""); } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(Add Evidence)", ex); return(CLASS_NM + ".UpdateClass(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message); } #endregion return(""); }
public List <EntityClass> GetClass(string random, int classKbn) { EntityClass entity; List <EntityClass> entityList = new List <EntityClass>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityClass(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetClass(認証処理)", ex); entity = new EntityClass(); entity.MESSAGE = CLASS_NM + ".GetClass : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL int _classKbn = ((classKbn - 1)) * 3 + 1; sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine); sb.Append(" FROM M_CLASS AS MT" + Environment.NewLine); #region Join // 表示区分 sb.Append(" LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine); sb.Append(" ON NM.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND NM.DISPLAY_FLG = 1 " + Environment.NewLine); sb.Append(" AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine); sb.Append(" AND NM.ID = MT.DISPLAY_FLG" + Environment.NewLine); #endregion sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" AND MT.DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND MT.CLASS_DIVISION_ID = " + _classKbn.ToString() + Environment.NewLine); sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine); sb.Append(" ,MT.ID " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, _classKbn.ToString(), ipAdress, db, out lockFlg); if (strErr != "") { entity = new EntityClass(); entity.MESSAGE = CLASS_NM + ".GetCommodity : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; entityList.Add(entity); return(entityList); } if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { #region Set Entity entity = new EntityClass(); entity.id = ExCast.zCStr(dt.DefaultView[i]["ID"]); entity.class_divition_id = ExCast.zCInt(dt.DefaultView[i]["CLASS_DIVISION_ID"]); entity.name = ExCast.zCStr(dt.DefaultView[i]["NAME"]); entity.display_division_id = ExCast.zCInt(dt.DefaultView[i]["DISPLAY_FLG"]); entity.display_division_nm = ExCast.zCStr(dt.DefaultView[i]["DISPLAY_DIVISION_NAME"]); entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]); entity.lock_flg = (int)lockFlg; entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetClass", ex); entityList.Clear(); entity = new EntityClass(); entity.MESSAGE = CLASS_NM + ".GetClass : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); entityList.Add(entity); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, ""); return(entityList); }
public EntityCompany GetCompany(string random) { EntityCompany entity; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityCompany(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetCompany(認証処理)", ex); entity = new EntityCompany(); entity.MESSAGE = CLASS_NM + ".GetCompany : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); #region SQL sb.Append("SELECT MT.* " + Environment.NewLine); sb.Append(" ,SS.ID_FIGURE_SLIP_NO " + Environment.NewLine); sb.Append(" ,SS.ID_FIGURE_CUSTOMER " + Environment.NewLine); sb.Append(" ,SS.ID_FIGURE_PURCHASE " + Environment.NewLine); sb.Append(" ,SS.ID_FIGURE_GOODS " + Environment.NewLine); sb.Append(" ,SS.GROUP_DISPLAY_NAME " + Environment.NewLine); sb.Append(" ,ES_YMD.YMD AS ES_YMD " + Environment.NewLine); sb.Append(" ,JC_YMD.YMD AS JC_YMD " + Environment.NewLine); sb.Append(" ,SA_YMD.YMD AS SA_YMD " + Environment.NewLine); sb.Append(" ,RP_YMD.YMD AS RP_YMD " + Environment.NewLine); sb.Append(" ,ES_CNT.CNT AS ES_CNT " + Environment.NewLine); sb.Append(" ,JC_CNT.CNT AS JC_CNT " + Environment.NewLine); sb.Append(" ,SA_CNT.CNT AS SA_CNT " + Environment.NewLine); sb.Append(" ,RP_CNT.CNT AS RP_CNT " + Environment.NewLine); sb.Append(" FROM SYS_M_COMPANY AS MT" + Environment.NewLine); #region Join // システム設定 sb.Append(" LEFT JOIN SYS_M_SETTING AS SS" + Environment.NewLine); sb.Append(" ON SS.COMPANY_ID = MT.ID" + Environment.NewLine); // 見積最終伝票入力日 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , MAX(date_format(ESTIMATE_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine); sb.Append(" FROM T_ESTIMATE_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS ES_YMD" + Environment.NewLine); sb.Append(" ON ES_YMD.COMPANY_ID = MT.ID" + Environment.NewLine); // 受注最終伝票入力日 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , MAX(date_format(ORDER_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine); sb.Append(" FROM T_ORDER_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS JC_YMD" + Environment.NewLine); sb.Append(" ON JC_YMD.COMPANY_ID = MT.ID" + Environment.NewLine); // 売上最終伝票入力日 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , MAX(date_format(SALES_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine); sb.Append(" FROM T_SALES_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS SA_YMD" + Environment.NewLine); sb.Append(" ON SA_YMD.COMPANY_ID = MT.ID" + Environment.NewLine); // 入金最終伝票入力日 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , MAX(date_format(RECEIPT_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine); sb.Append(" FROM T_RECEIPT_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS RP_YMD" + Environment.NewLine); sb.Append(" ON RP_YMD.COMPANY_ID = MT.ID" + Environment.NewLine); // 見積現在伝票件数 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine); sb.Append(" FROM T_ESTIMATE_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS ES_CNT" + Environment.NewLine); sb.Append(" ON ES_CNT.COMPANY_ID = MT.ID" + Environment.NewLine); // 受注現在伝票件数 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine); sb.Append(" FROM T_ORDER_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS JC_CNT" + Environment.NewLine); sb.Append(" ON JC_CNT.COMPANY_ID = MT.ID" + Environment.NewLine); // 売上現在伝票件数 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine); sb.Append(" FROM T_SALES_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS SA_CNT" + Environment.NewLine); sb.Append(" ON SA_CNT.COMPANY_ID = MT.ID" + Environment.NewLine); // 入金現在伝票件数 sb.Append(" LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine); sb.Append(" , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine); sb.Append(" FROM T_RECEIPT_H " + Environment.NewLine); sb.Append(" WHERE DELETE_FLG = 0 " + Environment.NewLine); sb.Append(" AND COMPANY_ID = " + companyId + Environment.NewLine); sb.Append(" GROUP BY COMPANY_ID) AS RP_CNT" + Environment.NewLine); sb.Append(" ON RP_CNT.COMPANY_ID = MT.ID" + Environment.NewLine); #endregion sb.Append(" WHERE MT.ID = " + companyId + Environment.NewLine); sb.Append(" AND MT.DELETE_FLG = 0 " + Environment.NewLine); #endregion dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { entity = new EntityCompany(); // 排他制御 DataPgLock.geLovkFlg lockFlg; string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, companyId.ToString(), ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".GetCompany : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; } #region Set Entity entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]); entity.kana = ExCast.zCStr(dt.DefaultView[0]["KANA"]); string _zip = ExCast.zCStr(dt.DefaultView[0]["ZIP_CODE"]); if (!string.IsNullOrEmpty(_zip) && ExCast.zCStr(_zip) != "0") { _zip = string.Format("{0:0000000}", ExCast.zCDbl(_zip)); entity.zip_code_from = _zip.Substring(0, 3); entity.zip_code_to = _zip.Substring(3, 4); } else { entity.zip_code_from = ""; entity.zip_code_to = ""; } entity.prefecture_id = ExCast.zCInt(dt.DefaultView[0]["PREFECTURE_ID"]); entity.city_id = ExCast.zCInt(dt.DefaultView[0]["CITY_ID"]); entity.town_id = ExCast.zCInt(dt.DefaultView[0]["TOWN_ID"]); entity.adress_city = ExCast.zCStr(dt.DefaultView[0]["ADRESS_CITY"]); entity.adress_town = ExCast.zCStr(dt.DefaultView[0]["ADRESS_TOWN"]); entity.adress1 = ExCast.zCStr(dt.DefaultView[0]["ADRESS1"]); entity.adress2 = ExCast.zCStr(dt.DefaultView[0]["ADRESS2"]); entity.tel = ExCast.zCStr(dt.DefaultView[0]["TEL"]); entity.fax = ExCast.zCStr(dt.DefaultView[0]["FAX"]); entity.mail_adress = ExCast.zCStr(dt.DefaultView[0]["MAIL_ADRESS"]); entity.mobile_tel = ExCast.zCStr(dt.DefaultView[0]["MOBILE_TEL"]); entity.mobile_adress = ExCast.zCStr(dt.DefaultView[0]["MOBILE_ADRESS"]); entity.url = ExCast.zCStr(dt.DefaultView[0]["URL"]); entity.group_display_name = ExCast.zCStr(dt.DefaultView[0]["GROUP_DISPLAY_NAME"]); entity.id_figure_slip_no = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_SLIP_NO"]); entity.id_figure_customer = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_CUSTOMER"]); entity.id_figure_purchase = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_PURCHASE"]); entity.id_figure_commodity = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_GOODS"]); entity.estimate_ymd = ExCast.zDateNullToDefault(dt.DefaultView[0]["ES_YMD"]); entity.order_ymd = ExCast.zDateNullToDefault(dt.DefaultView[0]["JC_YMD"]); entity.sales_ymd = ExCast.zDateNullToDefault(dt.DefaultView[0]["SA_YMD"]); entity.receipt_ymd = ExCast.zDateNullToDefault(dt.DefaultView[0]["RP_YMD"]); entity.purchase_order_ymd = ""; entity.purchase_ymd = ""; entity.cash_payment_ymd = ""; entity.produce_ymd = ""; entity.ship_ymd = ""; entity.estimate_cnt = ExCast.zCLng(dt.DefaultView[0]["ES_CNT"]); entity.order_cnt = ExCast.zCLng(dt.DefaultView[0]["JC_CNT"]); entity.sales_cnt = ExCast.zCLng(dt.DefaultView[0]["SA_CNT"]); entity.receipt_cnt = ExCast.zCLng(dt.DefaultView[0]["RP_CNT"]); entity.purchase_order_cnt = 0; entity.purchase_cnt = 0; entity.cash_payment_cnt = 0; entity.produce_cnt = 0; entity.ship_cnt = 0; entity.lock_flg = (int)lockFlg; entity.memo = ExCast.zCStr(dt.DefaultView[0]["MEMO"]); #endregion } else { entity = null; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetCompany", ex); entity = new EntityCompany(); entity.MESSAGE = CLASS_NM + ".GetCompany : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, PG_NM, DataPgEvidence.geOperationType.Select, "ID:" + companyId.ToString()); return(entity); }
public static void gAddEvidence(int saveFlg, string companyId, string userId, string ipAdress, string sessionString, string pgId, DataPgEvidence.geOperationType type, string memo) { if (saveFlg != 1) { return; } StringBuilder sb = new StringBuilder(); DataTable dt; ExMySQLData db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString); // 日時取得 string date = ""; string time = ""; int millisecond = 0; DateTime now = DateTime.Now; date = now.ToString("yyyy/MM/dd"); time = now.ToString("HH:mm:ss"); millisecond = now.Millisecond; // PG実行履歴登録 try { sb.Length = 0; sb.Append("INSERT INTO H_PG_EXEC_HISTORY " + Environment.NewLine); sb.Append(" (COMPANY_ID" + Environment.NewLine); sb.Append(" ,USER_ID" + Environment.NewLine); sb.Append(" ,PG_ID" + Environment.NewLine); sb.Append(" ,OPERATION_DATE" + Environment.NewLine); sb.Append(" ,OPERATION_TIME" + Environment.NewLine); sb.Append(" ,OPERATION_MILLISECOND" + Environment.NewLine); sb.Append(" ,OPERATION_TYPE" + Environment.NewLine); sb.Append(" ,PG_NAME" + Environment.NewLine); sb.Append(" ,OPERATION_TYPE_NAME" + Environment.NewLine); sb.Append(" ,MEMO" + Environment.NewLine); sb.Append(" ,UPDATE_FLG" + Environment.NewLine); sb.Append(" ,DELETE_FLG" + Environment.NewLine); sb.Append(" ,CREATE_PG_ID" + Environment.NewLine); sb.Append(" ,CREATE_ADRESS" + Environment.NewLine); sb.Append(" ,CREATE_USER_ID" + Environment.NewLine); sb.Append(" ,CREATE_DATE" + Environment.NewLine); sb.Append(" ,CREATE_TIME" + Environment.NewLine); sb.Append(" ,UPDATE_PG_ID" + Environment.NewLine); sb.Append(" ,UPDATE_ADRESS" + Environment.NewLine); sb.Append(" ,UPDATE_USER_ID" + Environment.NewLine); sb.Append(" ,UPDATE_DATE" + Environment.NewLine); sb.Append(" ,UPDATE_TIME" + Environment.NewLine); sb.Append(")" + Environment.NewLine); sb.Append("VALUES (" + companyId + Environment.NewLine); // COMPANY_ID sb.Append(" ," + userId + Environment.NewLine); // USER_ID sb.Append(" ," + ExEscape.zRepStr(pgId) + Environment.NewLine); // PG_ID sb.Append(" ," + ExEscape.zRepStr(date) + Environment.NewLine); // OPERATION_DATE sb.Append(" ," + ExEscape.zRepStr(time) + Environment.NewLine); // OPERATION_TIME sb.Append(" ," + millisecond.ToString() + Environment.NewLine); // OPERATION_MILLISECOND sb.Append(" ," + (int)type + Environment.NewLine); // OPERATION_TYPE sb.Append(" ," + ExEscape.zRepStr(DataPgEvidence.GetPgName(pgId)) + Environment.NewLine); // PG_NAME sb.Append(" ," + ExEscape.zRepStr(DataPgEvidence.GetOperationTypeName(type)) + Environment.NewLine); // OPERATION_TYPE_NAME sb.Append(" ," + ExEscape.zRepStr(memo) + Environment.NewLine); // MEMO sb.Append(" ,0" + Environment.NewLine); // UPDATE_FLG sb.Append(" ,0" + Environment.NewLine); // DELETE_FLG sb.Append(" ,'SYSTEM'" + Environment.NewLine); // CREATE_PG_ID sb.Append(" ," + ExEscape.zRepStr(ipAdress) + Environment.NewLine); // CREATE_ADRESS sb.Append(" ," + ExEscape.zRepStr(userId) + Environment.NewLine); // CREATE_USER_ID sb.Append(" ," + ExEscape.zRepStr(date) + Environment.NewLine); // CREATE_DATE sb.Append(" ," + ExEscape.zRepStr(time) + Environment.NewLine); // CREATE_TIME sb.Append(" ,'SYSTEM'" + Environment.NewLine); // UPDATE_PG_ID sb.Append(" ," + ExEscape.zRepStr(ipAdress) + Environment.NewLine); // UPDATE_ADRESS sb.Append(" ," + ExEscape.zRepStr(userId) + Environment.NewLine); // UPDATE_USER_ID sb.Append(" ," + ExEscape.zRepStr(date) + Environment.NewLine); // UPDATE_DATE sb.Append(" ," + ExEscape.zRepStr(time) + Environment.NewLine); // UPDATE_TIME sb.Append(")"); if (db.ExecuteSQL(sb.ToString(), true) == false) { CommonUtl.ExLogger.Error(CLASS_NM + ".gAddEvidence(ExecuteSQL) : " + Environment.NewLine + ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString).errMessage); return; } switch (type) { case DataPgEvidence.geOperationType.Start: case DataPgEvidence.geOperationType.End: if (pgId == DataPgEvidence.PGName.System) { DataPgLock.DelLockPg(companyId, userId, "", "", ipAdress, true, db); } else { DataPgLock.DelLockPg(companyId, userId, pgId, "", ipAdress, true, db); } break; default: break; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".gAddEvidence(Insert)", ex); db.ExRollbackTransaction(); } }
public EntityCopying CopyCheck(string random, string tblName, string Id) { EntityCopying entity; #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { entity = new EntityCopying(); entity.MESSAGE = _message; return(entity); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".CopyCheck(認証処理)", ex); entity = new EntityCopying(); entity.MESSAGE = CLASS_NM + ".CopyCheck : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; return(entity); } #endregion #region Field ExMySQLData db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString); DataPgLock.geLovkFlg lockFlg; entity = new EntityCopying(); entity.is_exists_data = false; entity.is_lock_success = false; entity.ret = false; string get_col1Value = ""; string get_col2Value = ""; string get_col3Value = ""; string get_col4Value = ""; string get_col5Value = ""; string lock_check_pg_id = ""; string lock_check_id = ""; #endregion try { // 複写時存在チェック switch (tblName) { #region マスタ系 case "SYS_M_COMPANY_GROUP": lock_check_id = Id; lock_check_pg_id = DataPgEvidence.PGName.Mst.CompanyGroup; entity.is_exists_data = DataExists.IsExistData(db, companyId, "", tblName, "ID", Id, CommonUtl.geStrOrNumKbn.String); break; case "M_CUSTOMER": lock_check_id = Id; lock_check_pg_id = DataPgEvidence.PGName.Mst.Customer; entity.is_exists_data = DataExists.IsExistData(db, companyId, "", tblName, "ID", Id, CommonUtl.geStrOrNumKbn.String); break; case "M_PERSON": lock_check_id = Id; lock_check_pg_id = DataPgEvidence.PGName.Mst.Person; entity.is_exists_data = DataExists.IsExistData(db, companyId, "", tblName, "ID", Id, CommonUtl.geStrOrNumKbn.Number); break; case "M_COMMODITY": lock_check_id = Id; lock_check_pg_id = DataPgEvidence.PGName.Mst.Commodity; entity.is_exists_data = DataExists.IsExistData(db, companyId, "", tblName, "ID", Id, CommonUtl.geStrOrNumKbn.String); break; #endregion #region 伝票入力系 #region 売上入力系 case "T_ESTIMATE_H": lock_check_id = groupId + "-" + Id; lock_check_pg_id = DataPgEvidence.PGName.Estimate.EstimateInp; entity.is_exists_data = DataExists.IsExistData(db, companyId, groupId, tblName, "NO", Id, CommonUtl.geStrOrNumKbn.Number); if (entity.is_exists_data) { // 受注計上済チェック if (DataExists.IsExistData(db, companyId, groupId, "T_ORDER_H", "ESTIMATENO", Id, CommonUtl.geStrOrNumKbn.Number)) { entity.MESSAGE = "複写先ID : " + Id + " は受注計上済の為、複写できません。"; return(entity); } // 売上計上済チェック if (DataExists.IsExistData(db, companyId, groupId, "T_SALES_H", "ESTIMATENO", Id, CommonUtl.geStrOrNumKbn.Number)) { entity.MESSAGE = "複写先ID : " + Id + " は売上計上済の為、複写できません。"; return(entity); } } break; case "T_ORDER_H": lock_check_id = groupId + "-" + Id; lock_check_pg_id = DataPgEvidence.PGName.Order.OrderInp; entity.is_exists_data = DataExists.IsExistData(db, companyId, groupId, tblName, "NO", Id, CommonUtl.geStrOrNumKbn.Number); if (entity.is_exists_data) { // 売上計上済チェック if (DataExists.IsExistData(db, companyId, groupId, "T_SALES_H", "ORDER_NO", Id, CommonUtl.geStrOrNumKbn.Number)) { entity.MESSAGE = "複写先ID : " + Id + " は売上計上済の為、複写できません。"; return(entity); } } break; case "T_SALES_H": lock_check_id = groupId + "-" + Id; lock_check_pg_id = DataPgEvidence.PGName.Sales.SalesInp; entity.is_exists_data = DataExists.IsExistData(db, companyId, groupId, tblName, "NO", Id, CommonUtl.geStrOrNumKbn.Number); if (entity.is_exists_data) { DataExists.GetData(db, companyId, groupId, tblName, "NO", Id, CommonUtl.geStrOrNumKbn.Number, "TBL.INVOICE_ID", "TBL.INVOICE_NO", "TBL.RECEIPT_NO", "TBL.BUSINESS_DIVISION_ID", "date_format(TBL.SALES_YMD , " + ExEscape.SQL_YMD + ") AS SALES_YMD", "INVOICE_ID", "INVOICE_NO", "RECEIPT_NO", "BUSINESS_DIVISION_ID", "SALES_YMD", ref get_col1Value, ref get_col2Value, ref get_col3Value, ref get_col4Value, ref get_col5Value ); // 掛売上 if (ExCast.zCInt(get_col4Value) == 1) { // 請求締切済チェック if (DataClose.IsInvoiceClose(companyId, db, ExCast.zNumZeroNothingFormat(get_col1Value), ExCast.zDateNullToDefault(get_col5Value))) { entity.is_lock_success = false; entity.ret = false; entity.MESSAGE = "複写先ID : " + Id + " は請求締切済の為、複写できません。"; return(entity); } } // 請求済チェック // 都度請求分も請求番号が設定されている為、不許可とする if (ExCast.zCLng(get_col2Value) != 0) { entity.MESSAGE = "複写先ID : " + Id + " は請求済の為、複写できません。"; return(entity); } // 入金済チェック if (ExCast.zCLng(get_col2Value) != 0) { if (DataExists.IsExistData(db, companyId, groupId, "T_RECEIPT_H", "INVOICE_NO", ExCast.zCLng(get_col2Value).ToString(), CommonUtl.geStrOrNumKbn.Number)) { entity.MESSAGE = "複写先ID : " + Id + " は入金計上済の為、複写できません。"; return(entity); } } } break; case "T_RECEIPT_H": lock_check_id = groupId + "-" + Id; lock_check_pg_id = DataPgEvidence.PGName.Receipt.ReceiptInp; entity.is_exists_data = DataExists.IsExistData(db, companyId, groupId, tblName, "NO", Id, CommonUtl.geStrOrNumKbn.Number); break; #endregion #region 在庫入力系 case "T_IN_OUT_DELIVERY_H": lock_check_id = groupId + "-" + Id; lock_check_pg_id = DataPgEvidence.PGName.InOutDeliver.InOutDeliverInp; entity.is_exists_data = DataExists.IsExistData(db, companyId, groupId, tblName, "NO", Id, CommonUtl.geStrOrNumKbn.Number); if (entity.is_exists_data) { // 売上計上分チェック if (DataExists.IsExistDataDouble(db, companyId, groupId, "T_IN_OUT_DELIVERY_H", "NO", Id, "IN_OUT_DELIVERY_PROC_KBN", "2", CommonUtl.geStrOrNumKbn.Number)) { entity.MESSAGE = "複写先ID : " + Id + " は売上計上分の為、複写できません。"; return(entity); } // 仕入計上分チェック if (DataExists.IsExistDataDouble(db, companyId, groupId, "T_IN_OUT_DELIVERY_H", "NO", Id, "IN_OUT_DELIVERY_PROC_KBN", "3", CommonUtl.geStrOrNumKbn.Number)) { entity.MESSAGE = "複写先ID : " + Id + " は仕入計上分の為、複写できません。"; return(entity); } } break; #endregion #endregion default: entity.is_exists_data = false; break; } // 排他制御 string strErr = DataPgLock.SetLockPg(companyId, userId, lock_check_pg_id, lock_check_id, ipAdress, db, out lockFlg); if (strErr != "") { entity.MESSAGE = CLASS_NM + ".CopyCheck : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr; entity.is_lock_success = false; entity.ret = false; } else { if (lockFlg == DataPgLock.geLovkFlg.Lock) { entity.is_lock_success = false; entity.ret = false; entity.MESSAGE = "複写先ID : " + Id + " は他ユーザーにて現在更新中の為、複写できません。"; } else { entity.is_lock_success = true; entity.ret = true; } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".CopyCheck", ex); entity = new EntityCopying(); entity.MESSAGE = CLASS_NM + ".CopyCheck : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();; } return(entity); }