Beispiel #1
0
 public ArtifactData(MainObject main)
 {
     LrsId               = main.MainId.Value;
     OwnerEmployeeId     = main.OwnerEmployeeId;
     OwnerName           = main.OwnerName;
     OwnerEmail          = main.OwnerEmail;
     ReviewStatus        = "Approved";//main.ReviewStatus;
     ReviewProgress      = (int)main.ReviewPercent;
     DocumentType        = main.DocumentType;
     Title               = main.Title;
     StiNumber           = main.StiNumber;
     Revision            = main.Revision;
     CreateDate          = main.CreateDate;
     ModifiedDate        = main.ActivityDate;
     ApprovedDate        = main.ApprovalDate;
     Abstract            = main.Abstract;
     ConferenceName      = main.ConferenceName;
     ConferenceSponsor   = main.ConferenceSponsor;
     ConferenceLocation  = main.ConferenceLocation;
     ConferenceBeginDate = main.ConferenceBeginDate;
     ConferenceEndDate   = main.ConferenceEndDate;
     JournalName         = main.JournalName;
     RelatedSti          = main.RelatedSti;
     main.Contacts.ForEach(n => Contacts.Add(new ContactData(n)));
     main.Authors.ForEach(n => Authors.Add(new AuthorData(n)));
     main.Funding.ForEach(n => Fundings.Add(new FundingData(n)));
     main.Reviewers.ForEach(n => Reviewers.Add(new ReviewerData(n)));
     main.SubjectCategories.ForEach(n => Subjects.Add(n.Data));
     main.KeyWordList.ForEach(n => Keywords.Add(n.Data));
     main.CoreCapabilities.ForEach(n => CoreCapabilities.Add(n.Data));
 }
Beispiel #2
0
        public IEnumerable <Funding> GetDataFunding()
        {
            string   filepath = @"C:\Users\User-SL\OneDrive\Υπολογιστής\fundings.json";
            Fundings fundings = new Fundings(); //

            using (StreamReader r = new StreamReader(filepath))
            {
                string json = r.ReadToEnd();                                                  //
                fundings.FundingList = JsonConvert.DeserializeObject <List <Funding> >(json); //
            }
            return(fundings.FundingList);                                                     //
        }
Beispiel #3
0
        public string LoadFundingsToDB()
        {
            string   filepath = @"C:\Users\User-SL\OneDrive\Υπολογιστής\fundings.json";
            Fundings fundings = new Fundings(); //

            using (StreamReader r = new StreamReader(filepath))
            {
                string json = r.ReadToEnd();                                                  //
                fundings.FundingList = JsonConvert.DeserializeObject <List <Funding> >(json); //
            }
            using (var db = new CrowDoDB())                                                   //
            {
                fundings.FundingList.ForEach(funding =>
                { //
                    string projectcode  = funding.ProjectCode;
                    ProjectItem project = db.Projects.Where(p => p.ProjectCode.Equals(projectcode)).First();
                    if (project != null)
                    {
                        funding.ProjectItem = project;
                        db.Fundings.Add(funding);
                    }
                });
                fundings.FundingList.ForEach(funding => //
                {
                    string usercode = funding.UserCode;
                    User user       = db.Users.Where(u => u.UserCode.Equals(usercode)).First();
                    if (user != null)
                    {
                        funding.User = user;
                        db.Fundings.Add(funding);
                    }
                });

                db.SaveChanges();
            }
            return("data transfered");
        }