Beispiel #1
0
 public static Request ProcessCheckRequest(Request request)
 {
     Request request2 = new Request();
     try
     {
         PayRequest request3;
         if (request.RequestParameters.RequestId == 0L)
         {
             if (string.IsNullOrEmpty(request.Sender.PaymentSystem))
             {
                 return request2.SetStatus(StatusCode.НеНайденТэгPaymentSystem);
             }
             if (string.IsNullOrEmpty(request.Sender.Organization))
             {
                 return request2.SetStatus(StatusCode.НеНайденТэгOrganization);
             }
             if (string.IsNullOrEmpty(request.Sender.Operator) && string.IsNullOrEmpty(request.Sender.Terminal))
             {
                 return request2.SetStatus(StatusCode.НеНайденыТэгиOperatorИTerminal);
             }
             request3 = new PayRequest {
                 AccountNumber = request.RequestParameters.AccountNumber,
                 Period = new System.DateTime(request.RequestParameters.PayPeriodYear, request.RequestParameters.PayPeriodMonth, 1),
                 PaymentSystem = request.Sender.PaymentSystem,
                 Organization = request.Sender.Organization,
                 Office = request.Sender.Office,
                 Terminal = request.Sender.Terminal,
                 Operator = request.Sender.Operator,
                 ServiceCode = request.Sender.ServiceCode
             };
             request3.SaveChanges();
             request3.ProcessRequest_Service(true);
         }
         else
         {
             request3 = ObjectWithId.FindById<PayRequest>(request.RequestParameters.RequestId);
             if (request3.IsConfirmed)
             {
                 return request2.SetStatus(StatusCode.ЗапросУжеПроведен);
             }
             request3.Period = new System.DateTime(request.RequestParameters.PayPeriodYear, request.RequestParameters.PayPeriodMonth, 1);
             request3.PaidSumm = request.RequestParameters.PaidSumm;
             request3.SaveChanges();
             foreach (PayRequestServicePayAmount amount in request3.GetRequestServicePayAmounts())
             {
                 amount.Delete();
             }
             foreach (AIS.SN.Model.DomainObjects.PaymentService.Service service in request.Services)
             {
                 new PayRequestServicePayAmount { RequestId = request3.Id, Code = service.Code, CounterIndication = service.NewCounter, Paid = service.Paid }.SaveChanges();
             }
             request3.ProcessRequest_Service(false);
         }
         request3 = ObjectWithId.FindById<PayRequest>(request3.Id);
         request2 = new Request {
             ResponseParameters = { RequestId = request3.Id, OwnerName = request3.OwnerName, ApartmentType = request3.ApartmentType, ApartmentTotalSquare = request3.ApartmentTotalSquare, ResidentsCount = System.Convert.ToByte(request3.ResidentsCount), ResidentVacationsCount = System.Convert.ToByte(request3.ResidentVacationsCount), Benefits = new System.Collections.Generic.List<AIS.SN.Model.DomainObjects.PaymentService.Benefit>() }
         };
         foreach (PayRequestBenefit benefit in request3.GetRequestBenefits())
         {
             AIS.SN.Model.DomainObjects.PaymentService.Benefit benefit2 = new AIS.SN.Model.DomainObjects.PaymentService.Benefit {
                 Name = benefit.BenefitName,
                 Persons = benefit.PersonsCount
             };
             request2.ResponseParameters.Benefits.Add(benefit2);
         }
         request2.ResponseParameters.CurrentChargeSumm = request3.CurrentChargeSumm;
         request2.ResponseParameters.CurrentBenefitSumm = request3.CurrentBenefitSumm;
         request2.ResponseParameters.CurrentRecalcSumm = request3.CurrentRecalcSumm;
         request2.ResponseParameters.TotalDebt = request3.TotalDebt;
         request2.ResponseParameters.TotalPenalty = request3.TotalPenalty;
         request2.ResponseParameters.Comments = request3.Comments;
         request2.ResponseParameters.AdditionalInfo = request3.AdditionalInfo;
         foreach (PayRequestService service2 in request3.GetRequestServices())
         {
             AIS.SN.Model.DomainObjects.PaymentService.Service service3 = new AIS.SN.Model.DomainObjects.PaymentService.Service {
                 Code = service2.Code,
                 Name = service2.Name,
                 Counter = service2.CounterIndication,
                 NewCounter = service2.NewCounterIndication,
                 Rate = service2.Rate,
                 Charge = service2.ChargeSumm,
                 Benefit = service2.BenefitSumm,
                 Recalc = service2.RecalcSumm,
                 CounterCharge = service2.DiffChargeSumm - service2.DiffBenefitSumm,
                 FirstCounter = service2.FirstCounterIndication,
                 Saldo = service2.Saldo,
                 RateCounter = service2.RateCounter,
                 Debt = service2.Debt,
                 Paid = service2.Paid,
                 DebtPenalty = service2.DebtPenalty,
                 Penalty = service2.Penalty,
                 IsClosed = System.Convert.ToBoolean(service2.IsClosed),
                 IsFixed = System.Convert.ToBoolean(service2.IsFixed),
                 IsCounter = System.Convert.ToBoolean(service2.IsCounter),
                 Edk = service2.Edk
             };
             request2.Services.Add(service3);
         }
         request2.SetStatus(StatusCode.ЗапросВыполненУспешно);
     }
     catch (System.Exception exception)
     {
         request2 = new Request().SetStatus(StatusCode.НепредвиденнаяОшибка, exception);
     }
     return request2;
 }