예제 #1
0
 protected override void PopulateData()
 {
     using (var session = Domain.OpenSession())
         using (var tx = session.OpenTransaction()) {
             _ = new CheckEntity();
             tx.Complete();
         }
 }
예제 #2
0
 /// <summary> setups the sync logic for member _check</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncCheck(IEntity2 relatedEntity)
 {
     if (_check != relatedEntity)
     {
         DesetupSyncCheck(true, true);
         _check = (CheckEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_check, new PropertyChangedEventHandler(OnCheckPropertyChanged), "Check", MVPaymentCheckDetailsEntity.Relations.CheckEntityUsingCheckId, true, new string[] {  });
     }
 }
예제 #3
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _check            = null;
            _physicianPayment = null;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
예제 #4
0
        public void PostCheck()
        {
            string      xml = OperationContext.Current.RequestContext.RequestMessage.ToString();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);

            CheckEntity check = SerializeHandler.DeserializeFile <CheckEntity>(json);

            repository.SaveCheck(check);
        }
예제 #5
0
        public Check newCheck()
        {
            CheckEntity e = new CheckEntity {
                clouse = false
            };

            BDManager.manager.addCheck(e);
            BDManager.manager.getChildren(e);
            Check c = new Check(e);

            return(c);
        }
예제 #6
0
        public Check getOpenCheck()
        {
            List <CheckEntity> l = BDManager.manager.getOpenCheckList();

            if (l.Count == 0)
            {
                return(null);
            }
            CheckEntity o = l.First();

            BDManager.manager.getChildren(o);
            return(new Check(o));
        }
예제 #7
0
        public async Task ExpiredThresholdCausesAzskRecordUpdate()
        {
            // Arrange
            await using var context = JosekiTestsDb.CreateUniqueContext();
            var parser      = new ConfigurationParser("config.sample.yaml");
            var checksCache = new ChecksCache(parser, context, new MemoryCache(new MemoryCacheOptions()));

            var id             = $"azsk.{Guid.NewGuid().ToString()}";
            var now            = DateTime.UtcNow;
            var expirationDate = now.AddDays(-(parser.Get().Cache.AzureCheckTtl + 1));
            var oldCheck       = new CheckEntity
            {
                CheckId     = id,
                Category    = Guid.NewGuid().ToString(),
                Description = Guid.NewGuid().ToString(),
                Severity    = joseki.db.entities.CheckSeverity.Medium,
                DateUpdated = expirationDate,
                DateCreated = expirationDate,
            };

            // this is the hack -_-
            // Use sync version, because it does not update DateUpdated & DateCreated
            context.Check.Add(oldCheck);
            context.SaveChanges();

            var newCheck = new Check
            {
                Id          = id,
                Category    = Guid.NewGuid().ToString(),
                Description = Guid.NewGuid().ToString(),
                Remediation = Guid.NewGuid().ToString(),
                Severity    = CheckSeverity.High,
            };

            // Act & Assert
            context.Check.Count().Should().Be(1, "context should have the only one record before GetOrAddItem");
            await checksCache.GetOrAddItem(id, () => newCheck);

            var actualEntity = await context.Check.FirstAsync(i => i.CheckId == id);

            actualEntity.Category.Should().Be(newCheck.Category);
            actualEntity.Description.Should().Be(newCheck.Description);
            actualEntity.Remediation.Should().Be(newCheck.Remediation);
            actualEntity.Severity.Should().Be(joseki.db.entities.CheckSeverity.High);
            actualEntity.DateUpdated.Should().BeOnOrAfter(now);
        }
예제 #8
0
        private static void FilesProcessor(string fullPath, string fileName)
        {
            Logger.Log.Info(String.Format("Processing file in CheckFolder: {0}", fullPath));

            try
            {
                if (Path.GetExtension(fullPath).Equals(".txt"))
                {
                    CheckEntity check = (SerializeHandler.DeserializeFile <CheckEntity>(fullPath));

                    RequestHandler.SendRequest(Configurations.CurrentConfig.HostIp, Configurations.CurrentConfig.HostPort, "/PostCheck", check);

                    File.Move(fullPath, UniqueFilePath(Configurations.CurrentConfig.CompleteFolderPath, fileName));


                    Logger.Log.Info(String.Format("Move file to CompleteFolder: {0}", fullPath));
                }
                else
                {
                    throw new Exception("File format wrong");
                }
            }
            catch (Exception ex)
            {
                if (File.Exists(fullPath))
                {
                    File.Move(fullPath, UniqueFilePath(Configurations.CurrentConfig.GarbageFolderPath, fileName));


                    Logger.Log.Error(String.Format("Move file to GarbageFolder: {0}", fullPath), ex);
                }
                else if (Directory.Exists(fullPath))
                {
                    Directory.Move(fullPath, UniqueFilePath(Configurations.CurrentConfig.GarbageFolderPath, fileName));


                    Logger.Log.Error(String.Format("Move file to GarbageFolder: {0} , ", fullPath), ex);
                }
                else
                {
                    throw new Exception(String.Format("Unexpected location of moving file {0} ", fullPath));
                }
            }
        }
예제 #9
0
        protected MVPaymentCheckDetailsEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _check = (CheckEntity)info.GetValue("_check", typeof(CheckEntity));
                if (_check != null)
                {
                    _check.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _physicianPayment = (PhysicianPaymentEntity)info.GetValue("_physicianPayment", typeof(PhysicianPaymentEntity));
                if (_physicianPayment != null)
                {
                    _physicianPayment.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
        public void CreatePaymentInstrumentSetsMetaDataToCreatedMetaData()
        {
            var checkEntity = new CheckEntity
            {
                DateCreated           = new DateTime(2001, 1, 1),
                DateModified          = new DateTime(2002, 2, 2),
                DataRecoderCreatorId  = 234,
                DataRecoderModifierId = 456
            };
            var expectedDataRecorderMetaData = new DataRecorderMetaData();

            Expect.Call(_dataRecorderMetaDataFactory.CreateDataRecorderMetaData(checkEntity.DataRecoderCreatorId,
                                                                                checkEntity.DateCreated, checkEntity.DataRecoderModifierId, checkEntity.DateModified))
            .Return(expectedDataRecorderMetaData);

            _mocks.ReplayAll();
            PaymentInstrument paymentInstrument = _paymentInstrumentFactory.
                                                  CreatePaymentInstrument(checkEntity);

            _mocks.VerifyAll();

            Assert.AreEqual(expectedDataRecorderMetaData, paymentInstrument.DataRecorderMetaData);
        }
예제 #11
0
        /// <summary>
        /// check 授权
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static CheckEntity CheckLic(string url)
        {
            CheckEntity c = new CheckEntity();

            c.HVID      = Program.HVID;
            c.CheckFlag = 1;
            c.ProVer    = Program.ProductVer;
            DateTime dt = DateTime.Now;

            c.SpanTime = dt;
            try
            {
                RequestEntity r = new RequestEntity();
                r.OptCommand = OptCom.CheckLic.ToString();
                r.Content    = ApiClient.ToJson(c);
                r.Content    = Security.EncryptCommon(r.Content);
                IAASResponse reponse = IAASRequest.Reauest(url, RequestMethod.POST, "", "", ApiClient.ToJson(r));
                if (reponse.StatusCode == HttpStatusCode.OK)
                {
                    c = ApiClient.JsonToObj <CheckEntity>(reponse.Content);
                    if (((TimeSpan)(dt - c.SpanTime)).TotalMilliseconds > 50)
                    {
                        c.CheckFlag = 1;
                    }
                }
                else
                {
                    c.CheckFlag = 1;
                }
            }
            catch
            {
                c.CheckFlag = 1;
            }
            return(c);
        }
        public void CreatePaymentInstrumentSetsPropertiesToGivenEntityProperties()
        {
            const string  expectedAccountNumber = "12345";
            const decimal expectedAmount        = 5.33m;
            var           expectedCheckDate     = new DateTime(2001, 1, 1);
            var           checkEntity           = new CheckEntity
            {
                AccountNumber = expectedAccountNumber,
                Amount        = expectedAmount,
                CheckDate     = expectedCheckDate
            };

            Expect.Call(_dataRecorderMetaDataFactory.CreateDataRecorderMetaData(0, new DateTime(2001, 2, 1), null, null))
            .IgnoreArguments().Return(new DataRecorderMetaData());

            _mocks.ReplayAll();
            PaymentInstrument paymentInstrument = _paymentInstrumentFactory.CreatePaymentInstrument(checkEntity);

            _mocks.VerifyAll();

            Assert.AreEqual(expectedAccountNumber, ((Check)paymentInstrument).AccountNumber);
            Assert.AreEqual(expectedAmount, paymentInstrument.Amount);
            Assert.AreEqual(expectedCheckDate, ((Check)paymentInstrument).CheckDate);
        }
예제 #13
0
        public PaymentInstrument CreatePaymentInstrument(CheckEntity checkEntity)
        {
            if (checkEntity == null)
            {
                throw new ArgumentNullException("checkEntity", "Given CheckEntity cannot be null.");
            }

            DataRecorderMetaData dataRecorderMetaData = _dataRecorderMetaDataFactory.
                                                        CreateDataRecorderMetaData(checkEntity.DataRecoderCreatorId, checkEntity.DateCreated,
                                                                                   checkEntity.DataRecoderModifierId, checkEntity.DateModified);

            return(new Check(checkEntity.CheckId)
            {
                DataRecorderMetaData = dataRecorderMetaData,
                AccountNumber = checkEntity.AccountNumber,
                Amount = checkEntity.Amount,
                BankName = checkEntity.BankName,
                CheckDate = checkEntity.CheckDate,
                CheckNumber = checkEntity.CheckNumber,
                PayableTo = checkEntity.PayableTo,
                RoutingNumber = checkEntity.RoutingNumber,
                Memo = checkEntity.Memo
            });
        }
예제 #14
0
 /// <summary> Removes the sync logic for member _check</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncCheck(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_check, new PropertyChangedEventHandler(OnCheckPropertyChanged), "Check", MVPaymentCheckDetailsEntity.Relations.CheckEntityUsingCheckId, true, signalRelatedEntity, "MvpaymentCheckDetails", resetFKFields, new int[] { (int)MVPaymentCheckDetailsFieldIndex.CheckId });
     _check = null;
 }
예제 #15
0
 public Check(CheckEntity entity)
 {
     this.entity = entity;
 }
        public void MakePayment(MedicalVendorPayment medicalVendorPayment, List <long>
                                medicalVendorInvoiceIdsToApplyPaymentTo)
        {
            if (medicalVendorPayment == null)
            {
                throw new ArgumentNullException("medicalVendorPayment");
            }
            if (medicalVendorInvoiceIdsToApplyPaymentTo == null)
            {
                throw new ArgumentNullException("medicalVendorInvoiceIdsToApplyPaymentTo");
            }
            if (medicalVendorPayment.PaymentInstruments.Count == 0 ||
                medicalVendorInvoiceIdsToApplyPaymentTo.Count == 0)
            {
                throw new EmptyCollectionException();
            }

            if (!_validator.IsValid(medicalVendorPayment))
            {
                throw new InvalidObjectException <MedicalVendorPayment>(_validator);
            }

            PhysicianPaymentEntity medicalVendorPaymentEntity = _mapper.Map(medicalVendorPayment);

            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                myAdapter.StartTransaction(IsolationLevel.ReadCommitted,
                                           "MedicalVendorPaymentRepository.MakePayment");
                try
                {
                    // Persist payment.
                    if (!myAdapter.SaveEntity(medicalVendorPaymentEntity, true))
                    {
                        throw new PersistenceFailureException();
                    }

                    // Persist payment instrument(s) & associate with payment.
                    foreach (Check check in medicalVendorPayment.PaymentInstruments)
                    {
                        long?dataRecoderModifierId = null;
                        if (check.DataRecorderMetaData.DataRecorderModifier != null)
                        {
                            dataRecoderModifierId = check.DataRecorderMetaData.DataRecorderModifier.Id;
                        }
                        var checkEntity = new CheckEntity
                        {
                            AccountNumber         = check.AccountNumber,
                            CheckNumber           = check.CheckNumber,
                            RoutingNumber         = check.RoutingNumber,
                            BankName              = check.BankName,
                            Memo                  = check.Memo,
                            DataRecoderCreatorId  = check.DataRecorderMetaData.DataRecorderCreator.Id,
                            DateCreated           = check.DataRecorderMetaData.DateCreated,
                            DataRecoderModifierId = dataRecoderModifierId,
                            DateModified          = check.DataRecorderMetaData.DateModified,
                            Amount                = check.Amount,
                            PayableTo             = check.PayableTo,
                            CheckDate             = check.CheckDate
                        };
                        if (!myAdapter.SaveEntity(checkEntity, true))
                        {
                            throw new PersistenceFailureException();
                        }
                        var paymentCheckDetailEntity = new MVPaymentCheckDetailsEntity(checkEntity.CheckId,
                                                                                       medicalVendorPaymentEntity.PhysicianPaymentId);
                        if (!myAdapter.SaveEntity(paymentCheckDetailEntity))
                        {
                            throw new PersistenceFailureException();
                        }
                    }

                    // Associate payment with invoice(s).
                    long medicalVendorPaymentId = medicalVendorPaymentEntity.PhysicianPaymentId;
                    var  medicalVendorPaymentInvoiceEntities =
                        new EntityCollection <PhysicianPaymentInvoiceEntity>();
                    foreach (var medicalVendorInvoiceId in medicalVendorInvoiceIdsToApplyPaymentTo)
                    {
                        medicalVendorPaymentInvoiceEntities.Add(new PhysicianPaymentInvoiceEntity
                                                                    (medicalVendorPaymentId, medicalVendorInvoiceId));
                    }
                    myAdapter.SaveEntityCollection(medicalVendorPaymentInvoiceEntities);
                    myAdapter.Commit();
                }
                catch (Exception)
                {
                    myAdapter.Rollback();
                    throw;
                }
            }
        }