예제 #1
0
        // 注册模拟器主机
        public static int RegSimulationHost(string hostName, string hostIP, string simulationType, string licensePath, string simulationPath, string hostKey)
        {
            int nRet = 0;

            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(Client.customBinding, Client.RemoteAddress))
                {
                    Client.SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    string sRet = proxy.RegSimulationHost(Client.LoginID.ToString(), Client.gUserName, hostName, hostIP, simulationType, licensePath, simulationPath, hostKey);

                    if (sRet == "success")
                    {
                        nRet = 1;
                    }
                }
            }
            catch (System.Exception ex)
            {
            }

            return(nRet);
        }
예제 #2
0
        public static int DeleteUser(string userIDs)
        {
            int nRet = 0;

            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    string deleteUserRet = proxy.DeleteUser(LoginID.ToString(), userIDs);

                    if (deleteUserRet != "0")
                    {
                        nRet = 1;
                    }
                }
            }
            catch (System.Exception ex)
            {
            }

            return(nRet);
        }
 public PaymentController(DapperService dapperService, IPaymentService paymentService,
                          ICenterService centerService)
 {
     _dapperService  = dapperService;
     _centerService  = centerService;
     _paymentService = paymentService;
 }
예제 #4
0
        public async Task Index_ReturnsCorrectView()
        {
            var list = new List <BasicCenter>()
            {
                new BasicCenter {
                    Center = "Columbus", SygmaCenterNo = 22
                }, new BasicCenter {
                    Center = "Denver", SygmaCenterNo = 8
                }
            }.Cast <BasicCenter>().ToList();

            _centerServiceMock = new Mock <ICenterService>();
            _centerServiceMock.Setup(r => r.GetAll(It.IsAny <string>())).Returns(Task.FromResult(list));
            _centerServiceMock.Setup(r => r.GetLocationByNoAsync(5)).Throws(new KeyNotFoundException());
            _centerServiceMock.Setup(r => r.GetLocationByNoAsync(22)).Returns(Task.FromResult(new CenterLocation {
                SygmaCenterNo = 22, Description = "Columbus"
            }));
            _centerService = _centerServiceMock.Object;
            RouteManagerController controller = new RouteManagerController(null, _centerService, null, null)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = _contextMock.Object
                }
            };

            ViewResult result = await controller.Index() as ViewResult;

            var model = result.ViewData.Model as RouteManagerViewModel;

            Assert.IsTrue(string.IsNullOrEmpty(result.ViewName));
            Assert.IsNotNull(model);
            Assert.IsTrue(model.CenterSelectList.Count() == 2);
        }
예제 #5
0
        // 删除指定配置文件
        public static int DeleteExtraConfig(string configIDs)
        {
            int nRet = 0;

            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(Client.customBinding, Client.RemoteAddress))
                {
                    Client.SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    string sRet = proxy.DeleteExtraConfig(Client.LoginID.ToString(), configIDs);

                    if (sRet != "0")
                    {
                        nRet = 1;
                    }
                }
            }
            catch (System.Exception ex)
            {
            }

            return(nRet);
        }
예제 #6
0
 public MembershipManagementBaseService(IMemberService memberService, ICenterService centerService, IRelationTypeService relationTypeService, IRelationRuleService relationRuleService)
 {
     _memberService       = memberService;
     _centerService       = centerService;
     _relationTypeService = relationTypeService;
     _relationRuleService = relationRuleService;
 }
예제 #7
0
 public UserController(IUserService userService, UserManager <ApplicationUser> userManager,
                       ICenterService centerService)
 {
     this.userService   = userService;
     this.centerService = centerService;
     this.userManager   = userManager;
 }
예제 #8
0
 public CenterProductService(IUnitOfWork unitOfWork,
                             ICenterProductFactory centerProductFactory,
                             ICenterService centerService)
 {
     this.centerProductFactory = centerProductFactory;
     this.unitOfWork           = unitOfWork;
     this.centerService        = centerService;
 }
예제 #9
0
 public CenterController(IEmployeeService employeeService, ICenterService centerService,
                         INetworkCenterService networkCenterService)
     : base(employeeService)
 {
     this._centerService   = centerService;
     this._employeeService = employeeService;
     _networkCenterService = networkCenterService;
 }
 public PayScaleController(
     IAuthorizationService authorizationService,
     ICenterService centerService,
     IPayScaleService payScaleScaleService) : base(authorizationService)
 {
     CenterService   = centerService;
     PayScaleService = payScaleScaleService;
 }
예제 #11
0
 public CodeController(IEmployeeService employeeService, ICodeService codeService,
                       ICenterService centerService)
     : base(employeeService)
 {
     _codeService     = codeService;
     _employeeService = employeeService;
     _centerService   = centerService;
 }
 public RequestService(ApplicationDbContext dbContext, IUserService userService,
                       ICenterService centerService, INotificationService notificationService)
 {
     this.dbContext           = dbContext;
     this.userService         = userService;
     this.centerService       = centerService;
     this.notificationService = notificationService;
 }
예제 #13
0
 public RegisterBase(UserService userService, ILoginService loginService, NavigationManager navigationManager,
                     ICenterService centerService, IJSRuntime jsRuntime)
 {
     this.userService       = userService;
     this.loginService      = loginService;
     this.navigationManager = navigationManager;
     this.centerService     = centerService;
     this.jsRuntime         = jsRuntime;
 }
예제 #14
0
 public RouteManagerController(
     IRouteService routeService,
     ICenterService centerService,
     ILookUpService lookUpService,
     IAuthorizationService authorizationService) : base(authorizationService)
 {
     RouteService  = routeService;
     CenterService = centerService;
     LookUpService = lookUpService;
 }
 public PaymentService(FrontAppDbContext dbContext, IWebHostEnvironment hostingEnvironment, DapperService dapperService, HttpClient httpClient,
                       IConfiguration configuration, ICenterService centerService)
 {
     this.dbContext          = dbContext;
     this.hostingEnvironment = hostingEnvironment;
     Configuration           = configuration;
     this.dapperService      = dapperService;
     this.httpClient         = httpClient;
     _centerService          = centerService;
 }
예제 #16
0
        // 不定时验证服务器
        public static int Verify()
        {
            int nVerify = 0;

            if (gVerifyModuleNames == null || gVerifyModuleNames == "")
            {
                return(nVerify);
            }

            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    string verifyString = string.Format("{0};{1};{2};{3};{4};{5};{6};{7};",
                                                        LoginID, GetLocalIP(), gUserName, gAppName, gVerifyModuleNames, gModuleVersion, gKeyInfo, gClientHost);

                    string verifyRet = proxy.Verify(verifyString);

                    if (verifyRet == "Success")
                    {
                        nVerify = 1;
                    }
                    else
                    {
                        ErrorInfo = string.Format("服务器连接验证失败!\n\n错误信息:{0} \n请确认后再重试。", verifyRet);
                    }
                }
            }
            catch (System.Exception ex)
            {
                ErrorInfo = string.Format("服务器连接验证失败!\n\n错误信息:{0}\n请确认后再重试。", ex.Message);
            }


            if (clientEvent != null)
            {
                if (nVerify == 1)
                {
                    clientEvent.doEvent(ClientEvent.LicenseSucceed);
                }
                else
                {
                    clientEvent.doEvent(ClientEvent.LicenseFailed);
                }
            }

            return(nVerify);
        }
 public RegistrationEntranceFormBase(IWebHostEnvironment hostingEnvironment, ICenterService centerService,
                                     ProtectedSessionStorage protectedSessionStorage, UserManager <ApplicationUser> userManager, HttpClient httpClient,
                                     IJSRuntime js, DapperService dapperService, IPaymentService paymentService)
 {
     _paymentService         = paymentService;
     _hostingEnvironment     = hostingEnvironment;
     _httpClient             = httpClient;
     CenterService           = centerService;
     ProtectedSessionStorage = protectedSessionStorage;
     UserManager             = userManager;
     Js = js;
     this.dapperService = dapperService;
 }
예제 #18
0
        public static void DeleteUserGroup(string userGroupID)
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();
                    proxy.DeleteUserGroup(userGroupID);
                }
            }
            catch (System.Exception ex)
            {
            }
        }
예제 #19
0
        public static void AddLicenseToConfig(string licenseFile)
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();
                    proxy.AddLicenseToConfig(LoginID.ToString(), licenseFile);
                }
            }
            catch (System.Exception ex)
            {
            }
        }
예제 #20
0
        public static void UpdateUserGroup(string userGroupID, string groupName, string ipRanges, string allowApps, string roles)
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();
                    proxy.UpdateUserGroup(userGroupID, groupName, ipRanges, allowApps, roles);
                }
            }
            catch (System.Exception ex)
            {
            }
        }
예제 #21
0
 public PostService(
     IMapper mapper,
     IMembershipManagementBaseService membershipManagementService,
     ITagService tagService,
     IPeopleService peopleService,
     MyDbContext context, IVideoService videoService, IImageService imageService, ICenterService centerService, ICategoryService CategoryService, ICommentService commentService) : base(context)
 {
     _mapper        = mapper;
     _context       = context;
     _videoService  = videoService;
     _imageService  = imageService;
     _centerService = centerService;
     _membershipManagementService = membershipManagementService;
     _tagService      = tagService;
     _peopleService   = peopleService;
     _categoryService = CategoryService;
     _commentService  = commentService;
 }
예제 #22
0
        // 获取授权服务器配置信息
        public static string GetServerInfo()
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();
                    return(proxy.GetServerInfo(LoginID.ToString()));
                }
            }
            catch (System.Exception ex)
            {
            }

            return("");
        }
예제 #23
0
        // 获取配置文件
        public static string GetExtraConfigFile(string configID)
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(Client.customBinding, Client.RemoteAddress))
                {
                    Client.SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    return(proxy.GetExtraConfigFile(Client.LoginID.ToString(), configID));
                }
            }
            catch (System.Exception ex)
            {
            }

            return("");
        }
예제 #24
0
        public static List <string> GetLicenseApps()
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy       = channelFactory.CreateChannel();
                    List <string>  licenseApps = proxy.GetLicenseApps(LoginID.ToString());
                    return(licenseApps);
                }
            }
            catch (System.Exception ex)
            {
            }

            return(null);
        }
예제 #25
0
        // 获取模拟器主机列表
        public static System.Data.DataTable GetSimulationHostList(string simulatonType = "")
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(Client.customBinding, Client.RemoteAddress))
                {
                    Client.SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    return(proxy.GetSimulationHostList(Client.LoginID.ToString(), simulatonType));
                }
            }
            catch (System.Exception ex)
            {
            }

            return(null);
        }
예제 #26
0
        public static System.Data.DataTable GetRoles()
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService        proxy     = channelFactory.CreateChannel();
                    System.Data.DataTable UserRoles = proxy.GetRoles(LoginID.ToString());
                    return(UserRoles);
                }
            }
            catch (System.Exception ex)
            {
            }

            return(null);
        }
예제 #27
0
        // 获取模拟器主机许可文件路径
        public static string GetSimulationHostLicensePath(string simulationHostID)
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(Client.customBinding, Client.RemoteAddress))
                {
                    Client.SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    return(proxy.GetSimulationHostLicensePath(Client.LoginID.ToString(), simulationHostID));
                }
            }
            catch (System.Exception ex)
            {
            }

            return("");
        }
예제 #28
0
 public UserService(UserManager <ApplicationUser> userManager,
                    IConfiguration configuration, IDataProtectionProvider dataProtectionProvider, DataProtectionPurposeStrings dataProtectionPurposeStrings,
                    IHttpContextAccessor httpContextAccessor, FrontAppDbContext dbContext, SignInManager <ApplicationUser> signInManager,
                    RoleManager <IdentityRole> roleManager, AuthenticationStateProvider authenticationStateProvider,
                    IPasswordHasher <ApplicationUser> passwordHasher, ICenterService centerService, ITokenService tokenService,
                    DapperService dapperService)
 {
     _userManager                 = userManager;
     _configuration               = configuration;
     _httpContextAccessor         = httpContextAccessor;
     _dbContext                   = dbContext;
     _signInManager               = signInManager;
     _roleManager                 = roleManager;
     _authenticationStateProvider = authenticationStateProvider;
     _passwordHasher              = passwordHasher;
     _centerService               = centerService;
     _tokenService                = tokenService;
     _dapperService               = dapperService;
     _dataProtector               = dataProtectionProvider.CreateProtector(dataProtectionPurposeStrings.RouteValue);
 }
예제 #29
0
        public static System.Data.DataTable GetOnlineUsers(bool bAllLogin = false)
        {
            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService        proxy       = channelFactory.CreateChannel();
                    System.Data.DataTable onlineUsers = proxy.GetOnlineUsers(LoginID.ToString(), bAllLogin);
                    return(onlineUsers);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(null);
        }
예제 #30
0
        // 退出服务器
        public static int Logout()
        {
            int nLogout = 0;

            try
            {
                using (ChannelFactory <ICenterService> channelFactory = new ChannelFactory <ICenterService>(customBinding, RemoteAddress))
                {
                    SetMaxItemsInObjectGraph(channelFactory);

                    ICenterService proxy = channelFactory.CreateChannel();

                    string logoutString = string.Format("{0};{1};{2};{3};{4};{5};",
                                                        LoginID, gAppName, gModuleName, gModuleVersion, gKeyInfo, gClientHost);

                    nLogout = proxy.Logout(logoutString);
                }
            }
            catch (System.Exception ex)
            {
            }

            return(nLogout);
        }