Example #1
0
 public void Handle(UserLoginEvent domainEvent)
 {
     if (domainEvent == null || domainEvent.LoginLog == null)
     {
         throw new CustomException(500, "登录实例化空异常");
     }
     unitOfWorkRepository.PersistCreationOf(domainEvent.LoginLog);
     unitOfWork.Commit();
 }
 public void Handle(OrderStatusChangedEvent domainEvent)
 {
     if (domainEvent.OldStatus == Common.Enums.EnumOrderStatus.WaitIssue && domainEvent.NewStatus == Common.Enums.EnumOrderStatus.WaitReimburseWithPlatformRepelIssue)
     {
         //生成退款单
         var bulider = AggregationFactory.CreateBuiler <PlatformRefundBuilder>();
         var order   = bulider.CreateRefundOrder(Common.Enums.EnumPlatformRefundType.RepelIssue, domainEvent.Order.OrderId, "平台拒绝出票,退款");
         unitOfWorkRepository.PersistCreationOf(order);
     }
 }
Example #3
0
 public void Handle(TicketEvent domainEvent)
 {
     if (domainEvent == null || domainEvent.TicketSums == null)
     {
         Logger.WriteLog(LogType.ERROR, "domainEvent is null");
         return;
     }
     domainEvent.TicketSums.ForEach(p =>
     {
         unitOfWorkRepository.PersistCreationOf(p);
     });
     unitOfWork.Commit();
 }
        public void AddDeductionGroup(ConsoContracts.DomesticTicket.DataObjects.RequestDeduction deduction)
        {
            if (deduction == null)
            {
                throw new CustomException(500, "数据信息获取失败!");
            }
            var model = AutoMapper.Mapper.Map <BPiaoBao.AppServices.ConsoContracts.DomesticTicket.DataObjects.RequestDeduction, DeductionGroup>(deduction);

            model.CarrierCode = AuthManager.GetCurrentUser().Code;
            model.CheckRule();
            model.DeductionRules.ToList().ForEach(p => p.CheckDetail());
            unitOfWorkRepository.PersistCreationOf(model);
            unitOfWork.Commit();
        }
Example #5
0
        public void TestMethod1()
        {
            // Database.SetInitializer(new MigrateDatabaseToLatestVersion<TicketDbContext,Configuration>());
            BootStrapper.ConfigureDependencies();
            IUnitOfWork           unitOfWorkTicket           = ObjectFactory.GetNamedInstance <IUnitOfWork>(EnumModule.DomesticTicket.ToString());
            IUnitOfWorkRepository unitOfWorkRepositoryticket = ObjectFactory.GetNamedInstance <IUnitOfWorkRepository>(EnumModule.DomesticTicket.ToString());

            Order order = new Order();

            order.OrderId    = "01305201230119290277";
            order.PnrCode    = "HPK3BQ";
            order.OrderMoney = decimal.Parse("1000");
            order.CreateTime = DateTime.Now;

            OrderPay orderPay = new OrderPay();

            orderPay.PayMoney = decimal.Parse("1000");
            order.OrderPay    = orderPay ?? null;


            order.Policy                            = new Policy();
            order.Policy.PolicyPoint                = decimal.Parse("8");
            order.Policy.PlatformCode               = "517";
            order.Policy.PolicyType                 = "1";
            order.Policy.WorkTime                   = new StartAndEndTime();
            order.Policy.WorkTime.StartTime         = "9:00";
            order.Policy.WorkTime.EndTime           = "23:00";
            order.Policy.ReturnTicketTime           = new StartAndEndTime();
            order.Policy.ReturnTicketTime.StartTime = "9:00";
            order.Policy.ReturnTicketTime.EndTime   = "23:00";
            order.Policy.AnnulTicketTime            = new StartAndEndTime();
            order.Policy.AnnulTicketTime.StartTime  = "9:00";
            order.Policy.AnnulTicketTime.EndTime    = "23:00";
            order.Passengers                        = new List <Passenger>();
            order.Passengers.Add(new Passenger {
                PassengerName = "测试", ABFee = decimal.Parse("50"), RQFee = decimal.Parse("120")
            });
            order.OrderLogs = new List <OrderLog>();
            order.OrderLogs.Add(new OrderLog {
                OperationContent = "新订单", OperationPerson = "test1", OperationDatetime = DateTime.Now
            });
            order.SkyWays = new List <SkyWay>();
            order.SkyWays.Add(new SkyWay {
                CarrayCode = "3U", FromCityCode = "CTU", ToCityCode = "PEK", Seat = "F", StartDateTime = DateTime.Parse("2013-12-05 11:15:00.000"), ToDateTime = DateTime.Parse("2013-12-05 11:17:00.000")
            });
            unitOfWorkRepositoryticket.PersistCreationOf(order);
            unitOfWorkTicket.Commit();
        }
Example #6
0
        public void SaveFrePasser(FrePasserDto passer)
        {
            var builder   = AggregationFactory.CreateBuiler <FrePasserBuilder>();
            var frePasser = builder.CreateFrePasser();

            frePasser.PasserType      = passer.PasserType;
            frePasser.Name            = passer.Name.Trim();
            frePasser.CertificateType = passer.CertificateType;
            frePasser.CertificateNo   = passer.CertificateNo;
            frePasser.Mobile          = passer.Mobile;
            frePasser.AirCardNo       = passer.AirCardNo;
            frePasser.Remark          = passer.Remark;
            frePasser.Birth           = passer.Birth;
            frePasser.SexType         = passer.SexType;
            frePasser.BusinessmanCode = _code;
            unitOfWorkRepository.PersistCreationOf(frePasser);
            unitOfWork.Commit();
        }
Example #7
0
        public void TestMethod1()
        {
            BootStrapper.ConfigureDependencies();
            IUnitOfWork           unitOfWork           = ObjectFactory.GetNamedInstance <IUnitOfWork>(EnumModule.SystemSetting.ToString());
            IUnitOfWorkRepository unitOfWorkRepository = ObjectFactory.GetNamedInstance <IUnitOfWorkRepository>(EnumModule.SystemSetting.ToString());

            Buyer bm = new Buyer();

            bm.CreateTime         = DateTime.Now;
            bm.Name               = "测试商户1";
            bm.Code               = "100001";
            bm.ContactWay         = new ContactWay();
            bm.ContactWay.Contact = "测试员A";
            bm.ContactWay.Address = "成都";
            bm.ContactWay.Tel     = "0281238901";
            bm.CreateTime         = DateTime.Now;
            bm.CashbagCode        = "0000000326";
            bm.CashbagKey         = "33cd87fd33d2493eb99b71a8a91d2ccf";
            bm.Operators          = new List <Operator>();
            bm.Operators.Add(new Operator {
                Account = "test1", Password = "******".Md5(), OperatorState = Common.Enums.EnumOperatorState.Normal, Realname = "测试员A", Phone = "13509098743"
            });
            bm.Attachments = new List <Attachment>();
            bm.Attachments.Add(new Attachment {
                Name = "附件1", Url = "www.ss.com"
            });

            bm.SMS             = new SMS();
            bm.SMS.RemainCount = 20;
            bm.SMS.SendCount   = 0;


            unitOfWorkRepository.PersistCreationOf(bm);

            //var businessman = businessmanRepository.FindAll(b => b.Code == code).SingleOrDefault();
            //businessman.Name = "测试商户222";
            //unitOfWorkRepository.PersistUpdateOf(businessman);
            //unitOfWork.Commit();

            //var businessman = businessmanRepository.FindAll(b => b.Code == "100002").SingleOrDefault();
            //unitOfWorkRepository.PersistDeletionOf(businessman);
            unitOfWork.Commit();
        }
Example #8
0
 /// <summary>
 /// 保存用户操作行为
 /// </summary>
 /// <param name="businessmanCode"></param>
 /// <param name="businessmanName"></param>
 /// <param name="businessmanType"></param>
 /// <param name="carrierCode"></param>
 /// <param name="contactName"></param>
 /// <param name="OperatorName"></param>
 /// <param name="enumBeOperate"></param>
 private void Save(string businessmanCode, string businessmanName, string businessmanType, string carrierCode, string contactName, string OperatorName, EnumBehaviorOperate enumBeOperate)
 {
     try
     {
         var builder      = AggregationFactory.CreateBuiler <BehaviorStatBuilder>();
         var behaviorStat = builder.CreateBehaviorStat();
         behaviorStat.BusinessmanCode = businessmanCode;
         behaviorStat.BusinessmanName = businessmanName;
         behaviorStat.BusinessmanType = businessmanType;
         behaviorStat.CarrierCode     = carrierCode;
         behaviorStat.ContactName     = contactName;
         behaviorStat.OperatorName    = OperatorName;
         behaviorStat.OpDateTime      = DateTime.Now;
         behaviorStat.BehaviorOperate = (int)enumBeOperate;
         unitOfWorkRepository.PersistCreationOf(behaviorStat);
         unitOfWork.Commit();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #9
0
 public void RegisterNew(IAggregateRoot entity, IUnitOfWorkRepository unitofWorkRepository)
 {
     unitofWorkRepository.PersistCreationOf(entity);
 }
Example #10
0
 public void RegisterNew(Infrastructure.IAggregateRoot entity, IUnitOfWorkRepository unitOfWorkRepository)
 {
     unitOfWorkRepository.PersistCreationOf(entity);
 }
Example #11
0
        public int AddTravelPaper(string buyerBusinessman,
                                  string startTripNumber, string endTripNumber, string useOffice, string iataCode,
                                  string ticketCompanyName, string tripRemark)
        {
            string BusinessmanCode    = currentUser.Code;
            string BusinessmanName    = currentUser.BusinessmanName;
            int    dataCount          = -1;
            string strMsg             = string.Empty;
            string useBusinessmanCode = string.Empty;
            string useBusinessmanName = string.Empty;

            if (string.IsNullOrEmpty(buyerBusinessman))
            {
                strMsg = "分配商户名称或者商户号不能为空!";
            }
            else if (string.IsNullOrEmpty(BusinessmanCode))
            {
                strMsg = "供应商户号不能为空!";
            }
            else if (string.IsNullOrEmpty(BusinessmanName))
            {
                strMsg = "供应商户号不能为空!";
            }
            else if (string.IsNullOrEmpty(startTripNumber) ||
                     string.IsNullOrEmpty(endTripNumber) ||
                     startTripNumber.Trim().Length != 10 ||
                     endTripNumber.Trim().Length != 10
                     )
            {
                strMsg = "行程单号段数据不完整!";
            }
            else if (string.IsNullOrEmpty(useOffice))
            {
                strMsg = "行程单号终端号不能为空!";
            }
            else if (string.IsNullOrEmpty(iataCode))
            {
                strMsg = "航协号不能为空!";
            }
            else if (string.IsNullOrEmpty(ticketCompanyName))
            {
                strMsg = "填开单位不能为空!";
            }
            else
            {
                if (!string.IsNullOrEmpty(startTripNumber) && !string.IsNullOrEmpty(endTripNumber))
                {
                    int start = int.Parse(startTripNumber.Substring(6, 4));
                    int end   = int.Parse(endTripNumber.Substring(6, 4));
                    if (start > end)
                    {
                        strMsg = "行程单号段范围有误!";
                    }
                }
            }
            //判断商户号是否存在
            Businessman businessman = this.m_businessmanRepository.FindAll(p => p.Code == buyerBusinessman || p.Name == buyerBusinessman).FirstOrDefault();

            if (businessman == null)
            {
                strMsg = "分配商户号或者商户名称不存在!";
            }
            else
            {
                useBusinessmanCode = businessman.Code;
                useBusinessmanName = businessman.Name;
            }
            //useBusinessmanCode = "caigou";//businessman.Code;
            //useBusinessmanName = "采购";//businessman.Name;
            if (string.IsNullOrEmpty(useBusinessmanCode))
            {
                strMsg = "分配商户号或者商户名称不存在!";
            }
            if (string.IsNullOrEmpty(strMsg))
            {
                string StartCode = startTripNumber.Substring(0, 6);
                string start     = startTripNumber.Substring(6, 4);
                string end       = endTripNumber.Substring(6, 4);
                tripRemark = tripRemark.Replace("'", "");
                //分配行程单
                dataCount = unitOfWorkRepository.ExecuteCommand(
                    "EXEC [dbo].[TravelPaperImport] @p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12 ",
                    "0",
                    StartCode,
                    start,
                    end,
                    useOffice,
                    iataCode,
                    ticketCompanyName,
                    BusinessmanCode,
                    BusinessmanName,
                    useBusinessmanCode,
                    useBusinessmanName,
                    tripRemark,
                    ""
                    );
                if (dataCount > 0)
                {
                    TravelGrantRecord travelGrantRecord = new TravelGrantRecord();
                    travelGrantRecord.BusinessmanCode    = BusinessmanCode;
                    travelGrantRecord.BusinessmanName    = BusinessmanName;
                    travelGrantRecord.UseBusinessmanCode = useBusinessmanCode;
                    travelGrantRecord.UseBusinessmanName = useBusinessmanName;
                    travelGrantRecord.GrantTime          = System.DateTime.Now;
                    travelGrantRecord.Office             = useOffice;
                    travelGrantRecord.TripCount          = int.Parse(end) - int.Parse(start) + 1;
                    travelGrantRecord.TripScope          = startTripNumber + "-" + endTripNumber;
                    travelGrantRecord.TripRemark         = tripRemark;
                    //添加发放记录
                    unitOfWorkRepository.PersistCreationOf(travelGrantRecord);
                    unitOfWork.Commit();
                }
            }
            if (!string.IsNullOrEmpty(strMsg))
            {
                throw new OrderCommException(strMsg);
            }
            return(dataCount);
        }
Example #12
0
 public void RegisterNew(IAggregateRoot entity, IUnitOfWorkRepository repository)
 {
     repository.PersistCreationOf(entity);
 }
Example #13
0
        /**
         * 1.NHibernate 的接口ISession(ISession x = SessionFactory.GetCurrentSession();)
         * 实现了UnitOfWork模式,所以在实物提交前不可能与任何的修改。
         *
         * 2.NHibernate内置另一个模式IdentityMap,负责在ISession中维护业务实体的唯一实例。
         */

        public void RegisterAmended(IAggregateRoot entity,
                                    IUnitOfWorkRepository unitofWorkRepository)
        {
            unitofWorkRepository.PersistCreationOf(entity);
        }
        public void AddLocalPolicy(RequestNormalPolicy policy)
        {
            var currentUser = AuthManager.GetCurrentUser();
            var builder     = AggregationFactory.CreateBuiler <LocalPolicyBuilder>();
            var localPolicy = builder.CreateLocalNormalPolicy(Mapper.Map <RequestNormalPolicy, LocalNormalPolicy>(policy));

            localPolicy.CreateMan = currentUser.OperatorName;
            localPolicy.RoleType  = currentUser.Type;
            localPolicy.Code      = currentUser.Code;
            if (currentUser.Type == "Supplier")
            {
                localPolicy.CarrierCode = currentUser.CarrierCode;
                var bm = this.businessmanRepository.FindAllNoTracking(p => p.Code == currentUser.CarrierCode).OfType <Carrier>().FirstOrDefault();
                if (bm != null)
                {
                    localPolicy.CarrierWeek             = bm.RestWork.WeekDay;
                    localPolicy.Carrier_AnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_ReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.WorkOnLineTime,
                        EndTime   = bm.NormalWork.WorkUnLineTime
                    };
                    localPolicy.Carrier_WeekAnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekWorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.WorkOnLineTime,
                        EndTime   = bm.RestWork.WorkUnLineTime
                    };
                }
                var supbm = this.businessmanRepository.FindAllNoTracking(p => p.Code == currentUser.Code).OfType <Supplier>().FirstOrDefault();
                if (supbm != null)
                {
                    localPolicy.SupplierWeek    = supbm.SupRestWork.WeekDay;
                    localPolicy.AnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupNormalWork.ServiceOnLineTime,
                        EndTime   = supbm.SupNormalWork.ServiceUnLineTime
                    };;
                    localPolicy.ReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupNormalWork.ServiceOnLineTime,
                        EndTime   = supbm.SupNormalWork.ServiceUnLineTime
                    };;
                    localPolicy.WorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupNormalWork.WorkOnLineTime,
                        EndTime   = supbm.SupNormalWork.WorkUnLineTime
                    };
                    localPolicy.WeekAnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupRestWork.ServiceOnLineTime,
                        EndTime   = supbm.SupRestWork.ServiceUnLineTime
                    };;
                    localPolicy.WeekReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupRestWork.ServiceOnLineTime,
                        EndTime   = supbm.SupRestWork.ServiceUnLineTime
                    };;
                    localPolicy.WeeKWorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupRestWork.WorkOnLineTime,
                        EndTime   = supbm.SupRestWork.WorkUnLineTime
                    };
                }
            }
            else
            {
                localPolicy.CarrierCode = currentUser.Code;
                var bm = this.businessmanRepository.FindAllNoTracking(p => p.Code == currentUser.Code).OfType <Carrier>().FirstOrDefault();
                if (bm != null)
                {
                    localPolicy.CarrierWeek             = bm.RestWork.WeekDay;
                    localPolicy.Carrier_AnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_ReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.WorkOnLineTime,
                        EndTime   = bm.NormalWork.WorkUnLineTime
                    };
                    localPolicy.Carrier_WeekAnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekWorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.WorkOnLineTime,
                        EndTime   = bm.RestWork.WorkUnLineTime
                    };
                }
            }
            unitOfWorkRepository.PersistCreationOf(localPolicy);
            unitOfWork.Commit();
        }