Exemplo n.º 1
0
 public ManagerImporter(IUnitOfWork unitOfWork, IMapper mapper, IAccountHelper accountHelper)
 {
     _unitOfWork      = unitOfWork;
     _mapper          = mapper;
     _accountHelper   = accountHelper;
     _telemetryClient = new TelemetryClient();
 }
Exemplo n.º 2
0
        private string GetDepartmentSN(string departID)
        {
            IAccountHelper helper = AccountFactory.CreateInstance();
            Department     depart = helper.GetDepartment(departID, null);

            return(depart != null ? depart.Number : String.Empty);
        }
Exemplo n.º 3
0
        public void TestFixtureSetUp()
        {
            try
            {
                CodeSharp.Core.Configuration.ConfigWithEmbeddedXml(null
                    , "application_config"
                    , Assembly.GetExecutingAssembly()
                    , "AliCooper.Model.Test.ConfigFiles")
                    .RenderProperties()
                    .Castle(o => this.Resolve(o.Container));

                //初始化同步锁
                DependencyResolver.Resolve<ILockHelper>().Init<Account>();
                DependencyResolver.Resolve<ILockHelper>().Init<GoogleConnection>();

                DependencyResolver.Resolve<ILockHelper>().Init<ArkConnection>();
            }
            catch (InvalidOperationException e)
            {
                if (!e.Message.Contains("不可重复初始化配置"))
                    Console.WriteLine(e.Message);
            }

            this._log = DependencyResolver.Resolve<ILoggerFactory>().Create(this.GetType());
            this._sessionManager = DependencyResolver.Resolve<Castle.Facilities.NHibernateIntegration.ISessionManager>();

            this._accountHelper = DependencyResolver.Resolve<IAccountHelper>();
            this._accountService = DependencyResolver.Resolve<IAccountService>();
            this._accountConnectionService = DependencyResolver.Resolve<IAccountConnectionService>();
            this._taskService = DependencyResolver.Resolve<ITaskService>();
        }
 public AuthorizationController(PlasticFreeOceanContext context, IConfiguration config, UserManager <User> userManager, IAccountHelper accountHelper)
 {
     _context       = context;
     _accountHelper = accountHelper;
     _userManager   = userManager;
     _config        = config;
 }
Exemplo n.º 5
0
        public void TestFixtureSetUp()
        {
            Configuration.ConfigWithEmbeddedXml(null, "application_config", Assembly.GetExecutingAssembly(), "Cooper.Sync.Test.ConfigFiles")
            .RenderProperties()
            .Castle(resolver => Resolve(resolver.Container));

            //初始化同步锁
            DependencyResolver.Resolve <ILockHelper>().Init <Account>();
            DependencyResolver.Resolve <ILockHelper>().Init <GoogleConnection>();

            _logger         = DependencyResolver.Resolve <ILoggerFactory>().Create(GetType());
            _sessionManager = DependencyResolver.Resolve <ISessionManager>();

            _accountHelper            = DependencyResolver.Resolve <IAccountHelper>();
            _accountService           = DependencyResolver.Resolve <IAccountService>();
            _accountConnectionService = DependencyResolver.Resolve <IAccountConnectionService>();
            _taskService             = DependencyResolver.Resolve <ITaskService>();
            _externalServiceProvider = DependencyResolver.Resolve <IExternalServiceProvider>();
            _googleTokenService      = DependencyResolver.Resolve <IGoogleTokenService>();

            _syncProcessor = DependencyResolver.Resolve <IGoogleSyncProcesser>();

            GoogleSyncSettings.ClientIdentifier = "234919028272-gsmmng06nheoih4ajp60oq8s33at1os0.apps.googleusercontent.com";
            GoogleSyncSettings.ClientSecret     = "jXcjxFzCQGferMI37I0GSc05";
        }
Exemplo n.º 6
0
        public void TestFixtureSetUp()
        {
            Configuration.ConfigWithEmbeddedXml(null, "application_config", Assembly.GetExecutingAssembly(), "Cooper.Sync.Test.ConfigFiles")
                .RenderProperties()
                .Castle(resolver => Resolve(resolver.Container));

            //初始化同步锁
            DependencyResolver.Resolve<ILockHelper>().Init<Account>();
            DependencyResolver.Resolve<ILockHelper>().Init<GoogleConnection>();

            _logger = DependencyResolver.Resolve<ILoggerFactory>().Create(GetType());
            _sessionManager = DependencyResolver.Resolve<ISessionManager>();

            _accountHelper = DependencyResolver.Resolve<IAccountHelper>();
            _accountService = DependencyResolver.Resolve<IAccountService>();
            _accountConnectionService = DependencyResolver.Resolve<IAccountConnectionService>();
            _taskService = DependencyResolver.Resolve<ITaskService>();
            _externalServiceProvider = DependencyResolver.Resolve<IExternalServiceProvider>();
            _googleTokenService = DependencyResolver.Resolve<IGoogleTokenService>();

            _syncProcessor = DependencyResolver.Resolve<IGoogleSyncProcesser>();

            GoogleSyncSettings.ClientIdentifier = "234919028272-gsmmng06nheoih4ajp60oq8s33at1os0.apps.googleusercontent.com";
            GoogleSyncSettings.ClientSecret = "jXcjxFzCQGferMI37I0GSc05";
        }
Exemplo n.º 7
0
        public override void InitControl()
        {
            hfValue.Value = lblValue.Text = (Value ?? "").ToString();
            IAccountHelper accountHelper = AccountFactory.CreateInstance();
            Account        account       = accountHelper.GetAccount(hfValue.Value, null);

            if (account == null)
            {
                ltlText.Text = "";
            }
            else
            {
                string data = Control.Params[We7.Model.Core.UI.Constants.DATA];
                if (!string.IsNullOrEmpty(data) && data == "admin")
                {
                    //ShopPlugin.AdvanceUser
                    DataTable dt = ModelDBHelper.Create("ShopPlugin.AdvanceUser").Query(new Criteria(CriteriaType.Equals, "UserID", hfValue.Value), new List <Order>()
                    {
                        new Order("ID", OrderMode.Desc)
                    }, 0, 0);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        ltlText.Text = "<a href='/admin/AddIns/ModelEditor.aspx?notiframe=1&model=ShopPlugin.AdvanceUser&ID=" + dt.Rows[0]["ID"].ToString() + "'>" + account.LoginName + "</a>";
                    }
                    else
                    {
                        ltlText.Text = "<a href='/admin/Permissions/AccountEdit.aspx?id=" + account.ID + "'>" + account.LoginName + "</a>";
                    }
                }
                else
                {
                    ltlText.Text = account.LoginName;
                }
            }
        }
Exemplo n.º 8
0
 public OrdersController(IUnitOfWork unitOfWork, IMapper mapper, IQueueStore queueStore, IAccountHelper accountHelper)
 {
     _orderImporter = new OrderImporter(unitOfWork, mapper);
     _unitOfWork    = unitOfWork;
     _mapper        = mapper;
     _queueStore    = queueStore;
     _accountHelper = accountHelper;
 }
Exemplo n.º 9
0
 public AccountController(IRepository <UserModel> userRepository,
                          IRepository <UserLoginModel> userLoginRepository,
                          IAccountHelper accountHelper)
 {
     _userRepository      = userRepository;
     _userLoginRepository = userLoginRepository;
     _accountHelper       = accountHelper;
 }
Exemplo n.º 10
0
 public UsersController(PlasticFreeOceanContext context, UserManager <User> userManager, IEmailService emailService, IAccountHelper accountHelper, IUnitOfWork <PlasticFreeOceanContext> unitOfWork)
 {
     _context       = context;
     _accountHelper = accountHelper;
     _userManager   = userManager;
     _emailService  = emailService;
     _unitOfWork    = unitOfWork;
 }
Exemplo n.º 11
0
        /// <summary>
        /// 通过Email发送密码信息
        /// </summary>
        /// <param name="account">权限信息</param>
        /// <param name="AccountHelper">权限业务对象</param>
        /// <returns></returns>
        public string SendPasswordByMail(Account account, IAccountHelper AccountHelper)
        {
            GeneralConfigInfo si = Config;

            if (si.SystemMail == "" || si.SysMailUser == "" || si.SysMailServer == "")
            {
                return("系统邮件信息不全,请到网站菜单“系统设置”中设置相关参数。");
            }
            else
            {
                MailHelper mailHelper = new MailHelper();
                mailHelper.AdminEmail = si.SystemMail;
                mailHelper.UserName   = si.SysMailUser;
                mailHelper.Password   = si.SysMailPassword;
                mailHelper.SmtpServer = si.SysMailServer;

                string password = null;
                if (account.IsPasswordHashed)
                {
                    password = Security.ResetPassword(account);

                    string secuPassword = "";
                    if (account.PasswordHashed == (int)We7.CMS.Common.Enum.TypeOfPasswordHashed.webEncrypt)
                    {
                        secuPassword = Security.Encrypt(password);
                    }
                    else if (account.PasswordHashed == (int)We7.CMS.Common.Enum.TypeOfPasswordHashed.bbsEncrypt)
                    {
                        secuPassword = Security.BbsEncrypt(password);
                    }
                    if (String.Compare(account.LoginName, SiteConfigs.GetConfig().AdministratorName, true) == 0)
                    {
                        //UpdateSystemParameter("CD.AdministratorKey", secuPassword);
                        SiteConfig.AdministratorKey = secuPassword;
                        SiteConfigs.SaveConfig(SiteConfig);
                    }
                    else
                    {
                        AccountHelper.UpdatePassword(account, secuPassword);
                    }
                }
                else
                {
                    password = account.Password;
                }

                string message = "亲爱的{0},您好:\r\n您的登录帐户:\r\n用户名: {3}\r\n密码: {1}\r\n\r\n{5}-{2}\r\n网站管理员\r\n{4}";

                string mainurl = SiteConfig.RootUrl;
                string To      = account.Email;
                string From    = string.Format("\"{1}系统邮件\" <{0}>", si.SystemMail, SiteConfig.SiteName);
                string Subject = "您的网站登录信息";
                string Body    = string.Format(message, account.LastName, password, mainurl, account.LoginName, DateTime.Now.ToLongDateString(), SiteConfig.SiteName);
                mailHelper.Send(To, From, Subject, Body, "");
                //Message.Text = "Login Credentials Sent<br>";
                return("新密码已发至你的邮箱");
            }
        }
Exemplo n.º 12
0
 public UserController(IUserHelper userHelper, IAccountHelper accountHelper, IResolutorFacade resolutorFacade, IFileService fileService, IHostingEnvironment environment, IMapper mapper)
 {
     this.resolutorFacade = resolutorFacade;
     this.userHelper      = userHelper;
     this.mapper          = mapper;
     this.fileService     = fileService;
     _hostingEnvironment  = environment;
     this.accountHelper   = accountHelper;
 }
Exemplo n.º 13
0
 void Signout()
 {
     if (Request["Authenticator"] == null)
     {
         IAccountHelper AccountHelper = AccountFactory.CreateInstance();
         string         result        = AccountHelper.SignOut();
         IsSignIn = false;
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// 取得部门名称
 /// </summary>
 /// <param name="fieldValue"></param>
 /// <returns></returns>
 protected string GetDepartName(object fieldValue)
 {
     if (fieldValue != null)
     {
         IAccountHelper helper = AccountFactory.CreateInstance();
         Department     depart = helper.GetDepartment(fieldValue.ToString(), new string[] { "Name" });
         return(depart != null ? depart.Name : String.Empty);
     }
     return(String.Empty);
 }
Exemplo n.º 15
0
 public AccountService(IAccountRepository accountRepository, ICardRepository cardRepository,
                       IAccountHelper accountHelper, ICardHelper cardHelper, ISmsService smsService, ICryptoHelper cryptoHelper)
 {
     _accountRepository = accountRepository;
     _cardRepository    = cardRepository;
     _accountHelper     = accountHelper;
     _cardHelper        = cardHelper;
     _cryptoHelper      = cryptoHelper;
     _smsService        = smsService;
 }
Exemplo n.º 16
0
        /// <summary>
        /// 验证用户
        /// </summary>
        void Authenticate()
        {
            if (String.Compare(LoginName, SiteConfigs.GetConfig().AdministratorName, false) == 0)
            {
                if (CDHelper.AdminPasswordIsValid(Password))
                {
                    Security.SetAccountID(We7Helper.EmptyGUID);
                    UserName = SiteConfigs.GetConfig().AdministratorName;
                    IsSignIn = true;
                }
                else
                {
                    IsSignIn = false;
                    Message  = "密码错误";
                }
            }
            else
            {
                if (Request["Authenticator"] != null && Request["accountID"] != null)
                {
                    SSORequest ssoRequest = SSORequest.GetRequest(HttpContext.Current);
                    string     actID      = ssoRequest.AccountID;
                    if (Authentication.ValidateEACToken(ssoRequest) && !string.IsNullOrEmpty(actID) && We7Helper.IsGUID(actID))
                    {
                        Security.SetAccountID(actID, IsPersist);
                        UserName = ssoRequest.UserName;
                        IsSignIn = true;
                    }
                    else if (Request["message"] != null)
                    {
                        Message  = Request["message"];
                        IsSignIn = false;
                        return;
                    }
                }
                else
                {
                    IAccountHelper AccountHelper = AccountFactory.CreateInstance();

                    string[] result = AccountHelper.Login(LoginName, Password);

                    if (result[0] == "false")
                    {
                        Message  = result[1];
                        IsSignIn = false;
                    }
                    else
                    {
                        IsSignIn = true;
                        UserName = AccountHelper.GetAccount(result[1], new string[] { "LoginName" }).LoginName;
                        Response.Redirect(ReturnUrl);
                    }
                }
            }
        }
Exemplo n.º 17
0
 public AddUserCommandHandler(
     IdentityB2CDbContext context,
     UserManager <User> userManager,
     IAccountHelper accountHelper,
     ITenantService tenantService)
 {
     this.context       = context;
     this.userManager   = userManager;
     this.accountHelper = accountHelper;
     this.tenantService = tenantService;
 }
Exemplo n.º 18
0
 public AddUserCommandHandler(
     Framework.Core.Security.IdentityUser identityUser,
     UserManager <User> userManager,
     IAccountHelper accountHelper,
     ITenantService tenantService)
 {
     this.identityUser  = identityUser;
     this.userManager   = userManager;
     this.accountHelper = accountHelper;
     this.tenantService = tenantService;
 }
Exemplo n.º 19
0
 public VoucherHelper(LedgerContext ledger,
                      ICacheHelper cache,
                      IAccountBookHelper acctBook,
                      HttpContextBase context,
                      IAccountHelper account)
 {
     _ledger   = ledger;
     _cache    = cache;
     _acctBook = acctBook;
     _context  = context;
     _account  = account;
 }
        public void Initialize()
        {
            _accountHelper = new RealAccountHelper();
            Guid validSessionId = _accountHelper.GenerateValidCredentials();

            _endpointHelper = new EndpointHelper();
            _endpointHelper.Setup()
            .SetAuthenticationToken(validSessionId.ToString())
            .AddHousehold(typeof(WhenTheUserIsValidAndDoesNotBelongToAHousehold).Name);

            _getHouseholdResponse = _endpointHelper.GetHousehold();
        }
Exemplo n.º 21
0
        public AccountController(ILoggerFactory factory
                                 , IContextService context
                                 , IAccountHelper accountHelper
                                 , IAccountService accountService
                                 , IAccountConnectionService accountConnectionService

                                 , ITeamService teamService

                                 , string sysConfig_versionFlag

                                 , string googleOAuth2Url
                                 , string googleOAuth2TokenUrl
                                 , string googleOAuth2UserUrl
                                 , string googleScope
                                 , string googleClientId
                                 , string googleClientSecret
                                 , string googleClientId_mobi
                                 , string googleClientSecret_mobi

                                 , string gitOAuthUrl
                                 , string gitOAuthTokenUrl
                                 , string gitOAuthUserUrl
                                 , string gitClientId
                                 , string gitClientSecret
                                 , string gitScope)
        {
            this._log                      = factory.Create(typeof(AccountController));
            this._context                  = context;
            this._accountHelper            = accountHelper;
            this._accountService           = accountService;
            this._accountConnectionService = accountConnectionService;

            this._teamService = teamService;

            this._sysConfig_versionFlag = sysConfig_versionFlag;

            this._googleOAuth2Url         = googleOAuth2Url;
            this._googleOAuth2TokenUrl    = googleOAuth2TokenUrl;
            this._googleOAuth2UserUrl     = googleOAuth2UserUrl;
            this._googleScope             = googleScope;
            this._googleClientId          = googleClientId;
            this._googleClientSecret      = googleClientSecret;
            this._googleClientId_mobi     = googleClientId_mobi;
            this._googleClientSecret_mobi = googleClientSecret_mobi;


            this._gitOAuthUrl      = gitOAuthUrl;
            this._gitOAuthTokenUrl = gitOAuthTokenUrl;
            this._gitOAuthUserUrl  = gitOAuthUserUrl;
            this._gitClientId      = gitClientId;
            this._gitClientSecret  = gitClientSecret;
            this._gitScope         = gitScope;
        }
 public AccountBookApiController(IAccountBookHelper acctBook,
                                 ICertificateWordHelper certWord,
                                 IModelValidation modelValid,
                                 IAuxiliaryHelper auxType,
                                 IAccountHelper account)
 {
     _acctBook   = acctBook;
     _modelValid = modelValid;
     _certWord   = certWord;
     _auxType    = auxType;
     _account    = account;
 }
Exemplo n.º 23
0
 public ToDoItemController(IMapper mapper,
                           IRepository <UserModel> repositoryUser,
                           IRepository <ToDoItemModel> repositoryToDoItem,
                           IAccountHelper accountHelper,
                           IWebsocketHandler websocketHandler)
 {
     _mapper             = mapper;
     _repositoryUser     = repositoryUser;
     _repositoryToDoItem = repositoryToDoItem;
     _accountHelper      = accountHelper;
     _websocketHandler   = websocketHandler;
 }
Exemplo n.º 24
0
 public LedgerController(HttpContextBase context,
                         ICacheHelper cache,
                         IAuxiliaryHelper auxiliary,
                         IAccountHelper account,
                         ICertificateWordHelper certWord,
                         IVoucherHelper voucher)
 {
     _identity  = context.User.Identity as ClaimsIdentity;
     _cache     = cache;
     _auxiliary = auxiliary;
     _account   = account;
     _certWord  = certWord;
     _voucher   = voucher;
 }
Exemplo n.º 25
0
        /// <summary>
        /// 验证用户
        /// </summary>
        void Authenticate()
        {
            if (Request["Authenticator"] != null && Request["accountID"] != null)
            {
                SSORequest ssoRequest = SSORequest.GetRequest(HttpContext.Current);
                string     actID      = ssoRequest.AccountID;
                if (Authentication.ValidateEACToken(ssoRequest) && !string.IsNullOrEmpty(actID) && We7Helper.IsGUID(actID))
                {
                    Security.SetAccountID(actID);
                }
                else if (Request["message"] != null)
                {
                    Message = Request["message"];
                    return;
                }
            }
            else
            {
                Session["$ActionFrom"] = Request.UrlReferrer.PathAndQuery;
                Session["$_ActionID"]  = _ActionID;
                IAccountHelper AccountHelper = AccountFactory.CreateInstance();
                string         loginName     = Name;
                //邮箱格式
                if (Name.IndexOf('@') > -1)
                {
                    Account account = AccountHelper.GetAccountByEmail(Name);
                    if (account != null)
                    {
                        loginName = account.LoginName;
                    }
                }

                string[] result = AccountHelper.Login(loginName, Password);
                if (result[0] == "false")
                {
                    Message = result[1];
                    return;
                }
                else
                {
                    Author = result[1];
                }
            }

            if (!string.IsNullOrEmpty(ReturnUrl))
            {
                Response.Redirect(ReturnUrl);
            }
        }
Exemplo n.º 26
0
 public AccountController(
     SignInManager <User> signInManager,
     UserManager <User> userManager,
     IAccountHelper accountHelper,
     ITenantService tenantService,
     IIdentityServerInteractionService interactionService,
     ILogger <AccountController> logger)
 {
     this.signInManager      = signInManager;
     this.userManager        = userManager;
     this.accountHelper      = accountHelper;
     this.tenantService      = tenantService;
     this.interactionService = interactionService;
     this.logger             = logger;
 }
Exemplo n.º 27
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     if (Request["Authenticator"] == null)
     {
         IAccountHelper AccountHelper = AccountFactory.CreateInstance();
         string         result        = AccountHelper.SignOut();
     }
     //退出时是否跳转对应页面
     if (!string.IsNullOrEmpty(Request.Params["returnurl"]))
     {
         Response.Redirect(Request.Params["returnurl"]);
     }
     Response.Redirect("/");
 }
Exemplo n.º 28
0
 public CandidateController(IEntityBaseRepository <Candidate> candidateRepository,
                            IEntityBaseRepository <Admin> adminRepository,
                            UserManager <QRecruitmentUser> userManager,
                            RoleManager <QRecruitmentRole> roleManager,
                            IAccountHelper accountHelper,
                            IEmailSender emailSender,
                            IHostingEnvironment env)
 {
     _candidateRepository = candidateRepository;
     _userManager         = userManager;
     _roleManager         = roleManager;
     _accountHelper       = accountHelper;
     _emailSender         = emailSender;
     _adminRepository     = adminRepository;
     _env = env;
 }
Exemplo n.º 29
0
 public AdminController(IEntityBaseRepository <Admin> adminRepository,
                        IHttpContextAccessor httpContextAccessor,
                        UserManager <QRecruitmentUser> userManager,
                        RoleManager <QRecruitmentRole> roleManager,
                        IAccountHelper accountHelper,
                        IEmailSender emailSender,
                        IHostingEnvironment env)
 {
     _adminRepository     = adminRepository;
     _httpContextAccessor = httpContextAccessor;
     _userManager         = userManager;
     _roleManager         = roleManager;
     _accountHelper       = accountHelper;
     _emailSender         = emailSender;
     _env = env;
 }
 public AssociateMemberAccountService(IAccountService accountService,
     IAccountHelper accountHelper,
     IAccountConnectionService accountConnectionService,
     UserHelper userHelper,
     ITeamService teamService,
     ITeamRepository teamRepository,
     ILoggerFactory factory)
 {
     this._accountService = accountService;
     this._accountHelper = accountHelper;
     this._userHelper = userHelper;
     this._accountConnectionService = accountConnectionService;
     this._teamService = teamService;
     this._teamRepository = teamRepository;
     this._logger = factory.Create(typeof(AssociateMemberAccountService));
 }
Exemplo n.º 31
0
        void bttnUpload_Click(object sender, EventArgs e)
        {
            string message = string.Empty;

            if (!fuPhoto.HasFile)
            {
                message = "上传图片不能为空";
            }
            else
            {
                string ext = Path.GetExtension(fuPhoto.FileName);
                if (!string.IsNullOrEmpty(ext))
                {
                    ext = ext.ToLower();
                    if (ext == ".jpg" || ext == ".png" || ext == ".gif")
                    {
                        string   fileName = GetImageUrl(fuPhoto.FileName);
                        string   filePath = Server.MapPath(fileName);
                        FileInfo fi       = new FileInfo(filePath);
                        if (!fi.Directory.Exists)
                        {
                            fi.Directory.Create();
                        }
                        fuPhoto.SaveAs(Server.MapPath(fileName));
                        string thumbfileName = GetThumbUrl(fileName);
                        string thumbPath     = Server.MapPath(thumbfileName);
                        ImageUtils.MakeThumbnail(filePath, thumbPath, 120, 120, "HW");
                        imgPhoto.ImageUrl = thumbfileName;
                        IAccountHelper helper = AccountFactory.CreateInstance();
                        Account        act    = helper.GetAccount(Security.CurrentAccountID, null);
                        act.Photo = thumbfileName;
                        helper.UpdateAccount(act, new string[] { "Photo" });

                        message = "上传成功";
                    }
                    else
                    {
                        message = "上传文件格式不对";
                    }
                }
                else
                {
                    message = "上传文件格式不对";
                }
            }
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "message", "alert('" + message + "')", true);
        }
Exemplo n.º 32
0
        /// <summary>
        /// 验证用户
        /// </summary>
        void Authenticate()
        {
            IAccountHelper AccountHelper = AccountFactory.CreateInstance();
            Account        act           = AccountHelper.GetAccountByLoginName(Name);

            if (act == null)
            {
                Message = "该用户不存在!";
                return;
            }
            if (!AccountHelper.IsValidPassword(act, Password))
            {
                Message = "密码不正确!";
                return;
            }
            Security.SetAccountID(act.ID);
        }
Exemplo n.º 33
0
        public void Initialize()
        {
            _accountHelper = new RealAccountHelper();
            Guid firstUserSession = _accountHelper.GenerateValidCredentials();

            _endpointHelper = new EndpointHelper();
            CreateHouseholdInviteLinkResponse inviteLinkResponse = _endpointHelper.Setup()
                                                                   .SetAuthenticationToken(firstUserSession.ToString())
                                                                   .AddHousehold(typeof(WhenTheRequestIsValid).Name)
                                                                   .CreateHouseholdInviteLink()
                                                                   .ReturnHouseholdLink();

            Guid secondUserSession = _accountHelper.GenerateValidCredentials();

            _endpointHelper.Setup().SetAuthenticationToken(secondUserSession.ToString());

            _joinHouseholdResponse = _endpointHelper.JoinHousehold(inviteLinkResponse.InviteLink);
        }
Exemplo n.º 34
0
 public GoogleSyncProcesser(
     ILockHelper lockHelper,
     ILoggerFactory loggerFactory,
     ISessionManager sessionManager,
     IAccountHelper accountHelper,
     IAccountService accountService,
     IAccountConnectionService accountConnectionService,
     ITaskService taskService,
     IExternalServiceProvider externalServiceProvider,
     IGoogleTokenService googleTokenService,
     IGoogleTaskSyncService googleTaskSyncService,
     IGoogleCalendarEventSyncService googleCalendarEventSyncService,
     IGoogleContactSyncService googleContactSyncService)
     : base(lockHelper, loggerFactory, sessionManager, accountHelper, accountService, accountConnectionService, taskService, externalServiceProvider)
 {
     lockHelper.Init<GoogleConnection>();
     _googleTokenService = googleTokenService;
     _googleTaskSyncService = googleTaskSyncService;
     _googleCalendarEventSyncService = googleCalendarEventSyncService;
     _googleContactSyncService = googleContactSyncService;
 }
Exemplo n.º 35
0
        public void TestFixtureSetUp()
        {
            try
            {
                CodeSharp.Core.Configuration.ConfigWithEmbeddedXml(null
                    , "application_config"
                    , Assembly.GetExecutingAssembly()
                    , "Cooper.Model.Test.ConfigFiles")
                    .RenderProperties()
                    .Castle(o => this.Resolve(o.Container));

                //初始化同步锁
                DependencyResolver.Resolve<ILockHelper>().Init<Account>();
                DependencyResolver.Resolve<ILockHelper>().Init<GoogleConnection>();
                DependencyResolver.Resolve<ILockHelper>().Init<GitHubConnection>();
                DependencyResolver.Resolve<ILockHelper>().Init<Member>();
            }
            catch (Exception e)
            {
                if (!e.Message.Contains("不可重复初始化配置")){
                    Console.WriteLine(e.Message);
                    throw e;
                }
            }

            this._log = DependencyResolver.Resolve<ILoggerFactory>().Create(this.GetType());
            this._sessionManager = DependencyResolver.Resolve<Castle.Facilities.NHibernateIntegration.ISessionManager>();

            this._accountHelper = DependencyResolver.Resolve<IAccountHelper>();
            this._accountService = DependencyResolver.Resolve<IAccountService>();
            this._accountConnectionService = DependencyResolver.Resolve<IAccountConnectionService>();
            this._taskService = DependencyResolver.Resolve<Cooper.Model.Tasks.ITaskService>();
            this._taskFolderService = DependencyResolver.Resolve<ITaskFolderService>();
            this._addressBookService = DependencyResolver.Resolve<IAddressBookService>();
            this._contactGroupService = DependencyResolver.Resolve<IContactGroupService>();
            this._contactService = DependencyResolver.Resolve<IContactService>();
            this._teamService = DependencyResolver.Resolve<ITeamService>();
            this._personalTaskService = DependencyResolver.Resolve<Cooper.Model.Tasks.IPersonalTaskService>();
            this._teamTaskService = DependencyResolver.Resolve<Cooper.Model.Teams.ITaskService>();
        }
Exemplo n.º 36
0
        public void TestFixtureSetUp()
        {
            Configuration.ConfigWithEmbeddedXml(null, "application_config", Assembly.GetExecutingAssembly(), "AliCooper.Sync.Test.ConfigFiles")
                .RenderProperties()
                .Castle(resolver => Resolve(resolver.Container));

            //初始化同步锁
            DependencyResolver.Resolve<ILockHelper>().Init<Account>();
            DependencyResolver.Resolve<ILockHelper>().Init<ArkConnection>();
            DependencyResolver.Resolve<ILockHelper>().Init<AliyunMailConnection>();

            _logger = DependencyResolver.Resolve<ILoggerFactory>().Create(GetType());
            _sessionManager = DependencyResolver.Resolve<ISessionManager>();

            _accountHelper = DependencyResolver.Resolve<IAccountHelper>();
            _accountService = DependencyResolver.Resolve<IAccountService>();
            _accountConnectionService = DependencyResolver.Resolve<IAccountConnectionService>();
            _taskService = DependencyResolver.Resolve<ITaskService>();
            _microsoftExchangeServiceProvider = DependencyResolver.Resolve<IMicrosoftExchangeServiceProvider>();
            _aliyunDao = DependencyResolver.Resolve<IAliyunDao>();

            _syncProcessor = new SyncProcesser(_exchangeServer, _aliyunDao);
        }
Exemplo n.º 37
0
        public AccountController(ILoggerFactory factory
            , IContextService context
            , IAccountHelper accountHelper
            , IAccountService accountService
            , IAccountConnectionService accountConnectionService

            , ITeamService teamService

            , string sysConfig_versionFlag

            , string googleOAuth2Url
            , string googleOAuth2TokenUrl
            , string googleOAuth2UserUrl
            , string googleScope
            , string googleClientId
            , string googleClientSecret
            , string googleClientId_mobi
            , string googleClientSecret_mobi

            , string gitOAuthUrl
            , string gitOAuthTokenUrl
            , string gitOAuthUserUrl
            , string gitClientId
            , string gitClientSecret
            , string gitScope

            , string arkOAuth2Url
            , string arkOAuth2UserUrl
            , string arkOAuth2Enable

            , UserHelper userHelper)
            : base(factory
            , context
            , accountHelper
            , accountService
            , accountConnectionService

            , teamService

            , sysConfig_versionFlag

            , googleOAuth2Url
            , googleOAuth2TokenUrl
            , googleOAuth2UserUrl
            , googleScope
            , googleClientId
            , googleClientSecret
            , googleClientId_mobi
            , googleClientSecret_mobi

            , gitOAuthUrl
            , gitOAuthTokenUrl
            , gitOAuthUserUrl
            , gitClientId
            , gitClientSecret
            , gitScope)
        {
            this._arkOAuth2Url = arkOAuth2Url;
            this._arkOAuth2UserUrl = arkOAuth2UserUrl;
            this._arkOAuth2Enable = Convert.ToBoolean(arkOAuth2Enable);

            this._userHelper = userHelper;
        }