Example #1
0
        public Template SaveOrUpdate(Template template)
        {
            if (template.Id == default(int))
            {
                if (template.CreateBy == default(Guid)) template.CreateBy = SecurityContext.CurrentAccount.ID;
                if (template.CreateOn == default(DateTime)) template.CreateOn = TenantUtil.DateTimeNow();
            }

            template.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            template.LastModifiedOn = TenantUtil.DateTimeNow();

            return dao.Save(template);
        }
Example #2
0
        public Template SaveTemplate(Template template)
        {
            var insert = Insert("projects_templates")
                    .InColumnValue("id", template.Id)
                    .InColumnValue("title", template.Title)
                    .InColumnValue("description", template.Description)
                    .InColumnValue("create_by", template.CreateBy.ToString())
                    .InColumnValue("create_on", TenantUtil.DateTimeToUtc(template.CreateOn))
                    .InColumnValue("last_modified_by", template.LastModifiedBy.ToString())
                    .InColumnValue("last_modified_on", TenantUtil.DateTimeToUtc(template.LastModifiedOn))
                    .Identity(1, 0, true);

            template.Id = DbManager.ExecuteScalar<int>(insert);

            return template;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.Participant.IsAdmin || Page.Participant.IsVisitor)
                HttpContext.Current.Response.Redirect(PathProvider.BaseVirtualPath, true);

            if (Int32.TryParse(UrlParameters.EntityID, out projectTmplId))
            {
                Templ = Global.EngineFactory.GetTemplateEngine().GetByID(projectTmplId);
                Page.Master.JsonPublisher(Templ, "template");
            }

            var title = projectTmplId == 0 ? ProjectTemplatesResource.CreateProjTmpl : ProjectTemplatesResource.EditProjTmpl;

            Page.Title = HeaderStringHelper.GetPageTitle(title);

            _attantion.Options.IsPopup = true;
        }
        protected override void PageLoad()
        {
            if (!ProjectSecurity.IsAdministrator(SecurityContext.CurrentAccount.ID))
                HttpContext.Current.Response.Redirect(ProjectsCommonResource.StartURL, true);

            Utility.RegisterTypeForAjax(typeof(EditProjectTemplate));
            ((IStudioMaster)Master).DisabledSidePanel = true;

            if (Int32.TryParse(UrlParameters.EntityID, out _projectTmplId))
            {
                Templ = Global.EngineFactory.GetTemplateEngine().GetTemplate(_projectTmplId);
                JsonPublisher(Templ, "template");
            }

           InitBreadCrumbs();

        }
Example #5
0
        public Template Save(Template template)
        {
            using (var db = new DbManager(DatabaseId))
            {
                var insert = Insert(TemplatesTable)
                    .InColumnValue("id", template.Id)
                    .InColumnValue("title", template.Title)
                    .InColumnValue("description", template.Description)
                    .InColumnValue("create_by", template.CreateBy.ToString())
                    .InColumnValue("create_on", TenantUtil.DateTimeToUtc(template.CreateOn))
                    .InColumnValue("last_modified_by", template.LastModifiedBy.ToString())
                    .InColumnValue("last_modified_on", TenantUtil.DateTimeToUtc(template.LastModifiedOn))
                    .Identity(1, 0, true);

                template.Id = db.ExecuteScalar<int>(insert);

                return template;
            }
        }
        public ObjectWrapperBase CreateTemplate(string title, string description)
        {
            if (string.IsNullOrEmpty(title)) throw new ArgumentException(@"title can't be empty", "title");

            ProjectSecurity.DemandCreateProject();

            var template = new Template
            {
                Title = title,
                Description = description
            };

            EngineFactory.GetTemplateEngine().SaveOrUpdate(template).NotFoundIfNull();

            return new ObjectWrapperBase { Id = template.Id, Title = template.Title, Description = template.Description };
        }
 public int SaveTemplateAndCreateProject(Template template)
 {
     var tmpl = Global.EngineFactory.GetTemplateEngine().SaveTemplate(template);
     return  tmpl.Id;
 }
 public void SaveTemplate(Template template)
 {            
     Global.EngineFactory.GetTemplateEngine().SaveTemplate(template);
 }