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); }
public Boolean DeleteMapping(TemplateDTO template) { Boolean succeed = false; ISessionFactory sessionFactory = NhibernateSessionFactory.GetSessionFactory(NhibernateSessionFactory.SessionFactoryConfiguration.Application); TemplateDAO target = template.TemplateDTOToTemplateDomain().TemplateToTemplateDAO(); using (ISession session = sessionFactory.OpenSession()) { ServiceAccountDAO account = session.Query <ServiceAccountDAO>().Where(acount => acount.MappingTemplates.Contains(target)).SingleOrDefault(); using (ITransaction transaction = session.BeginTransaction()) { session.Delete(target); transaction.Commit(); succeed = transaction.WasCommitted; if (succeed) { UpdateAccountVersion(account.ServiceAccountId, account.AccountVersion + 1); } } } return(succeed); }
public static TemplateDAO TemplateToTemplateDAO(this Template param) { TemplateDAO target = new TemplateDAO(); target.TemplateId = param.TemplateId; target.TemplateName = param.TemplateName; target.Mapping = param.Mapping; return target; }