private void dgUpdate_CellEditEnded(object sender, DataGridCellEditEndedEventArgs e) { EntityPaymentBalance entity = (EntityPaymentBalance)e.Row.DataContext; // 明細計算 switch (e.Column.DisplayIndex) { case 4: double price = entity._before_payment_price_upd; for (int i = 0; i <= this.entityList.Count - 1; i++) { if (entity._purchase_id == this.entityList[i]._purchase_id) { if (this.dgUpdate.SelectedIndex != i) { this.entityList[i]._before_payment_price_upd += price; } this.entityList[i]._transfer_price = this.entityList[i]._before_payment_price_upd - this.entityList[i]._payment_cash_price; this.entityList[i]._payment_price = this.entityList[i]._transfer_price + this.entityList[i]._no_tax_purchase_price + this.entityList[i]._tax; } } entity._before_payment_price_upd = price; break; } }
public List<EntityPaymentBalance> GetPaymentBalanceList(string random, string strWhereSql, string strOrderBySql) { List<EntityPaymentBalance> entityList = new List<EntityPaymentBalance>(); #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 != "") { EntityPaymentBalance entity = new EntityPaymentBalance(); entity.MESSAGE = _message; entityList.Add(entity); return entityList; } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetPaymentBalanceList(認証処理)", ex); EntityPaymentBalance entity = new EntityPaymentBalance(); 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.GetPaymentBalanceListReportSQL(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 EntityPaymentBalance entity = new EntityPaymentBalance(); entity.no = ExCast.zCStr(dt.DefaultView[i]["NO"]); entity.purchase_id = ExCast.zCStr(dt.DefaultView[i]["PURCHASE_ID"]); entity.purchase_nm = ExCast.zCStr(dt.DefaultView[i]["PURCHASE_NM"]); entity.payment_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["PAYMENT_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.payment_plan_day = ExCast.zDateNullToDefault(dt.DefaultView[i]["PAYMENT_PLAN_DAY"]); entity.payment_day = ExCast.zCInt(dt.DefaultView[i]["PAYMENT_DAY"]); entity.before_payment_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["BEFORE_PAYMENT_YYYYMMDD"]); entity.before_payment_price = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_PAYMENT_PRICE"]); entity.before_payment_price_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_PAYMENT_PRICE"]); entity.payment_cash_price = ExCast.zCDbl(dt.DefaultView[i]["PAYMENT_CASH_PRICE"]); entity.transfer_price = ExCast.zCDbl(dt.DefaultView[i]["TRANSFER_PRICE"]); entity.purchase_price = ExCast.zCDbl(dt.DefaultView[i]["PURCHASE_PRICE"]); entity.no_tax_purchase_price = ExCast.zCDbl(dt.DefaultView[i]["NO_TAX_PURCHASE_PRICE"]); entity.tax = ExCast.zCDbl(dt.DefaultView[i]["TAX"]); entity.payment_price = ExCast.zCDbl(dt.DefaultView[i]["PAYMENT_PRICE"]); entity.payment_kbn = ExCast.zCInt(dt.DefaultView[i]["PAYMENT_KBN"]); //entity.payment_kbn_nm = ExCast.zCStr(dt.DefaultView[i]["PAYMENT_KBN_NM"]); entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]); entity.payment_exists_flg = 0; entity.exec_flg = false; entity.lock_flg = 0; entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetPaymentBalanceList", ex); entityList.Clear(); EntityPaymentBalance entity = new EntityPaymentBalance(); entity.MESSAGE = CLASS_NM + ".GetPaymentBalanceList : 予期せぬエラーが発生しました。" + 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; }