public void CreateThirdPayment(ThirdPartySchedule entity) { this.thirdPartyScheduleRepository.Insert(entity); unitOfWork.SaveChanges(); Dictionary <string, object> dicThirdPartySchedule = new Dictionary <string, object>(); activityLogService.CreateDictionaryForThirdParty(ref dicThirdPartySchedule, entity); XmlHelper.SerializeKeyValuePairs("ThirdPartySchedule", dicThirdPartySchedule); activityLogService.CreateActivityLog(new ActivityLog { Comment = XmlHelper.SerializeKeyValuePairs("ThirdPartySchedule", dicThirdPartySchedule), ObjectTypeId = (int)AuditObjectType.PaymentThirdPartySchedule, ObjectId = entity.ThirdPartyScheduleId.ToString() }, "ThirdPartySchedule.Insert"); }
public void CreateDictionaryForThirdParty(ref Dictionary <string, object> dicThirdParty, ThirdPartySchedule objThirdPartySchedule) { if (objThirdPartySchedule.IsNull()) { throw new ArgumentNullException(); } if (dicThirdParty.IsNull()) { dicThirdParty = new Dictionary <string, object>(); } dicThirdParty.Add("IdEntidad", !objThirdPartySchedule.EntityId_RemitTo.IsNull() ? objThirdPartySchedule.EntityId_RemitTo.Value : -1); dicThirdParty.Add("NumeroCasoOrden", objThirdPartySchedule.TerminationOrderNumber); dicThirdParty.Add("NumeroParticipante", objThirdPartySchedule.OrderIdentifier); dicThirdParty.Add("TerminationFlag", objThirdPartySchedule.TerminationFlag.HasValue ? objThirdPartySchedule.TerminationFlag.Value: false); dicThirdParty.Add("SinglePayment", objThirdPartySchedule.SinglePaymentAmount.Value); dicThirdParty.Add("FirstInstallmentAmount", !objThirdPartySchedule.FirstInstallmentAmount.IsNull() ? objThirdPartySchedule.FirstInstallmentAmount.Value : 0); dicThirdParty.Add("SecondInstallmentAmount", !objThirdPartySchedule.SecondInstallmentAmount.IsNull() ? objThirdPartySchedule.SecondInstallmentAmount.Value : 0); dicThirdParty.Add("FechaTerminacion", objThirdPartySchedule.TerminationDate.HasValue ? objThirdPartySchedule.TerminationDate.Value.ToLongDateString() : string.Empty); }
public JsonResult Insert(ThirdPartyPaymentModel model) { int?newEntityId = null; var entity = new Entity(); var address = new Address(); if (model.EntityTypeId == 1) { entity = new Entity { SourceId = 8, FirstName = model.CustodyFirstName, MiddleName = model.CustodySecondName, LastName = model.CustodyFirstLastName, SecondLastName = model.CustodySecondLastName, FullName = string.Format("{0} {1} {2} {3}", model.CustodyFirstName, model.CustodySecondName, model.CustodyFirstLastName, model.CustodySecondLastName) }; address = new Address { EntityId = entity.EntityId, SourceId = 8, FullAddress = string.Format("{0} {1}", model.CustodyAddressLine1, model.CustodyAddressLine2), Line1 = model.CustodyAddressLine1, Line2 = model.CustodyAddressLine2, CityId = model.CustodyCityId, ZipCode = model.CustodyPostalCode == null ? string.Empty : model.CustodyPostalCode.Trim().Replace('-', '\0').PadRight(9, '0').Substring(0, 5), ZipCodeExt = model.CustodyPostalCode == null ? string.Empty : model.CustodyPostalCode.Trim().Replace('-', '\0').PadRight(9, '0').Substring(5, 4) }; entity.Addresses.Add(address); EntityService.CreateEntity(entity); newEntityId = entity.EntityId; } else if (model.EntityTypeId == 2) { entity = new Entity { SourceId = 9, FullName = model.EntityName }; address = new Address { SourceId = 9, EntityId = entity.EntityId, FullAddress = string.Format("{0} {1}", model.EntityAddressLine1, model.EntityAddressLine2), Line1 = model.EntityAddressLine1, Line2 = model.EntityAddressLine2, CityId = model.EntityCityId, ZipCode = model.EntityPostalCode == null ? string.Empty : model.EntityPostalCode.Trim().Replace('-', '\0').PadRight(9, '0').Substring(0, 5), ZipCodeExt = model.EntityPostalCode == null ? string.Empty : model.EntityPostalCode.Trim().Replace('-', '\0').PadRight(9, '0').Substring(5, 4) }; entity.Addresses.Add(address); EntityService.CreateEntity(entity); newEntityId = entity.EntityId; } else if (model.EntityTypeId == 3) { newEntityId = model.CourtId; } decimal amount = decimal.Zero; if (model.SinglePaymentAmount.HasValue) { amount = model.SinglePaymentAmount.Value; } else { amount = model.FirstInstallmentAmount.GetValueOrDefault(decimal.Zero) + model.SecondInstallmentAmount.GetValueOrDefault(decimal.Zero); } var thirdPartySchedule = new ThirdPartySchedule { CaseId = model.CaseId, CaseDetailId = model.CaseDetailId, EntityId_RemitTo = model.EntityTypeId == 2 || model.EntityTypeId == 3 ? newEntityId : null, ClaimNumber = model.ClaimNumber, OrderIdentifier = model.OrderIdentifier, TerminationFlag = model.TerminationFlag, EffectiveDate = model.EffectiveDate, TerminationOrderNumber = model.TerminationOrderNumber, SinglePaymentAmount = model.SinglePaymentAmount, FirstInstallmentAmount = model.FirstInstallmentAmount, SecondInstallmentAmount = model.SecondInstallmentAmount, Comment = model.Comment, OrderAmount = model.OrderAmount, TerminationDate = model.TerminationDate, CreatedDateTime = System.DateTime.UtcNow, CreatedBy = WebHelper.GetUserName(), }; PaymentService.CreateThirdPayment(thirdPartySchedule); return(Json(new BasicDataTablesResult(new { Status = "OK" }))); }
public void ModifyThirdPayment(ThirdPartySchedule entity) { this.thirdPartyScheduleRepository.Update(entity); unitOfWork.SaveChanges(); }