private void Import(TimeTracking.TimeTrackingDataSet.PROJEKTYDataTable pROJEKTYDataTable, Entities m_Entities) { Console.WriteLine("TimeTracking PROJEKTYDataTable starting"); foreach (var _row in pROJEKTYDataTable) { Projects _newProject = null; if (ProjectsMapping.MappingTable.ContainsKey(_row.ID)) { _newProject = GetOrAdd <Projects>(m_Entities.Projects, m_ProjectsDictionaryBugNet, ProjectsMapping.MappingTable[_row.ID]); m_ProjectsDictionaryTimeTracking.Add(_row.ID, _newProject); } else { _newProject = Create <Projects>(m_Entities.Projects, m_ProjectsDictionaryTimeTracking, _row.NAZWA_KROTKA, _row.ID); _newProject.Active = false; } _newProject.Body += String.Format("<br/> <b> mapped with {0} <b/>", _row.IsNAZWANull() ? "N/A" : _row.NAZWA); _newProject.Currency = GetCurrency("PLN"); if (!_row.IsID_UMOWYNull() && _newProject.Project2ContractTitle == null) { _newProject.Project2ContractTitle = GetOrAdd <Contracts>(m_Entities.Contracts, m_ContractDictionary, _row.ID_UMOWY); } if (_newProject.Project2ResourcesTitle == null && !_row.IsID_MANAGERANull()) { _newProject.Project2ResourcesTitle = GetOrAdd <Resources>(m_Entities.Resources, m_ResourcesDictionaryTimeTracking, _row.ID_MANAGERA); } if (_newProject.Project2StageTitle == null) { _newProject.Project2StageTitle = GetDefaultStage(m_Entities); } _newProject.ProjectBudget += _row.IsBUDZETNull() ? 0 : Convert.ToDouble(_row.BUDZET); if (!_row.IsDATA_KONIECNull()) { _newProject.Adjust(_row.DATA_KONIEC); } _newProject.ProjectHours += _row.IsLICZBA_GODZINNull() ? 0 : _row.LICZBA_GODZIN; _newProject.ProjectNumber += String.Format(" mapped with {0}", _row.IsNUMERNull() ? "N/A" : _row.NUMER); if (!_row.IsDATA_STARTNull()) { _newProject.Adjust(_row.DATA_START); } if (!_newProject.ProjectType.HasValue) { _newProject.ProjectType = _row.PODKATEGORIERow == null ? ProjectType.None : ProjectsMapping.m_ProjectTypeMapping[_row.PODKATEGORIERow.ID]; } if (!_newProject.ProjectWarrantyDate.HasValue) { _newProject.ProjectWarrantyDate = _row.IsDATA_GWARANCJANull() ? SPExtensions.SPMinimum : _row.DATA_GWARANCJA; } } m_Entities.SubmitChanges(); }
private void CalculateProjectActivity_ExecuteCode(object sender, EventArgs e) { using (Entities _edc = new Entities(this.workflowProperties.Web.Url)) { Projects _project = _edc.Projects.GetAtIndex <Projects>(workflowProperties.ItemId); _project.Adjust(_edc); _edc.SubmitChanges(); } }