public override void RegisterAll(Type target) { CheckContainer(); Registrator.GetAssemblies() .SelectMany(a => Registrator.GetTypesImplementing(a, target)) .ForEach(t => container.Register(Component.For(target).ImplementedBy(t))); }
public IActionResult Index() { ClaimsPrincipal user = new ClaimsPrincipal(); try { user = User; } catch (NullReferenceException) { ViewBag.ErrorMessage = "No logged in user could be found."; return(View()); } Registrator registrator = Registrator.GetRegistratorData(user); registrator = _iRegTempus.GetRegistratorBasedOnUserId(registrator); bool result = ((registrator == null) ? false : true); if (result == false) { registrator = Registrator.GetRegistratorData(user); registrator.UserHaveStartedTimeMeasure = false; registrator.StartedTimeMeasurement = 0; registrator = _iRegTempus.CreateRegistrator(registrator); } UserTimeRegistrationViewModel konvertedRegistrator = UserTimeRegistrationViewModel.RestructureTheRegistratorData(registrator); return(View(konvertedRegistrator)); }
public IActionResult Register(string usr, string mail, string pss) { ViewBag.Completed = false; if (usr == null) { return(View()); } ViewBag.Successfull = false; ViewBag.Mail = mail; var mailRegex = new Regex("^.+@.+[.].+$"); usr = usr.TrimName().MakeSafe(); mail = mail.MakeSafe(); // Add to Registrator list if (pss != null && mail != null && usr != null && mailRegex.IsMatch(ViewBag.Mail) && Registrator.Add(usr, mail, pss)) { ViewBag.Successfull = true; } ViewBag.Completed = true; return(View()); }
public override void RegisterAll <TTarget>() { CheckContainer(); UpdateContainer(cb => Registrator.GetAssemblies().ToList() .ForEach(a => Registrator.GetTypesImplementing <TTarget>(a).ToList() .ForEach(t => cb.RegisterType(t).As <TTarget>()))); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var connectionString = Configuration.GetConnectionString("DefaultConnection"); Console.WriteLine($"--> Database connection string: {connectionString}"); Console.WriteLine($"--> Environment: {_env.EnvironmentName}"); services.AddDbContext <DataContext>(x => x.UseSqlServer(connectionString)); services.AddCors(); services.AddMvc() .AddJsonOptions(opt => opt.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore) .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); Registrator.Register(services); services.AddTransient <DataSeed>(); services.AddAutoMapper(); services.AddSwaggerDocumentation(); services.AddSignalR(); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII. GetBytes(Configuration.GetSection("AppSettings:Token").Value)), ValidateIssuer = false, ValidateAudience = false }; }); }
public override void RegisterAll(Type target) { CheckContainer(); Registrator.GetAssemblies().ToList().ForEach( a => Registrator.GetTypesImplementing(a, target).ToList().ForEach( t => container.Bind(target).To(t))); }
public override void RegisterAll <TTarget>() { CheckContainer(); Registrator.GetAssemblies().ToList().ForEach( a => Registrator.GetTypesImplementing <TTarget>(a).ToList().ForEach( t => container.Bind <TTarget>().To(t))); }
public override void RegisterAll <TTarget>() { CheckContainer(); Registrator.GetAssemblies().ForEach( a => Registrator.GetTypesImplementing <TTarget>(a).ForEach( t => container.RegisterType(typeof(TTarget), t, t.FullName))); }
public override void RegisterAll(Type target) { CheckContainer(); Registrator.GetAssemblies().ForEach( a => Registrator.GetTypesImplementing(a, target).ForEach( t => container.RegisterType(target, t, t.FullName))); }
public static void Seedit(Registrator reg, string jsonData, DBContext context) { List <Product> products = JsonConvert.DeserializeObject <List <Product> >(jsonData); if (!context.Products.Any()) { try { context.AddRange(products); var tries = 3; while (tries > 0) { tries -= 1; try { reg.Register(products); context.SaveChanges(); return; } catch (Exception ex) { Debug.WriteLine(ex.Message); Task.Delay(5000).Wait(); } } } catch { throw; } } }
private static ExportInfo[] GetExportsFromExportManyAttribute(ExportedRegistrationInfo currentInfo, Type implementationType, ExportManyAttribute exportManyAttribute) { var contractTypes = Registrator.GetImplementedServiceTypes(implementationType, exportManyAttribute.NonPublic); if (!exportManyAttribute.Except.IsNullOrEmpty()) { contractTypes = contractTypes.Except(exportManyAttribute.Except).ToArrayOrSelf(); } var manyExports = contractTypes .Select(t => new ExportInfo(t, exportManyAttribute.ContractName ?? exportManyAttribute.ContractKey)) .ToArray(); Throw.If(manyExports.Length == 0, Error.ExportManyDoesNotExportAnyType, implementationType, contractTypes); var currentExports = currentInfo.Exports; if (!currentExports.IsNullOrEmpty()) { for (var i = 0; i < currentExports.Length; i++) { if (!manyExports.Contains(currentExports[i])) { manyExports = manyExports.AppendOrUpdate(currentExports[i]); } } } return(manyExports); }
public static void Main(string[] args) { var registrator = new Registrator(); var statement = registrator.GetRegistrationInstructions(@"..\..\..\TestPlugin\Registration.cs"); Console.Write(statement); }
private static IUnityContainer InitContainer() { IUnityContainer container = new UnityContainer(); Registrator.Register(container); return(container); }
private ChairLogic chooseChair() { var freeChairs = Registrator.getFreeChairs(); //Debug.Log(freeChairs.Count); var chair = freeChairs[Random.Range(0, freeChairs.Count - 1)]; return(chair); }
public ValidApplicationReceived() : base() { _reg = new Registrator(); var app = new Application(email: "*****@*****.**", password: "******", confirm: "password"); _result = _reg.ApplyForMembership(app); _user = _result.NewUser; }
public override void RegisterAll(Type target) { CheckContainer(); container.Configure(c => Registrator.GetAssemblies() .SelectMany(a => Registrator.GetTypesImplementing(a, target)) .ForEach(t => c.For(target).Use(t))); }
public override void RegisterAll <TTarget>() { CheckContainer(); container.RegisterAll <TTarget>( Registrator .GetAssemblies() .SelectMany(a => Registrator.GetTypesImplementing <TTarget>(a)) ); }
public ActionResult DocumentRegister(DocumentModel document) { if (document != null) { Document baseDocument = db.Documents.Find(document.Id); if (baseDocument == null) { baseDocument = new Document() { Id = document.Id, DocumentType = 4, ProjectType = document.ProjectType, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, TemplateId = new Guid("C3292589-A25B-4CEF-8CB5-C7E64946C1D3") }; db.Documents.Add(baseDocument); } baseDocument = document.GetDocument(baseDocument); baseDocument.StateType = 1; baseDocument.DocumentDate = baseDocument.DocumentDate ?? DateTime.Now; //baseDocument.ExecutionDate = baseDocument.ExecutionDate ?? baseDocument.DocumentDate.Value.AddDays(15); baseDocument.RegistratorId = UserHelper.GetCurrentEmployee().Id.ToString(); baseDocument.RegistratorValue = UserHelper.GetCurrentEmployee().DisplayName; baseDocument.FirstExecutionDate = baseDocument.ExecutionDate; baseDocument.ModifiedDate = DateTime.Now; Registrator.SetNumber(baseDocument); if ((baseDocument.ProjectType == 5 || baseDocument.ProjectType == 2) && baseDocument.ApplicantType != 1) { if (UserHelper.CheckGuide(baseDocument.ExecutorsId)) { baseDocument.ApplicantType = 1; } } if (!document.RemarkId.HasValue) { LogHelper.Log.Error("Не указан тип замечания"); throw new Exception("Не указан тип замечания"); } var remarkType = db.RemarkTypes.First(x => x.Code == document.RemarkId.Value.ToString()); baseDocument.RemarkId = remarkType.Id; baseDocument.RemarkText1 = document.RemarkText1; baseDocument.RemarkText2 = document.RemarkText2; baseDocument.RemarkText3 = document.RemarkText3; db.SaveChanges(); GenerateActivity(baseDocument); DocumentModel model = new DocumentModel(baseDocument); return(Content(JsonConvert.SerializeObject(new { State = true, document = model }, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "dd.MM.yyyy HH:mm" }))); return(Json(new { State = true, document = model }, JsonRequestBehavior.AllowGet)); } return(Content(bool.FalseString)); }
public override void RegisterAll <TTarget>() { CheckContainer(); container.Configure(c => c.Scan(s => { s.AddAllTypesOf <TTarget>(); Registrator.GetAssemblies().ForEach(s.Assembly); })); }
public void AddRoleGuest(Registrator regUser) { regUser.ID = Guid.NewGuid(); using (var streamWriter = new StreamWriter(CreatorDefault.PathRegistrator)) { streamWriter.WriteLine(JsonConvert.SerializeObject(regUser)); regUsers.Add(regUser.ID, regUser); } }
public async Task SendWithJsonHttpContentShouldSucceed() { // Arrange Registrator.RegisterDocuments(); var destination = new Identity(Guid.NewGuid().ToString(), "msging.net"); Context.User.Returns(destination); var select = new Select() { Text = "This is the header", Scope = SelectScope.Immediate, Options = new[] { new SelectOption { Text = "This is the first option" }, new SelectOption { Text = "This is the second option" }, new SelectOption { Text = "This is the third option" } } }; var content = DocumentSerializer.Serialize(select); var settings = new SendRawMessageSettings { Type = Select.MIME_TYPE, RawContent = content }; var target = GetTarget(); // Act await target.ExecuteAsync(Context, JObject.FromObject(settings), CancellationToken); // Assert await Sender.Received(1).SendMessageAsync( Arg.Is <Message>(m => m.To.ToIdentity().Equals(destination) && m.Type == Select.MediaType && m.Content is Select && ((Select)m.Content).Text == select.Text && ((Select)m.Content).Scope == SelectScope.Immediate && ((Select)m.Content).Options.Length == select.Options.Length && ((Select)m.Content).Options[0].Text == select.Options[0].Text && ((Select)m.Content).Options[1].Text == select.Options[1].Text && ((Select)m.Content).Options[2].Text == select.Options[2].Text), CancellationToken); }
private void button3_Click(object sender, EventArgs e) { label1.Hide(); Registrator.Hide(); Doctor.Hide(); button3.Hide(); label2.Show(); enter.Show(); textBox1.Show(); textBox1.Clear(); }
public void Login() { String appId = vsetts.VkAppId.ToString(); bool forceOAuth = vsetts.forceOAtuh; bool revoke = vsetts.revoke; var scope = new List <string>(); Registrator r = new Registrator(); r.VkInit(vsetts.scope, appId, forceOAuth); }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { string name = NameTextBox.Text; string lastname = LastNameTextBox.Text; string login = LoginTextBox.Text; string password = PasswordBox.Password; string email = EmailTextBox.Text; string phone = PhoneNumberTextBox.Text; Registrator.Register(name, lastname, login, password, phone, email); }
public IActionResult ConfirmRegister(string code) { if (code == null) { ViewBag.Successfull = false; return(View()); } ViewBag.Successfull = Registrator.Confirm(code); return(View()); }
public static UserTimeRegistrationViewModel RestructureTheRegistratorData(Registrator registator) { UserTimeRegistrationViewModel modifiedRegistrator = new UserTimeRegistrationViewModel { RegistratorId = registator.RegistratorId, FirstName = registator.FirstName, LastName = registator.LastName, UserHaveStartedTimeMeasure = registator.UserHaveStartedTimeMeasure }; return(modifiedRegistrator); }
public Configuration() { ResetUrl = "http://localhost/reminder/"; ConfirmationUrl = "http://localhost/email/confirm"; ConnectionStringName = "BDDExample"; MinPasswordLength = 4; RequireEmailConfirmation = false; DefaultUserSessionDays = 30; AuthenticationService = new Authenticator(); RegistrationService = new Registrator(); ReminderService = new Reminder(); }
public async Task SetUpAsync() { Registrator.RegisterDocuments(); ChannelNamespace = EnvelopeId.NewId(); ListenerUri = new Uri("redis://localhost"); EnvelopeSerializer = new JsonNetSerializer(); TraceWriter = new Mock <ITraceWriter>(); Listener = new RedisTransportListener(ListenerUri, EnvelopeSerializer, TraceWriter.Object, channelNamespace: ChannelNamespace); await Listener.StartAsync(CancellationToken); CancellationToken = TimeSpan.FromSeconds(5).ToCancellationToken(); }
private void MainForm_Load(object sender, EventArgs e) { MelodyThread = new Thread(new ThreadStart(Music.MissionImpossible)); MelodyThread.Start(); MainFormLoad?.Invoke(this, EventArgs.Empty); label1.Hide(); Registrator.Hide(); Doctor.Hide(); button3.Hide(); }
public InterfaceRegistrator(Registrator register, Registrator registerOptional) { this.register = register; this.registerOptional = registerOptional; var interfaces = typeof(T).GetInterfaces(); if (interfaces.Contains(typeof(IInitializable))) { register(typeof(IInitializable), c => c.GetRequiredService <T>()); } }
private Task OnRun() { foreach (var step in Steps) { step.ClearStatus(); } return Task.Run(() => { IsEnabled = false; var reg = new Registrator<FirefoxDriver>(new BrowserFactory()); var data = new WebData(); data.SiteUrl = new Uri(Site); var s = new List<IStep>(); foreach (var step in Steps) { if (!step.IsSelected) { continue; } var tag = new Tag(new TagAttribute(step.TagAttribute), step.TagAttributeKey); switch (step.GetCurrentStepType()) { case StepTypes.Action: s.Add(new ActionStep(new ActionTag(tag, step.GetCurrentJSEvent()))); break; case StepTypes.Input: s.Add(new InputStep(new InputTag(tag, step.InputData))); break; } } data.Steps = s; reg.TryRegister(data, StepProcesed); }); }
public void Login() { String appId=vsetts.VkAppId.ToString(); bool forceOAuth=vsetts.forceOAtuh; bool revoke=vsetts.revoke; var scope=new List<string>(); Registrator r= new Registrator(); r.VkInit(vsetts.scope,appId,forceOAuth); }