/// <summary> /// 共通追加SQL(WHO COLUMS)取得 /// </summary> /// <param name="intKbn"></param> /// <param name="pgid"></param> /// <param name="tblName"></param> /// <param name="person_id"></param> /// <param name="denNo"></param> /// <param name="ipAdress"></param> /// <param name="userId"></param> /// <returns></returns> public static string GetInsSQLCommonColums(UpdKbn intKbn, string pgid, string tblName, int person_id, string denNo, string ipAdress, string userId) { // 日時取得 DateTime now = DateTime.Now; string date = now.ToString("yyyy/MM/dd"); string time = now.ToString("HH:mm:ss"); StringBuilder sb = new StringBuilder(); if (intKbn == UpdKbn.Ins) { // insert sb.Append(" ,0" + Environment.NewLine); // UPDATE_FLG sb.Append(" ,0" + Environment.NewLine); // DELETE_FLG sb.Append(" ," + ExEscape.zRepStr(pgid) + 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(person_id.ToString()) + Environment.NewLine); // CREATE_PERSON_ID sb.Append(" ," + ExEscape.zRepStr(date) + Environment.NewLine); // CREATE_DATE sb.Append(" ," + ExEscape.zRepStr(time) + Environment.NewLine); // CREATE_TIME sb.Append(" ," + ExEscape.zRepStr(pgid) + 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(person_id) + Environment.NewLine); // UPDATE_PERSON_ID sb.Append(" ," + ExEscape.zRepStr(date) + Environment.NewLine); // UPDATE_DATE sb.Append(" ," + ExEscape.zRepStr(time) + Environment.NewLine); // UPDATE_TIME } else { // Update string _pgId = ""; string _adress = ""; string _userId = ""; string _personId = ""; string _date = ""; string _time = ""; GetSQLCommonUpdate(denNo, tblName, ref _pgId, ref _adress, ref _userId, ref _personId, ref _date, ref _time); sb.Append(" ,1" + Environment.NewLine); // UPDATE_FLG sb.Append(" ,0" + Environment.NewLine); // DELETE_FLG sb.Append(" ," + ExEscape.zRepStr(_pgId) + Environment.NewLine); // CREATE_PG_ID sb.Append(" ," + ExEscape.zRepStr(_adress) + Environment.NewLine); // CREATE_ADRESS sb.Append(" ," + ExEscape.zRepStr(_userId) + Environment.NewLine); // CREATE_USER_ID sb.Append(" ," + ExEscape.zRepStr(_personId) + Environment.NewLine); // CREATE_PERSON_ID sb.Append(" ," + ExEscape.zRepStr(ExCast.zDateNullToDefault(_date)) + Environment.NewLine); // CREATE_DATE sb.Append(" ," + ExEscape.zRepStr(ExCast.zTimeNullToDefault(_time)) + Environment.NewLine); // CREATE_TIME sb.Append(" ," + ExEscape.zRepStr(pgid) + 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(person_id) + Environment.NewLine); // UPDATE_PERSON_ID sb.Append(" ," + ExEscape.zRepStr(date) + Environment.NewLine); // UPDATE_DATE sb.Append(" ," + ExEscape.zRepStr(time) + Environment.NewLine); // UPDATE_TIME } return(sb.ToString()); }
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 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 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 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 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); }