public async Task <string> SaveAsync(IProjectData projectData) { var newEntity = ProjectEntity.Create(projectData); await _projectsTableStorage.InsertAsync(newEntity); return(newEntity.Id); }
public static ProjectEntity Create(IProjectData src) { var result = new ProjectEntity { RowKey = Guid.NewGuid().ToString("N"), PartitionKey = GeneratePartitionKey(), Name = src.Name, Overview = src.Overview, Description = src.Description, ProjectStatus = Status.Initiative.ToString(), Category = src.Category, Tags = src.Tags, CompetitionRegistrationDeadline = src.CompetitionRegistrationDeadline, ImplementationDeadline = src.ImplementationDeadline, VotingDeadline = src.VotingDeadline, BudgetFirstPlace = src.BudgetFirstPlace, BudgetSecondPlace = src.BudgetSecondPlace, Created = src.Created, LastModified = src.Created, AuthorId = src.AuthorId, AuthorFullName = src.AuthorFullName, ParticipantsCount = src.ParticipantsCount }; return(result); }
public void OnProjectOpenApplied(IProjectData selected) { if (selected.State == ProjectState.locked) { Networking.Networking.instance.Request_Assess(selected.Name); selected.State = ProjectState.applied; Notification.Notification.instance.showNotification("Assess Requested"); SetProjectList(); } if (selected.State == ProjectState.applied) { SetProjectList(); Networking.Networking.instance.Request_Assess(selected.Name); Notification.Notification.instance.showNotification("Still waiting on Acceptence"); } if (selected.State == ProjectState.applied) { Networking.Networking.instance.Request_Assess(selected.Name); Notification.Notification.instance.showNotification("Still waiting on Acceptence"); } if (selected.State == ProjectState.accepted) { new Project_Window(selected.Name).Show(); } }
public static ProjectEntity Create(IProjectData src) { var projectStatus = src.Status == Status.Draft ? Status.Draft.ToString() : Status.Initiative.ToString(); var result = new ProjectEntity { RowKey = src.Id, PartitionKey = GeneratePartitionKey(), Name = src.Name, Overview = src.Overview, Description = src.Description, ProjectStatus = projectStatus, Category = src.Category, Tags = src.Tags, CompetitionRegistrationDeadline = src.CompetitionRegistrationDeadline, ImplementationDeadline = src.ImplementationDeadline, VotingDeadline = src.VotingDeadline, BudgetFirstPlace = src.BudgetFirstPlace, BudgetSecondPlace = src.BudgetSecondPlace, Created = src.Created, LastModified = src.Created, AuthorId = src.AuthorId, AuthorFullName = src.AuthorFullName, ParticipantsCount = src.ParticipantsCount, ProgrammingResourceName = src.ProgrammingResourceName, ProgrammingResourceLink = src.ProgrammingResourceLink, UserAgent = src.UserAgent, SkipVoting = src.SkipVoting, SkipRegistration = src.SkipRegistration }; return(result); }
private int CalculateStatusCompletionPercent(IProjectData projectData) { var completion = 0; switch (projectData.Status) { case Status.Initiative: completion = 100; break; case Status.Registration: completion = CalculateDateProgressPercent(projectData.Created, projectData.CompetitionRegistrationDeadline); break; case Status.Submission: completion = CalculateDateProgressPercent(projectData.CompetitionRegistrationDeadline, projectData.ImplementationDeadline); break; case Status.Voting: completion = CalculateDateProgressPercent(projectData.ImplementationDeadline, projectData.VotingDeadline); break; case Status.Archive: completion = 100; break; } return((completion < 0) ? 0 : completion); }
/// <summary> /// Tries to convert Project Data from JSON using Project Data Structure Version 2. /// </summary> /// <param name="jsonString">String used in conversion.</param> /// <param name="projectData">Object that implements IProjectData interface.</param> /// <returns>Result of attempt to convert project.</returns> private bool TryConvertProjectV2(string jsonString, out IProjectData projectData) { try { projectData = JsonConvert.DeserializeObject <ProjectData>(jsonString); return(true); } catch (System.Exception) { try // Will need to fix later { var definition = new { ProjectName = "", ProjectLines = new List <ProjectLine>() }; var newProject = JsonConvert.DeserializeAnonymousType(jsonString, definition); projectData = new ProjectData { ProjectName = newProject.ProjectName, ProjectLines = newProject.ProjectLines.ToList <IProjectLine>() }; return(true); } catch (System.Exception) { projectData = null; return(false); } } }
public WorkItemsRepository(IDataRepository dataRepository, IOptions <AppSettings> appSettings, IProjectData projectData, IUserData userData) { _dataRepository = dataRepository; _appSettings = appSettings.Value; _projectdata = projectData; _userData = userData; }
public EditBookingViewModel(IProjectData projectData, DateTime date, bool editMode = false) { this.projectData = projectData; this.Date = date; this.EditMode = editMode; this.DateStart = this.projectData.CurrentYear.DateStart.ToDateTime(); this.DateEnd = this.projectData.CurrentYear.DateEnd.ToDateTime(); this.BookingIdentifier = this.projectData.MaxBookIdent + 1; if (this.Date > this.DateEnd) { this.Date = this.DateEnd; } if (this.Date < this.DateStart) { this.Date = this.DateStart; } this.CreditSplitEntries.CollectionChanged += (sender, args) => { this.NotifyOfPropertyChange(nameof(this.DebitSplitAllowed)); this.NotifyOfPropertyChange(nameof(this.IsEasyBookingEnabled)); }; this.DebitSplitEntries.CollectionChanged += (sender, args) => { this.NotifyOfPropertyChange(nameof(this.CreditSplitAllowed)); this.NotifyOfPropertyChange(nameof(this.IsEasyBookingEnabled)); }; }
internal void Update(IProjectData src) { Name = src.Name; Overview = src.Overview; Description = src.Description; Category = src.Category; Tags = src.Tags; ProjectStatus = src.ProjectStatus; CompetitionRegistrationDeadline = src.CompetitionRegistrationDeadline; ImplementationDeadline = src.ImplementationDeadline; VotingDeadline = src.VotingDeadline; BudgetFirstPlace = src.BudgetFirstPlace; BudgetSecondPlace = src.BudgetSecondPlace; VotesFor = src.VotesFor; VotesAgainst = src.VotesAgainst; LastModified = src.LastModified; ParticipantsCount = src.ParticipantsCount; ProgrammingResourceName = src.ProgrammingResourceName; ProgrammingResourceLink = src.ProgrammingResourceLink; UserAgent = src.UserAgent; SkipVoting = src.SkipVoting; SkipRegistration = src.SkipRegistration; AuthorId = src.AuthorId; AuthorFullName = src.AuthorFullName; AuthorIdentifier = src.AuthorIdentifier; PrizeDescription = src.PrizeDescription; StreamId = src.StreamId; NameTag = src.NameTag; InfoForKycUsers = src.InfoForKycUsers; DescriptionFooter = src.DescriptionFooter; }
/// <summary> /// Implements the report for the report showing totals and balances. /// </summary> /// <remarks> /// This is an overview over all accounts with totals and balances, grouped by account groups. /// </remarks> public TotalsAndBalancesReport( IXmlPrinter printer, IProjectData projectData, IEnumerable <AccountingDataAccountGroup> accountGroups) : base(printer, ResourceName, projectData) { this.accountGroups = accountGroups.ToList(); }
private ModProjectData ReplaceKeywordAction(IProjectData data) { if (data is ModProjectData modProjectData) { return(modProjectData); } return(null); }
protected ReportBase(IXmlPrinter printer, string resourceName, IProjectData projectData) { this.printer = printer; this.setup = projectData.Storage.Setup; this.YearData = projectData.CurrentYear; this.printer.LoadDocument(resourceName); }
static StandardCase() { if (Assembly.Items.ContainsKey(projectDataKey)) { Assembly pData = Experior.Core.Assemblies.Assembly.Items[projectDataKey] as Assembly; StandardCase.DefaultSpecs = pData.Info as IProjectData; } }
public ProjectController(IProjectData projectData, UserManager <User> userManager, IHostingEnvironment env, IFileProvider fileProvider, OurProjectDbContext Context) { _projectData = projectData; _userManager = userManager; _env = env; this._fileProvider = fileProvider; _context = Context; }
static void Run(IProjectData data) { var d = data.GetAllItems(); System.Console.WriteLine("Get some Project Data: {0} items", d.Count); foreach (var item in d) { System.Console.WriteLine("\t({0}) Name:{1}, Type:{2}", item.Id, item.Name, item.ItemType); } }
private async Task SendProjectCreateNotification(IProjectData model) { var message = NotificationMessageHelper.CreateProjectMessage(model); foreach (var email in _settings.LykkeStreams.ProjectCreateNotificationReceiver) { await _emailSender.SendEmailAsync(NotificationMessageHelper.EmailSender, email, message); } }
/// <summary> /// 根据ProjectData创建层次结构 /// </summary> /// <param name="pd"></param> /// <returns></returns> public static GameObject InstantiateSpatialStructure(IProjectData pd) { foreach (var sptial in pd.SubSpatials) { sptial.TheGameObject.transform.parent = pd.TheGameObject.transform; FindSubSpatialStructure(sptial); } return(pd.TheGameObject); }
public ActionResult Dashboard(OnlineTranslationRequest translationRequest, string submit) { ITranslationData data = null; IProjectDataFactory projectDataFactory = new ProjectDataFactory(); ISubTranslationDataFactory subTranslationDataFactory = new SubTranslationDataFactory(); ITranslationDataFactory translationDataFactory = new TranslationDataFactory(projectDataFactory, subTranslationDataFactory); IFileRepository fileRepository = new FileRepository(translationDataFactory); switch (submit) { case "Open": if (Request.Files.Count > 0 && Request.Files[0].FileName.Any()) { var file = Request.Files[0]; if (file != null & file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var fileType = Path.GetExtension(fileName); // Need to treat this at some point var filePath = @"C:\Temp\" + fileName; file.SaveAs(filePath); var openData = fileRepository.OpenFile(fileType, filePath, fileName); data = openData.Item1; } } else { throw new Exception("No requests."); } break; case "Create": if (translationRequest != null) { string fileName = translationRequest.ProjectName; string[] rawData = translationRequest.RawData.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); IProjectData project = projectDataFactory.CreateProjectDataFromArray(fileName, rawData); data = translationDataFactory.CreateTranslationDataFromProject(project); } else { throw new Exception("No requests."); } break; default: break; } System.Web.HttpContext.Current.Session["ProjectData"] = data.GetProjectData(); return(View()); }
private void GenerateUiTree(IProjectData projData) { var uiTreeData = new UITreeData(projData.Name, projData.EntityLabel); foreach (var prodData in projData.RelatedObjects) { Helper(prodData, uiTreeData); } uiTree.Inject(uiTreeData); }
public static OtherProjectViewModel Create(IProjectData project) { return(new OtherProjectViewModel { Id = project.Id, Name = project.Name, BudgetFirstPlace = project.BudgetFirstPlace, BudgetSecondPlace = project.BudgetSecondPlace, Members = project.ParticipantsCount }); }
public MenuViewModel( IProjectData projectData, IBusy busy, IReportFactory reportFactory, IProcess processApi, IDialogs dialogs) { this.busy = busy; this.projectData = projectData; this.processApi = processApi; this.dialogs = dialogs; this.reportFactory = reportFactory; }
public Task UpdateAsync(IProjectData projectData) { var partitionKey = ProjectEntity.GeneratePartitionKey(); var rowKey = ProjectEntity.GenerateRowKey(projectData.Id); return(_projectsTableStorage.ReplaceAsync(partitionKey, rowKey, itm => { itm.Update(projectData); return itm; })); }
public string ReplaceText(string inputText, IProjectData projectData = null) { if (Replace != null) { return(inputText.Replace(KeywordName, Replace(projectData))); } else { return(inputText.Replace(KeywordName, KeywordValue)); } }
public ProjectsController(IArticleData articleData, UserManager <ApplicationUser> user, RoleManager <IdentityRole> role, IProjectData project ) { _user = user; _role = role; _project = project; }
public static ProjectDetailsStatusBarViewModel Create(IProjectData project, int participantCount) { return(new ProjectDetailsStatusBarViewModel { Status = project.Status, ParticipantsCount = participantCount, CompetitionRegistrationDeadline = project.CompetitionRegistrationDeadline, ImplementationDeadline = project.ImplementationDeadline, VotingDeadline = project.VotingDeadline, StatusCompletionPercent = CalculateStatusCompletionPercent(project) }); }
public static PlainTextData CreateProjectMessage(IProjectData model) { var message = new PlainTextData { Sender = EmailSender, Text = "New Project was created. Project name - " + model.Name + ", Project author - " + model.AuthorFullName + ", Project Link - https://streams.lykke.com/Project/ProjectDetails/" + model.Id, Subject = "New Project Created!" }; return(message); }
public bool SaveSourceControlData(IProjectData data, string folderPath) { SourceControlData sourceControlData = new SourceControlData() { ProjectName = data.ProjectName, ProjectUUID = data.UUID, RepositoryPath = folderPath, SourceFile = Path.Combine(folderPath, DefaultPaths.SourceControlGeneratorDataFile) }; return(SaveSourceControlData(sourceControlData, folderPath)); }
public ShellViewModel( IProjectData projectData, IBusy busy, IMenuViewModel menu, IFullJournalViewModel fullJournal, IAccountJournalViewModel accountJournal, IAccountsViewModel accounts, IApplicationUpdate applicationUpdate) { this.ProjectData = projectData; this.Busy = busy; this.Menu = menu; this.FullJournal = fullJournal; this.AccountJournal = accountJournal; this.Accounts = accounts; this.applicationUpdate = applicationUpdate; this.version = this.GetType().GetInformationalVersion(); // TODO SVM is too much responsible this.ProjectData.DataLoaded += (sender, args) => { this.Accounts.OnDataLoaded(); this.Menu.OnDataLoaded(); }; this.ProjectData.YearChanged += (_, __) => { this.UpdateDisplayName(); this.FullJournal.Rebuild(); this.Accounts.SelectFirstAccount(); }; this.ProjectData.JournalChanged += (_, args) => { this.FullJournal.Rebuild(); this.FullJournal.Select(args.ChangedBookingId); if (this.Accounts.SelectedAccount == null || !args.AffectedAccounts.Contains(this.Accounts.SelectedAccount.Identifier)) { return; } this.AccountJournal.Rebuild(this.Accounts.SelectedAccount.Identifier); this.AccountJournal.Select(args.ChangedBookingId); }; this.Accounts.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(this.Accounts.SelectedAccount)) { this.AccountJournal.Rebuild(this.Accounts.SelectedAccount?.Identifier ?? 0); } }; }
private async Task AddVotingMailToQueue(IProjectData project) { var following = await GetProjectFollows(project.Id); foreach (var follower in following) { if (_emailsQueue != null) { var message = NotificationMessageHelper.GenerateVotingMessage(project, follower); await _emailsQueue.PutMessageAsync(message); } } }
public static void OpenBackupFolder(IProjectData projectData) { if (ModuleSettingsExist) { string directory = Path.Combine(Path.GetFullPath(AppController.Main.CurrentModule.ModuleData.ModuleSettings.BackupRootDirectory), projectData.ProjectName); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } Process.Start(directory); } }