Ejemplo n.º 1
0
        public SwiftpassPayController(ICommunityService communityService
                                      //, IOptions<SwiftpassPayOptions> options
                                      , FinanceDbContext db
                                      , IOptions <ShopConglomerationOrderOptions> shopConglomerationOrderServer
                                      , PayProxyFactory proxyFactory
                                      , WechatCoreDbContext wechatCoreDb
                                      , PrintDbContext printDbContext
                                      , ShopDbContext shopdb
                                      , MemberDbContext memberDbContext
                                      , ILoggerFactory loggerFactory
                                      , IOptions <WechatTemplateSendOptions> woptions
                                      , IOptions <ThirdConfig> toptions


                                      , IHostingEnvironment hostingEnvironment)
        {
            this.hostingEnvironment = hostingEnvironment;
            this.woptions           = woptions.Value;
            //this.options = options.Value;
            // this.db = ZRui.Web.BLL.DbContextFactory.FinanceDbContext;
            this.db               = db;
            this.shopdb           = shopdb;
            this.printDbContext   = printDbContext;
            this.wechatCoreDb     = wechatCoreDb;
            this.proxyFactory     = proxyFactory;
            this._memberDbContext = memberDbContext;

            _shopConglomerationOrderServer = shopConglomerationOrderServer.Value;
            _logger          = loggerFactory.CreateLogger <SwiftpassPayController>();
            this.thirdConfig = toptions.Value;
        }
        public int Insert(MemberViewModel fromUI, string userId)
        {
            var result = 0;

            fromUI.CreateDateTime = this.TimeNow.Value;
            fromUI.CreateUserId   = userId;

            var memberTodB    = new Member();
            var memberLogToDb = new MemberLog();
            var identityToDb  = new Identity();
            var roleToDb      = new Role();

            Mapper.Map(fromUI, memberTodB);
            Mapper.Map(fromUI, memberLogToDb);
            Mapper.Map(fromUI, identityToDb);
            roleToDb = MapperRole(fromUI);

            memberLogToDb.Member_Id = memberTodB.Id;

            identityToDb.Member_Id = memberTodB.Id;


            using (var dbContext = MemberDbContext.CreateContext())
            {
                dbContext.Member.Add(memberTodB);
                dbContext.MemberLog.Add(memberLogToDb);
                dbContext.Role.Add(roleToDb);
                dbContext.Identity.Add(identityToDb);


                result = dbContext.SaveChanges();
            }

            return(result);
        }
Ejemplo n.º 3
0
 public ShopBrandCommodityCategorySetAPIController(ICommunityService communityService
                                                   , IOptions <MemberAPIOptions> options
                                                   , MemberDbContext memberDb
                                                   , ShopDbContext db)
     : base(options, db, memberDb)
 {
 }
Ejemplo n.º 4
0
 public ShopManagerApiControllerBase(IOptions <MemberAPIOptions> options
                                     , ShopDbContext db, MemberDbContext memberDb)
 {
     _options      = _options = options.Value;
     this.db       = db;
     this.memberDb = memberDb;
 }
Ejemplo n.º 5
0
        public static void BeforeTestRun()
        {
            var instance = SqlProviderServices.Instance;

            Mapper.Initialize(p => p.AddProfile(new DefaultMappingProfile()));
            using (var dbContext = MemberDbContext.CreateContext())
            {
                if (dbContext.Database.Exists())
                {
                    dbContext.Database.Delete();
                }

                dbContext.Database.Initialize(true);


                var CompanyConfing = dbContext.CompanyConfing.Where(p => p.CompanyId == "DDMC").ToList();

                if (CompanyConfing.Count == 0)
                {
                    var CompanyData = new CompanyConfing();

                    CompanyData.CompanyId = "DDMC";
                    CompanyData.Name      = "鼎鼎企業管理股份有限公司";

                    dbContext.CompanyConfing.Add(CompanyData);
                    dbContext.SaveChanges();
                }
            }
        }
        public int Delete(MemberViewModel fromUI, string userId)
        {
            var result = 0;

            var memberToDb    = new Member();
            var memberLogToDb = new MemberLog();

            Mapper.Map(fromUI, memberToDb);
            Mapper.Map(fromUI, memberLogToDb);


            memberLogToDb.CreateUserId       = null;
            memberLogToDb.CreateDateTime     = null;
            memberLogToDb.LastModifyUserId   = null;
            memberLogToDb.LastModifyDateTime = null;
            memberLogToDb.DeleteUserId       = userId;
            memberLogToDb.DeleteDateTime     = this.TimeNow.Value;
            memberLogToDb.Id        = Guid.NewGuid();
            memberLogToDb.Member_Id = fromUI.Id;

            using (var dbContext = MemberDbContext.CreateContext())
            {
                dbContext.Member.Attach(memberToDb);

                var memberEntry = dbContext.Entry(memberToDb);
                memberEntry.State = EntityState.Deleted;

                dbContext.MemberLog.Add(memberLogToDb);
                result = dbContext.SaveChanges();
            }

            return(result);
        }
Ejemplo n.º 7
0
 public MemberController(ICommunityService communityService
                         , IOptions <MemberAPIOptions> options
                         , MemberDbContext memberDb
                         , ILoggerFactory loggerFactory)
     : base(communityService, options, memberDb)
 {
 }
Ejemplo n.º 8
0
 public ShopBrandCommodityCategorySetController(ICommunityService communityService
                                                , IOptions <MemberAPIOptions> options
                                                , MemberDbContext memberDb
                                                , IHostingEnvironment hostingEnvironment)
     : base(communityService, options, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
 }
        public MainWindow(MemberDbContext dbContext)
        {
            this.dbContext = dbContext;

            InitializeComponent();

            GetMembers();
        }
Ejemplo n.º 10
0
 public ShopCallingQueueProductSetController(ICommunityService communityService
                                             , IOptions <MemberAPIOptions> options
                                             , MemberDbContext memberDb
                                             , IHostingEnvironment hostingEnvironment)
     : base(communityService, options, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 11
0
 public CommercialDistrictShopSetController(ICommunityService communityService
                                            , IOptions <MemberAPIOptions> options
                                            , MemberDbContext memberDb
                                            , IHostingEnvironment hostingEnvironment)
     : base(communityService, options, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 12
0
 public MemberSetController(ICommunityService communityService
                            , IOptions <MemberAPIOptions> options
                            , MemberDbContext memberDb
                            , ILoggerFactory loggerFactory)
     : base(communityService, options, memberDb)
 {
     _logger = loggerFactory.CreateLogger <MemberSetController>();
 }
Ejemplo n.º 13
0
 public CommunityApiControllerBase(ICommunityService communityService
                                   , IOptions <MemberAPIOptions> options
                                   , MemberDbContext memberDb)
 {
     _communityService = communityService;
     _options          = _options = options.Value;
     this.memberDb     = memberDb;
 }
Ejemplo n.º 14
0
 public ShopBrandSetAPIController(ICommunityService communityService
                                  , IOptions <MemberAPIOptions> options
                                  , ShopDbContext db
                                  , MemberDbContext memberDb
                                  , IHostingEnvironment hostingEnvironment)
     : base(options, db, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 15
0
 public WechatApiControllerBase(IOptions <MemberAPIOptions> options
                                , MemberDbContext memberDb
                                , WechatCoreDbContext wechatCoreDb
                                )
 {
     _options          = options.Value;
     this.memberDb     = memberDb;
     this.wechatCoreDb = wechatCoreDb;
 }
Ejemplo n.º 16
0
 public int NewMembersToday()
 {
     using (var dbContext = new MemberDbContext())
     {
         var startTime = DateTime.Now.DayZero();
         var endTime   = DateTime.Now.DayEnd();
         return(dbContext.Members.Count(m => m.CreateTime >= startTime && m.CreateTime <= endTime));
     }
 }
Ejemplo n.º 17
0
        public static Guid TestComapnyData()
        {
            using (var dbContext = MemberDbContext.CreateContext())
            {
                var compnayConfig = dbContext.CompanyConfing.Where(p => p.CompanyId == "DDMC").FirstOrDefault().Id;

                return(compnayConfig);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wechatOptions"></param>
        /// <param name="wechatCoreDb"></param>
        /// <param name="communityService"></param>
        /// <param name="options"></param>
        /// <param name="context"></param>
        /// <param name="loggerFactory"></param>
        public WechatCoreController(IOptions <WechatOptions> wechatOptions, WechatCoreDbContext wechatCoreDb, ICommunityService communityService, IOptions <MemberAPIOptions> options, MemberDbContext context, ILoggerFactory loggerFactory)
        {
            this.wechatCoreDb = wechatCoreDb;

            _logger            = loggerFactory.CreateLogger <CommunityAPIController>();
            _communityService  = communityService;
            _context           = context;
            this.wechatOptions = wechatOptions.Value;
        }
Ejemplo n.º 19
0
 public ShopIntegralRechargeServer(
     IOptions <MemberAPIOptions> options
     , ShopDbContext db
     , ILoggerFactory loggerFactory
     , MemberDbContext memberDb
     )
 {
     this.db = db;
     _logger = loggerFactory.CreateLogger <ShopIntegralRechargeServer>();
 }
Ejemplo n.º 20
0
 public SettingBaseSetAPIControllerBase(ICommunityService communityService
                                        , IOptions <MemberAPIOptions> options
                                        , MemberDbContext memberDb
                                        , IDbContextFactory dbFactory
                                        , IHostingEnvironment hostingEnvironment)
     : base(communityService, options, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
     this.dbFactory          = dbFactory;
 }
Ejemplo n.º 21
0
 public MemberAPIController(ICommunityService communityService
                            , MemberDbContext memberDb
                            , IOptions <MemberAPIOptions> options
                            , IHostingEnvironment hostingEnvironment
                            , ILoggerFactory loggerFactory)
     : base(communityService, options, memberDb)
 {
     _logger = loggerFactory.CreateLogger <MemberAPIController>();
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 22
0
 public RobotMessageSetAPIController(ICommunityService communityService
                                     , IOptions <MemberAPIOptions> options
                                     , WechatCoreDbContext wechatCoreDb
                                     , MemberDbContext memberDb
                                     , ILoggerFactory loggerFactory)
     : base(communityService, options, memberDb)
 {
     this.wechatCoreDb = wechatCoreDb;
     _logger           = loggerFactory.CreateLogger <RobotMessageSetAPIController>();
 }
Ejemplo n.º 23
0
 public ShopBookingSetAPIController(ICommunityService communityService
                                    , IOptions <MemberAPIOptions> options
                                    , MemberDbContext memberDb
                                    , ShopDbContext db
                                    , IHostingEnvironment hostingEnvironment)
     : base(communityService, options, memberDb)
 {
     this.db = db;
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 24
0
 public static void AfterTestRun()
 {
     using (var dbContext = MemberDbContext.CreateContext())
     {
         if (dbContext.Database.Exists())
         {
             dbContext.Database.Delete();
         }
     }
 }
        public int Update(MemberViewModel fromUI, string userId)
        {
            var result = 0;

            fromUI.LastModifyDateTime = this.TimeNow.Value;
            fromUI.LastModifyUserId   = userId;

            var memberToDb    = new Member();
            var memberLogToDb = new MemberLog();
            var identityToDb  = new Identity();
            var roleToDb      = new Role();

            Mapper.Map(fromUI, memberToDb);
            Mapper.Map(fromUI, identityToDb);
            Mapper.Map(fromUI, memberLogToDb);

            roleToDb = MapperRole(fromUI);
            roleToDb.LastModifyDateTime = this.TimeNow.Value;
            roleToDb.LastModifyUserId   = userId;

            memberLogToDb.Member_Id = memberToDb.Id;
            identityToDb.Member_Id  = memberToDb.Id;
            memberLogToDb.Id        = Guid.NewGuid();

            memberLogToDb.CreateUserId   = null;
            memberLogToDb.CreateDateTime = null;

            using (var dbContext = MemberDbContext.CreateContext())
            {
                /* dbContext.Member.Attach(memberToDb);
                 * dbContext.Identity.Attach(identityToDb);
                 * dbContext.Role.Attach(roleToDb);*/

                var memberEntry = dbContext.Entry(memberToDb);
                memberEntry.State = EntityState.Modified;
                memberEntry.Property(p => p.CreateUserId).IsModified   = false;
                memberEntry.Property(p => p.CreateDateTime).IsModified = false;

                var identityEntry = dbContext.Entry(identityToDb);
                identityEntry.State = EntityState.Modified;
                identityEntry.Property(p => p.CreateUserId).IsModified   = false;
                identityEntry.Property(p => p.CreateDateTime).IsModified = false;

                var roleEntry = dbContext.Entry(roleToDb);
                roleEntry.State = EntityState.Modified;
                roleEntry.Property(p => p.CreateUserId).IsModified   = false;
                roleEntry.Property(p => p.CreateDateTime).IsModified = false;


                dbContext.MemberLog.Add(memberLogToDb);
                result = dbContext.SaveChanges();
            }

            return(result);
        }
Ejemplo n.º 26
0
 public MemberAmountCacheForWechatAPIController(
     IOptions <MemberAPIOptions> options
     , FinanceDbContext db
     , MemberDbContext memberDb
     , WechatCoreDbContext wechatCoreDb
     , IHostingEnvironment hostingEnvironment)
     : base(options, memberDb, wechatCoreDb)
 {
     this.db = db;
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 27
0
 public ShopMemberSetAPIController(ICommunityService communityService
                                   , IOptions <MemberAPIOptions> options
                                   , MemberDbContext memberDb
                                   , ShopDbContext db
                                   , IMapper mapper
                                   , IHostingEnvironment hostingEnvironment)
     : base(options, db, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
     _mapper = mapper;
 }
Ejemplo n.º 28
0
 public ShopCommentAPIController(ICommunityService communityService
                                 , IOptions <MemberAPIOptions> memberOptions
                                 , ShopDbContext db
                                 , WechatCoreDbContext wechatCoreDb
                                 , MemberDbContext memberDb
                                 , IHostingEnvironment hostingEnvironment)
     : base(memberOptions, memberDb, wechatCoreDb)
 {
     this.db = db;
     this.hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// 会员后台管理获取用户信息
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <param name="expression"></param>
 /// <param name="orderByExpression"></param>
 /// <param name="isDesc"></param>
 /// <param name="totalCount"></param>
 /// <returns></returns>
 public List <MemberFull> GetMemberFullListPaged <TKey>(int pageIndex, int pageSize, Expression <Func <MemberFull, bool> > expression, Expression <Func <MemberFull, TKey> > orderByExpression, bool isDesc, out int totalCount)
 {
     using (var dbContext = new MemberDbContext())
     {
         totalCount = dbContext.MembersFull.AsExpandable().Where(expression).Count(); //获取总数
                                                                                      //需要增加AsExpandable(),否则查询的是所有数据到内存,然后再排序  AsExpandable是linqkit.dll中的方法
         var data        = dbContext.MembersFull.AsExpandable().Where(expression);
         var orderedData = isDesc ? data.OrderByDescending(orderByExpression) : data.OrderBy(orderByExpression);
         return(orderedData.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList());
     }
 }
Ejemplo n.º 30
0
 public ShopWechatOpenSetController(IOptions <MemberAPIOptions> options
                                    , ShopDbContext db
                                    , MemberDbContext memberDb
                                    , IOptions <WechatOpenOptions> wechatOpenOptions
                                    , ILoggerFactory loggerFactory
                                    , IHostingEnvironment hostingEnvironment)
     : base(options, db, memberDb)
 {
     this.hostingEnvironment = hostingEnvironment;
     this.wechatOpenOptions  = wechatOpenOptions.Value;
     logger = loggerFactory.CreateLogger <ShopWechatOpenSetController>();
 }