public void InitOrDie(IAppBuilder app) { IStorageService storage = ServiceFactory.Get <IStorageService>(); IItemFactory factory = ServiceFactory.Get <IItemFactory>(); ItemFactory.Register <IDefectConfiguration, DefectConfiguration>(); ItemFactory.Register <IIssueConfiguration, IssueConfiguration>(); ItemFactory.Register <IMailConfiguration, MailConfiguration>(); IConfigurationService conf = storage.GetConfiguration(); IMailConfiguration mailConf = factory.GetNew <IMailConfiguration>(); storage.Store(mailConf); IDefectConfiguration defetctConf = factory.GetNew <IDefectConfiguration>(); storage.Store(defetctConf); IIssueConfiguration issueConf = factory.GetNew <IIssueConfiguration>(); storage.Store(issueConf); IConfigurationService conf2 = storage.GetConfiguration(); }
public void StoreConfigurations(IMailConfiguration mailConf = null, IDefectConfiguration defectConf = null, IIssueConfiguration issueConf = null) { ConfigurationDbModel newConf = new ConfigurationDbModel(); UpdateConfiguration(newConf, mailConf, defectConf, issueConf); Configuration.AppConfiguration.Add(newConf); Configuration.SaveChanges(); }
/// <summary> /// Constructor. Manually set values to match your account. /// </summary> public TfsDefectService(IItemFactory itemFactory, IMailService mail, IStorageService storage, IIdentityService auth, IDefectConfiguration config) { Config = config ?? ServiceFactory.Get <IConfigurationService>().Defect; Factory = itemFactory ?? ServiceFactory.Get <IItemFactory>(); Mail = mail ?? ServiceFactory.Get <IMailService>(); Storage = storage ?? ServiceFactory.Get <IStorageService>(); Auth = auth ?? ServiceFactory.Get <IIdentityService>(); }
public bool SaveDefect(IDefectConfiguration item) { DefectConfigurationDbModel dbItem = new DefectConfigurationDbModel(item); if (Current.Defect == null || (dbItem.StartDate <= DateTime.Now && dbItem.StartDate > Current.Defect.StartDate)) { dbItem.ConfigurationId = Current.ID; dbItem.Configuration = Current; } Configuration.DefectConfiguration.Add(dbItem); return(Configuration.SaveChanges() > 0); }
public DefectCredentialsViewModel(IDefectConfiguration model) : base(model.ServiceName, model.Url) { Iteration = model.Iteration; AreaPath = model.AreaPath; SurveySystem = model.SurveySystem; WebAppId = model.WebAppId; Environment = model.Environment; Severity = model.Severity; DefectState = model.DefectState; DefectType = model.DefectType; Company = model.Company; ProjectPath = model.ProjectPath; UserAreaPath = model.UserAreaPath; WorkingFeature = model.WorkingFeature; WorkItemType = model.WorkItemType; }
public DefectConfiguration(IDefectConfiguration conf) : base(conf.ServiceName, conf.Url) { Iteration = conf.Iteration; AreaPath = conf.AreaPath; SurveySystem = conf.SurveySystem; WebAppId = conf.WebAppId; Environment = conf.Environment; Severity = conf.Severity; DefectState = conf.DefectState; DefectType = conf.DefectType; Company = conf.Company; ProjectPath = conf.ProjectPath; UserAreaPath = conf.UserAreaPath; WorkingFeature = conf.WorkingFeature; WorkItemType = conf.WorkItemType; }
public DefectConfigurationDbModel(IDefectConfiguration item) { Iteration = item.Iteration; AreaPath = item.AreaPath; SurveySystem = item.SurveySystem; WebAppId = item.WebAppId; Environment = item.Environment; Severity = item.Severity; DefectState = item.DefectState; DefectType = item.DefectType; Company = item.Company; ProjectPath = item.ProjectPath; UserAreaPath = item.UserAreaPath; WorkingFeature = item.WorkingFeature; WorkItemType = item.WorkItemType; ServiceName = item.ServiceName; Url = item.Url; StartDate = DateTime.Now; }
public bool Store(IDefectConfiguration item) { bool result = false; try { using (var service = Service) { result = service.SaveDefect(item); if (result) { Conf.Defect = item; } } } catch (Exception e) { Console.Write("Error on save item {0}: {1}", item.ServiceName, e.Message); } return(result); }
public IDefect GetNewDefect(int?id = null, string agency = null, string defectID = null, string defectType = null, string defectSystem = null, string foundIn = null, string environment = null) { IDefectConfiguration config = this.Config.Defect; IDefect defect = new DefectItem() { Id = id, DefectID = defectID, Agency = agency, SurveySystem = defectSystem ?? config.SurveySystem, FoundIn = foundIn ?? config.WebAppId, Environment = environment ?? config.Environment, DefectType = defectType ?? config.DefectType, AreaPath = HttpUtility.UrlDecode(config.AreaPath), Iteration = HttpUtility.UrlDecode(config.Iteration), State = config.DefectState, Severity = (SeverityLevel)Enum.Parse(typeof(SeverityLevel), config.Severity, true), }; return(defect); }
public void SetData(IDefectConfiguration conf, NetworkCredential credential) { defect = new DefectConfiguration(conf); defect.credential = new Credential(credential); }
private bool UpdateConfiguration(ConfigurationDbModel newConf, IMailConfiguration mailConf = null, IDefectConfiguration defectConf = null, IIssueConfiguration issueConf = null) { bool hasChanged = false; if (issueConf != null) { IssueConfigurationDbModel issueNewConf = new IssueConfigurationDbModel(issueConf); Configuration.IssueConfiguration.Add(issueNewConf); newConf.IssueId = issueNewConf.Id; newConf.Issue = issueNewConf; hasChanged = true; } if (defectConf != null) { DefectConfigurationDbModel defectNewConf = new DefectConfigurationDbModel(defectConf); Configuration.DefectConfiguration.Add(defectNewConf); newConf.IssueId = defectNewConf.Id; newConf.Defect = defectNewConf; hasChanged = true; } if (issueConf != null) { MailConfigurationDbModel mailNewConf = new MailConfigurationDbModel(mailConf); Configuration.MailConfiguration.Add(mailNewConf); newConf.IssueId = mailNewConf.Id; newConf.Mail = mailNewConf; hasChanged = true; } return(hasChanged); }
public bool Store(IDefectConfiguration item) { throw new NotImplementedException(); }
public ConfigurationService() { Mail = new WebConfigMailConfigurationItem(); Defect = new WebConfigDefectConfigurationItem(); Issue = new WebConfigIssueConfigurationItem(); }