public async Task CreateCompany(CreateCompanyRequest company) { var companyModel = Mapper.Map <Company>(company); companyModel.Id = IdGeneratorHelper.IdGenerator(); await _mongoDbRepository.Create(companyModel); }
public async Task CreateTaskDefinition(TaskDefinitionModel model, int accId) { var id = IdGeneratorHelper.GenerateId("td", accId.ToString()); await _taskDefinitionRepository.CreateTaskDefinition(new TaskDefinition() { Name = model.Name, Id = id, ContainerImageName = model.ContainerImageName, GroupId = model.GroupId, MaxVcpu = model.MaxVcpu, MinVcpu = model.MinVcpu, TaskType = (int)model.TaskType }); if (model.TaskType == TaskDefinitionType.QuartzCron) { await _taskDefinitionRepository.CreateTaskDefinitionQuartzCron(new TaskDefinitionQuartzCron() { Id = IdGeneratorHelper.GenerateId("td-qc", accId.ToString()), QuartzExpression = model.QuartzCron.QuartzExpression, TaskDefinitionId = id }); } else if (model.TaskType == TaskDefinitionType.ReplicatedServer) { await _taskDefinitionRepository.CreateTaskDefinitionReplicaServer(new TaskDefinitionReplicatedServer() { Id = IdGeneratorHelper.GenerateId("td-qc", accId.ToString()), MaximumCount = model.ReplicaServer.MaximumCount, MinimumCount = model.ReplicaServer.MinimumCount, TaskDefinitionId = id }); } }
public string NewId() { var now = DateTime.Now.ToString("HHmmssfff"); var daysDiff = (DateTime.Today - _baseDate).Days; var current = long.Parse(string.Format("{0}{1}", daysDiff, now)); return(IdGeneratorHelper.NewId(_cache, current)); }
public async Task <string> CreateResumes(ResumeRequest resumeStep1) { Resume resumeModel = new Resume(); resumeModel = Mapper.Map <ResumeRequest, Resume>(resumeStep1); resumeModel.Id = IdGeneratorHelper.IdGenerator(); await _mongoDbRepository.Create(resumeModel); return(resumeModel.Id); }
public async Task CreateTaskDefinitionGroup(TaskDefinitionGroupModel model, int accId) { var id = IdGeneratorHelper.GenerateId("tdg", accId.ToString()); var networkId = IdGeneratorHelper.GenerateId("i-cnn", accId.ToString()); await _taskDefinitionGroupRepository.CreateTaskDefinitionGroup(new TaskDefinitionGroup() { ContainerNetworkName = networkId, Id = id, Name = model.Name }); }
public ATcpSession(Socket socket, ATcpOptions options, PipeScheduler scheduler, MemoryPool <byte> pool, FilterPipeline <ITcpSession> filterPipeline) { this.Id = IdGeneratorHelper.GetNextId(); this.Order = options.Order; this.MemoryPool = pool; this.Scheduler = scheduler; this.MemoryPool = pool; this.Scheduler = scheduler; this.minAllocBufferSize = this.MemoryPool.MaxBufferSize / 2; this.filterPipeline = filterPipeline; this.socket = new TcpSocket(socket, scheduler); this.LocalAddress = this.socket.BindAddress; this.RemoteAddress = this.socket.RemoteAddress; this.SettingSocket(this.socket, options); this.SettingPipeline(options.MaxPipelineReadBufferSize, options.MaxPipelineWriteBufferSize); }
public UdpSession(Socket socket, UdpOptions options, MemoryPool <byte> memoryPool, PipeScheduler scheduler, FilterPipeline <IUdpSession> filterPipeline) { this.Id = IdGeneratorHelper.GetNextId(); this.socket = new UdpSocket(socket, scheduler); this.SettingSocket(this.socket, options); this.Order = options.Order; this.Scheduler = scheduler; this.MemoryPool = memoryPool; this.filterPipeline = filterPipeline; this.LocalAddress = this.socket.BindAddress; this.memoryBlockSize = this.MemoryPool.MaxBufferSize; this.rcvPipeline = new DgramPipeline(this.MemoryPool, scheduler, OnRcvPipelineRead); this.sndPipeline = new DgramPipeline(this.MemoryPool, scheduler, OnSndPipelineRead); this.readerFlushCallback = (startPos, endPos) => { }; this.writerFlushCallback = (writer) => { }; }
public KcpSession(uint conv, EndPoint remoteAddress, EndPoint localAddress, KcpOptions options, IUdpSession udpSession, IEventSubscriber subscriber, FilterPipeline <IKcpSession> pipeline, IKcpClosable closable) { this.Id = IdGeneratorHelper.GetNextId(); this.Conv = conv; this.LocalAddress = localAddress; this.RemoteAddress = remoteAddress; this.Order = options.Order; this.udpSession = udpSession; this.subscriber = subscriber; this.Pipeline = pipeline; this.closable = closable; var littleEndian = this.Order == BinaryOrder.LittleEndian; this.kcpKit = new KcpKit(conv, littleEndian, this.MemoryPool); this.kcpKit.SettingMtu(options.Mtu); this.kcpKit.SettingNoDelay(options.NoDelay); this.kcpKit.SettingWndSize(options.WndSize); this.kcpKit.SettingStreamMode(options.StreamMode); this.kcpKit.SettingReservedSize(options.ReservedSize); this.kcpKit.onRcv += this.OnKcpRcvEvent; this.kcpKit.onSnd += this.OnKcpSndEvent; this.kcpOperators = BinaryOrderOperatorsFactory.GetOperators(this.Order); this.rcvPool = new WrappedMemoryPool(this.MemoryPool, MemoryFlag.Kcp); this.sndPool = new WrappedMemoryPool(this.MemoryPool, MemoryFlag.Kcp); this.sndMemory = new WrappedMemory(this.MemoryPool.Rent(), MemoryFlag.Kcp); this.readerUdpMemory = new WrappedMemory(this.MemoryPool.Rent(), MemoryFlag.Udp); this.writerUdpMemory = new WrappedMemory(this.MemoryPool.Rent(), MemoryFlag.Udp); this.readerFlushDelegate = (pos, endPos) => { }; this.writerFlushDelegate = this.OnWriterComplete; this.runnableUnitDelegate = this.Update; this.subscriber.Register(this.runnableUnitDelegate); this.Pipeline.OnTransportActive(this); }
private void CreateUserRole(string email, bool isHr) { UserRole userRole = new UserRole(); userRole.Id = IdGeneratorHelper.IdGenerator(); userRole.Email = email; if (isHr) { userRole.RoleName = EUserRole.Hr.ToString(); _mongoDbRepository.Create <UserRole>(userRole); Company company = new Company(); company.Id = IdGeneratorHelper.IdGenerator(); company.Email = email; _mongoDbRepository.Create <Company>(company); } else { userRole.RoleName = EUserRole.Candidate.ToString(); _mongoDbRepository.Create <UserRole>(userRole); } }
public async Task CreateJob(CreateJobRequest job) { var filter = Builders <Company> .Filter.Where(x => x.Email == job.Email); var resultCompany = await _mongoDbRepository.Find <Company>(filter); var company = resultCompany.FirstOrDefault(); var jobModel = Mapper.Map <Job>(job); jobModel.StartDay = jobModel.StartDay.Date; jobModel.ExpirationDate = jobModel.ExpirationDate.Date; jobModel.Id = IdGeneratorHelper.IdGenerator(); jobModel.CompanyId = company.Id; var task = Task.Run(async() => await _mongoDbRepository.Create(jobModel)); task.Wait(); if (task.IsCompletedSuccessfully) { await UpdateStatusJob(jobModel.Id); } }
public async Task CreateApplication(CreateApplycationRequest apply) { var filter = Builders <Resume> .Filter.Where(x => x.Email == apply.Email); var resume = await _mongoDbRepository.Find(filter); var applyModel = Mapper.Map <Application>(apply); applyModel.Id = IdGeneratorHelper.IdGenerator(); applyModel.AppliedDate = DateTime.Now; applyModel.Resume = resume.FirstOrDefault(); var filterJob = Builders <Job> .Filter.Where(x => x.Id == apply.JobId); var jobResult = await _mongoDbRepository.Find <Job>(filterJob); var jobModel = jobResult.FirstOrDefault(); jobModel.Vacancies += 1; await _mongoDbRepository.Replace(jobModel); await _mongoDbRepository.Create(applyModel); }