public ServiceAccount Convert(IAccountSettings service) { ServiceAccount target = new ServiceAccount(); GoogleSheetsAccountSettings serviceAccount = (GoogleSheetsAccountSettings)service; target.ServiceAccountId = serviceAccount.ID; target.ServiceAccountName = serviceAccount.Name; target.Source = serviceAccount.Source; target.TestResult = serviceAccount.TestResult; target.Tokens = new List<Token>(); target.MinUpdateTime = serviceAccount.MinUpdateTime; target.AccountVersion = serviceAccount.AccountVersion; if (serviceAccount.Tokens != null && serviceAccount.Tokens.Count > 0) { foreach (GoogleSheetsAccountToken token in serviceAccount.Tokens) { Token targetToken = new Token(); targetToken = token.Convert(token); target.Tokens.Add(targetToken); } } if (serviceAccount.Templates != null && serviceAccount.Templates.Count > 0) { foreach (GoogleSheetsAccountTemplate template in serviceAccount.Templates) { Template targetTemplate = new Template(); targetTemplate = template.Convert(template); target.MappingTemplates.Add(targetTemplate); } } return target; }
public IAccountTemplate Convert(Template template) { ExcelAccountTemplate targetTemplate = new ExcelAccountTemplate(); targetTemplate.TemplateId = template.TemplateId; targetTemplate.TemplateName = template.TemplateName; if (template.Mapping.Count > 0) { targetTemplate.TaskID = (from templ in template.Mapping where templ.Key == "TaskID" select templ.Value).SingleOrDefault(); targetTemplate.SubtaskType = (from templ in template.Mapping where templ.Key == "SubtaskType" select templ.Value).SingleOrDefault(); targetTemplate.Summary = (from templ in template.Mapping where templ.Key == "Summary" select templ.Value).SingleOrDefault(); targetTemplate.Description = (from templ in template.Mapping where templ.Key == "Description" select templ.Value).SingleOrDefault(); targetTemplate.Status = (from templ in template.Mapping where templ.Key == "Status" select templ.Value).SingleOrDefault(); targetTemplate.Priority = (from templ in template.Mapping where templ.Key == "Priority" select templ.Value).SingleOrDefault(); targetTemplate.Product = (from templ in template.Mapping where templ.Key == "Product" select templ.Value).SingleOrDefault(); targetTemplate.Project = (from templ in template.Mapping where templ.Key == "Project" select templ.Value).SingleOrDefault(); targetTemplate.CreatedDate = (from templ in template.Mapping where templ.Key == "CreatedDate" select templ.Value).SingleOrDefault(); targetTemplate.CreatedBy = (from templ in template.Mapping where templ.Key == "CreatedBy" select templ.Value).SingleOrDefault(); Sources sour; var result = (from templ in template.Mapping where templ.Key == "Source" select templ.Value).SingleOrDefault(); Enum.TryParse(result, out sour); targetTemplate.Source = sour; targetTemplate.LinkToTracker = (from templ in template.Mapping where templ.Key == "LinkToTracker" select templ.Value).SingleOrDefault(); targetTemplate.TaskParent = (from templ in template.Mapping where templ.Key == "TaskParent" select templ.Value).SingleOrDefault(); targetTemplate.Estimation = (from templ in template.Mapping where templ.Key == "Estimation" select templ.Value).SingleOrDefault(); targetTemplate.TargetVersion = (from templ in template.Mapping where templ.Key == "TargetVersion" select templ.Value).SingleOrDefault(); targetTemplate.Comments = (from templ in template.Mapping where templ.Key == "Comments" select templ.Value).SingleOrDefault(); targetTemplate.Assigned = (from templ in template.Mapping where templ.Key == "Assigned" select templ.Value).SingleOrDefault(); } return(targetTemplate); }
public IAccountTemplate Convert(Template template) { GoogleSheetsAccountTemplate targetTemplate = new GoogleSheetsAccountTemplate(); targetTemplate.TemplateId = template.TemplateId; targetTemplate.TemplateName = template.TemplateName; if (template.Mapping.Count > 0) { targetTemplate.Mapping = (from tok in template.Mapping where tok.Key == "Mapping" select tok.Value).SingleOrDefault(); } return targetTemplate; }
public Template Convert(IAccountTemplate template) { Template target = new Template(); GoogleSheetsAccountTemplate currentTemplate = (GoogleSheetsAccountTemplate)template; target.TemplateName = currentTemplate.TemplateName; target.TemplateId = currentTemplate.TemplateId; List<MappingForSerialization> mappingList = new List<MappingForSerialization>(); MappingForSerialization map = new MappingForSerialization(); map.Key = "Mapping"; map.Value = currentTemplate.Mapping; mappingList.Add(map); //target.Mapping = mappingList.ToArray(); return target; }
public static Template TemplateDTOToTemplateDomain(this TemplateDTO param) { Template target = new Template(); target.TemplateId = param.TemplateId; target.TemplateName = param.TemplateName; foreach (MappingForSerialization item in param.Mapping) { if (item.Key != null && item.Value != null) { target.Mapping.Add(item.Key, item.Value); } } return target; }
public static Template TemplateDAOToTemplateDomain(this TemplateDAO param) { Template target = new Template(); target.TemplateId = param.TemplateId; target.TemplateName = param.TemplateName; target.Mapping = param.Mapping; return target; }