public void Execute(AddOrderPaymentInfoCommand command) { try { var op = _cokeDataContext.tblOrderPaymentInfo.FirstOrDefault(s => s.Id == command.InfoId); if (op == null) { op = new tblOrderPaymentInfo(); op.Id = command.InfoId; _cokeDataContext.tblOrderPaymentInfo.AddObject(op); op.Amount = command.Amount; } op.Description = command.Description; op.DocumentId = command.DocumentId; op.ConfirmedAmount += command.ConfirmedAmount; op.IsConfirmed = command.IsConfirmed; op.IsProcessed = command.IsProcessed; //if(op.ConfirmedAmount>=op.Amount) //{ // op.IsConfirmed = true; // op.IsProcessed = true; //} //else //{ // op.IsConfirmed = false; // op.IsProcessed = false; //} op.MMoneyPaymentType = command.MMoneyPaymentType; op.NotificationId = command.NotificationId; op.PaymentMode = command.PaymentModeId; op.PaymentRefId = command.PaymentRefId; op.TransactionDate = command.CommandCreatedDateTime; if (command.DueDate > new DateTime(2000, 1, 1)) op.ChequeDueDate = command.DueDate; op.BankCode = command.Bank; op.BranchCode = command.BankBranch; _cokeDataContext.SaveChanges(); } catch (Exception ex) { _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString()); _log.Error("AddOrderPaymentInfoCommandHandler exception", ex); throw; } }
/// <summary> /// Deprecated Method for adding a new object to the tblOrderPaymentInfo EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotblOrderPaymentInfo(tblOrderPaymentInfo tblOrderPaymentInfo) { base.AddObject("tblOrderPaymentInfo", tblOrderPaymentInfo); }
/// <summary> /// Create a new tblOrderPaymentInfo object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="documentId">Initial value of the DocumentId property.</param> /// <param name="amount">Initial value of the Amount property.</param> /// <param name="confirmedAmount">Initial value of the ConfirmedAmount property.</param> /// <param name="paymentMode">Initial value of the PaymentMode property.</param> public static tblOrderPaymentInfo CreatetblOrderPaymentInfo(global::System.Guid id, global::System.Guid documentId, global::System.Decimal amount, global::System.Decimal confirmedAmount, global::System.Int32 paymentMode) { tblOrderPaymentInfo tblOrderPaymentInfo = new tblOrderPaymentInfo(); tblOrderPaymentInfo.Id = id; tblOrderPaymentInfo.DocumentId = documentId; tblOrderPaymentInfo.Amount = amount; tblOrderPaymentInfo.ConfirmedAmount = confirmedAmount; tblOrderPaymentInfo.PaymentMode = paymentMode; return tblOrderPaymentInfo; }