public IActionResult Edit(PageSectionAndStatusViewModel UpdatedPageSection) { if (ModelState.IsValid) { _context.Database.ExecuteSqlCommand("PageSectionUpdate @p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, " + "@p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17, @p18, @p19, @p20", parameters: new[] { UpdatedPageSection.SuObject.ObjectId.ToString() //0 , UpdatedPageSection.SuObject.Sequence.ToString() //1 , UpdatedPageSection.SuObject.ContentTypeId.ToString() //2 , UpdatedPageSection.SuObject.HasPaging.ToString() //3 , UpdatedPageSection.SuObject.MaxContent.ToString() //4 , UpdatedPageSection.SuObject.OneTwoColumns.ToString() //5 , UpdatedPageSection.SuObject.Type.ToString() //6 , UpdatedPageSection.SuObject.ShowContentTypeTitle.ToString() //7 , UpdatedPageSection.SuObject.ShowContentTypeTitleDescription.ToString() //8 , UpdatedPageSection.SuObject.ShowContentTypeTitle.ToString() //9 , UpdatedPageSection.SuObject.ShowContentTypeTitleDescription.ToString() //10 , UpdatedPageSection.SuObject.SortById.ToString() //11 , UpdatedPageSection.SuObject.LanguageId.ToString() //12 , UpdatedPageSection.SuObject.Name //13 , UpdatedPageSection.SuObject.Description //14 , UpdatedPageSection.SuObject.Title //15 , UpdatedPageSection.SuObject.TitleDescription //16 , UpdatedPageSection.SuObject.MouseOver //17 , DateTimeOffset.Now.ToString() //18 , UpdatedPageSection.SuObject.ObjectLanguageId.ToString() //19 , UpdatedPageSection.SuObject.Id.ToString() //20 }); } return(RedirectToAction("Index", new { Id = UpdatedPageSection.SuObject.Id.ToString() })); }
public IActionResult Edit(PageSectionAndStatusViewModel UpdatedStepField) { if (ModelState.IsValid) { _context.Database.ExecuteSqlCommand("ProcessTemplateStepFieldUpdate @p0, @p1, @p2", parameters: new[] { UpdatedStepField.SuObject.Id.ToString() //0 , UpdatedStepField.SuObject.Status.ToString() //1 , UpdatedStepField.SuObject.Sequence.ToString() //2 }); } // return RedirectToRoute("EditRole" + "/"+test3.Classification.ClassificationId.ToString() ); return(RedirectToAction("Index", new { Id = UpdatedStepField.SuObject.NotNullId2.ToString() })); }
public async Task <IActionResult> Create(int Id) { var CurrentUser = await _userManager.GetUserAsync(User); var DefaultLanguageID = CurrentUser.DefaultLanguageId; var UICustomizationArray = new UICustomization(_context); ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID); Menus a = new Menus(_context); ViewBag.menuItems = await a.TopMenu(DefaultLanguageID); SuObjectVMPageSection SuObject = new SuObjectVMPageSection { ObjectId = Id }; //Existing levels List <SelectListItem> StepList = (from s in _processTemplateStep.GetAllProcessTemplateSteps() join l in _processTemplateStepLanguage.GetAllProcessTemplateStepLanguages() on s.Id equals l.StepId where l.LanguageId == CurrentUser.DefaultLanguageId && s.ProcessTemplateId == Id orderby l.Name select new SelectListItem { Value = s.Id.ToString() , Text = l.Name }).ToList(); StepList.Add(new SelectListItem { Text = "No selection", Value = "0" }); var ClassificationAndStatus = new PageSectionAndStatusViewModel { SuObject = SuObject, SomeKindINumSelectListItem = StepList }; return(View(ClassificationAndStatus)); }
public async Task <IActionResult> Create(PageSectionAndStatusViewModel FromForm) { if (ModelState.IsValid) { var CurrentUser = await _userManager.GetUserAsync(User); _context.Database.ExecuteSqlCommand("ProcessTemplateFlowCreate @p0, @p1, @p2, @p3, @p4, @p5, @p6", parameters: new[] { FromForm.SuObject.ObjectId.ToString() //0 , FromForm.SuObject.NotNullId.ToString() //0 , FromForm.SuObject.NotNullId2.ToString() //0 , CurrentUser.DefaultLanguageId.ToString() //0 , FromForm.SuObject.Name //0 , FromForm.SuObject.Description //0 , FromForm.SuObject.MouseOver //0 }); } return(RedirectToAction("Index", new { Id = FromForm.SuObject.ObjectId.ToString() })); }
public IActionResult Create(PageSectionAndStatusViewModel FromForm) { if (ModelState.IsValid) { _context.Database.ExecuteSqlCommand("ProcessTemplateFlowConditionCreate @p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, " + "@p8, @p9, @p10", parameters: new[] { FromForm.SuObject.Id.ToString() //0 , FromForm.SuObject.LanguageId.ToString() //1 , FromForm.SuObject.Name //2 , FromForm.SuObject.Description //3 , FromForm.SuObject.MouseOver //4 , FromForm.SuObject.Type.ToString() //5 , FromForm.SuObject.NullId.ToString() //6 , FromForm.SuObject.Description2 //7 , FromForm.SuObject.NullId2.ToString() //8 , FromForm.SuObject.DateFrom.ToString() //9 , FromForm.SuObject.HeaderDescription }); } // return RedirectToRoute("EditRole" + "/"+test3.Classification.ClassificationId.ToString() ); return(RedirectToAction("Index", new { Id = FromForm.SuObject.Id.ToString() })); }
public async Task <IActionResult> Create(int Id) { SuObjectVMPageSection ToForm = new SuObjectVMPageSection { Id = Id }; var CurrentUser = await _userManager.GetUserAsync(User); var DefaultLanguageID = CurrentUser.DefaultLanguageId; var UICustomizationArray = new UICustomization(_context); ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID); Menus a = new Menus(_context); ViewBag.menuItems = await a.TopMenu(DefaultLanguageID); ToForm.LanguageId = CurrentUser.DefaultLanguageId; var ProcessTemplateFlowConditionTypesFromDb = _context.ZDbTypeList.FromSql($"ProcessTemplateFlowConditionCreateGetType").ToList(); var ProcessTemplateFlowConditionTypeList = new List <SelectListItem>(); foreach (var ProcessTemplateFlowConditionTypeFromDb in ProcessTemplateFlowConditionTypesFromDb) { ProcessTemplateFlowConditionTypeList.Add(new SelectListItem { Text = ProcessTemplateFlowConditionTypeFromDb.Name, Value = ProcessTemplateFlowConditionTypeFromDb.Id.ToString() }); } SqlParameter[] parameters = { new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId) , new SqlParameter("@Id", Id) }; var ProcessTemplateFlowFieldsFromDb = _context.ZDbStatusList.FromSql("GetProcessTemplateFlowConditionCreateGetFields @LanguageId, @Id", parameters).ToList(); var ProcessTemplateFlowFieldList = new List <SelectListItem> { new SelectListItem { Text = "No field", Value = "0" } }; foreach (var ProcessTemplateFlowFieldFromDb in ProcessTemplateFlowFieldsFromDb) { ProcessTemplateFlowFieldList.Add(new SelectListItem { Text = ProcessTemplateFlowFieldFromDb.Name, Value = ProcessTemplateFlowFieldFromDb.Id.ToString() }); } var ComparisonOperator = new List <SelectListItem> { new SelectListItem() { Text = "Equal", Value = "EQ" }, new SelectListItem() { Text = "Larger", Value = "LA" }, new SelectListItem() { Text = "Smaller", Value = "SM" }, new SelectListItem() { Text = "Larger or equal", Value = "LQ" }, new SelectListItem() { Text = "Smaller or equal", Value = "SQ" }, new SelectListItem() { Text = "Not equal", Value = "NQ" } }; var ClassificationAndStatus = new PageSectionAndStatusViewModel { SuObject = ToForm, SomeKindINumSelectListItem = ComparisonOperator, ProbablyTypeListItem = ProcessTemplateFlowConditionTypeList, ProbablyTypeListItem2 = ProcessTemplateFlowFieldList }; return(View(ClassificationAndStatus)); }
public async Task <IActionResult> Edit(int Id) { var CurrentUser = await _userManager.GetUserAsync(User); var DefaultLanguageID = CurrentUser.DefaultLanguageId; var UICustomizationArray = new UICustomization(_context); ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID); Menus a = new Menus(_context); SqlParameter[] parameters = { new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId) , new SqlParameter("@Id", Id) }; var PageSectionEditGet = _context.ZdbPageSectionEditGet.FromSql("PageSectionEditGet @LanguageId, @Id", parameters).First(); var PageSection = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.Id == Id && l.LanguageId == CurrentUser.DefaultLanguageId orderby c.Sequence select new SuObjectVMPageSection { Id = c.PageId , ObjectId = c.Id , LanguageId = l.LanguageId , ObjectLanguageId = l.Id , Type = c.PageSectionTypeId , ShowSectionTitle = c.ShowSectionTitleName , ShowSectionDescription = c.ShowSectionTitleDescription , ShowContentTypeTitle = c.ShowContentTypeTitle , ShowContentTypeTitleDescription = c.ShowContentTypeDescription , OneTwoColumns = c.OneTwoColumns , ContentTypeId = c.ContentTypeId , SortById = c.SortById , MaxContent = c.MaxContent , HasPaging = c.HasPaging , Sequence = c.Sequence , Name = l.Name , Description = l.Description , Title = l.TitleName , TitleDescription = l.TitleDescription , MouseOver = l.MouseOver }).First(); //Existing levels List <SelectListItem> ExistingLevels = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.PageId == PageSection.Id && l.LanguageId == CurrentUser.DefaultLanguageId orderby c.Sequence select new SelectListItem { Value = c.Sequence.ToString() , Text = l.Name }).ToList(); var TestForNull = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.Id == Id && l.LanguageId == CurrentUser.DefaultLanguageId select c.Sequence).ToList(); int MaxLevelSequence; if (TestForNull.Count() == 0) { MaxLevelSequence = 1; } else { MaxLevelSequence = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.Id == Id && l.LanguageId == CurrentUser.DefaultLanguageId select c.Sequence).Max(); MaxLevelSequence++; } ExistingLevels.Add(new SelectListItem { Text = "add at bottom", Value = MaxLevelSequence.ToString() }); //Existing levels //PageSectionTypes var ToForm = (from o in _pageSectionType.GetAllPageSectionTypes() join l in _pageSectionTypeLanguage.GetAllPageSectionTypeLanguages() on o.Id equals l.PageSectionTypeId where l.LanguageId == CurrentUser.DefaultLanguageId select new SuObjectVM { Id = o.Id , Name = l.Name }).ToList(); var TypeList = new List <SelectListItem>(); foreach (var TypeFromDb in ToForm) { TypeList.Add(new SelectListItem { Text = TypeFromDb.Name, Value = TypeFromDb.Id.ToString() }); } //PageSectionTypes //ContentType var ContentTypes = (from o in _contentType.GetAllContentTypes() join l in _contentTypeLanguage.GetAllContentTypeLanguages() on o.Id equals l.ContentTypeId where l.LanguageId == CurrentUser.DefaultLanguageId select new SuObjectVM { Id = o.Id , Name = l.Name }).ToList(); var ContentTypeList = new List <SelectListItem> { new SelectListItem { Value = "0", Text = "No type" } }; foreach (var TypeFromDb in ContentTypes) { ContentTypeList.Add(new SelectListItem { Text = TypeFromDb.Name, Value = TypeFromDb.Id.ToString() }); } //ContentType var ClassificationAndStatus = new PageSectionAndStatusViewModel { SuObject = PageSection, SomeKindINumSelectListItem = ExistingLevels, ProbablyTypeListItem = TypeList, ProbablyTypeListItem2 = ContentTypeList }; return(View(ClassificationAndStatus)); }
public async Task <IActionResult> Create(PageSectionAndStatusViewModel NewLevel) { if (ModelState.IsValid) { var CurrentUser = await _userManager.GetUserAsync(User); var TestForNull = ( from l in _pageSection.GetAllPageSections() where l.Id == NewLevel.SuObject.ObjectId select l.Sequence).Count(); int MaxLevelSequence; if (TestForNull == 0) { MaxLevelSequence = 1; } else { MaxLevelSequence = ( from c in _pageSection.GetAllPageSections() where c.PageId == NewLevel.SuObject.ObjectId select c.Sequence).Max(); MaxLevelSequence++; } if (NewLevel.SuObject.Sequence != MaxLevelSequence) { //Here need to update other levels to make sequence correct //https://stackoverflow.com/questions/812630/how-can-i-reorder-rows-in-sql-database List <IdAndSequence> ExistingLevels = (from c in _pageSection.GetAllPageSections() where c.PageId == NewLevel.SuObject.ObjectId && c.Sequence >= NewLevel.SuObject.Sequence select new IdAndSequence { Id = c.Id , Sequence = c.Sequence }).ToList(); int x = 0; while (x < ExistingLevels.Count()) { SuPageSectionModel u = new SuPageSectionModel(); u = _pageSection.GetPageSection(ExistingLevels[x].Id); u.Sequence = ++ExistingLevels[x].Sequence; _pageSection.UpdatePageSection(u); x++; } } var PageSection = new SuPageSectionModel { Sequence = NewLevel.SuObject.Sequence, PageId = NewLevel.SuObject.ObjectId, PageSectionTypeId = NewLevel.SuObject.Type, ShowSectionTitleName = NewLevel.SuObject.ShowSectionTitle, ShowSectionTitleDescription = NewLevel.SuObject.ShowSectionDescription, ShowContentTypeTitle = NewLevel.SuObject.ShowContentTypeTitle, ShowContentTypeDescription = NewLevel.SuObject.ShowContentTypeTitleDescription, OneTwoColumns = NewLevel.SuObject.OneTwoColumns }; if (NewLevel.SuObject.ContentTypeId != 0) { PageSection.ContentTypeId = NewLevel.SuObject.ContentTypeId; } PageSection.SortById = NewLevel.SuObject.SortById; PageSection.MaxContent = NewLevel.SuObject.MaxContent; PageSection.HasPaging = NewLevel.SuObject.HasPaging; var NewPageSection = _pageSection.AddPageSection(PageSection); var PageSectionLanguage = new SuPageSectionLanguageModel { Name = NewLevel.SuObject.Name, Description = NewLevel.SuObject.Description, TitleName = NewLevel.SuObject.Title, TitleDescription = NewLevel.SuObject.TitleDescription, MouseOver = NewLevel.SuObject.MouseOver, PageSectionId = NewPageSection.Id, LanguageId = CurrentUser.DefaultLanguageId }; _pageSectionLanguage.AddPageSectionLanguage(PageSectionLanguage); } return(RedirectToAction("Index", new { Id = NewLevel.SuObject.ObjectId.ToString() })); }
public async Task <IActionResult> Create(int Id) { var CurrentUser = await _userManager.GetUserAsync(User); var DefaultLanguageID = CurrentUser.DefaultLanguageId; var UICustomizationArray = new UICustomization(_context); ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID); Menus a = new Menus(_context); SuObjectVMPageSection SuObject = new SuObjectVMPageSection { ObjectId = Id }; List <SelectListItem> ExistingLevels = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.PageId == Id && l.LanguageId == CurrentUser.DefaultLanguageId orderby c.Sequence select new SelectListItem { Value = c.Sequence.ToString() , Text = l.Name }).ToList(); var TestForNull = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.Id == Id && l.LanguageId == CurrentUser.DefaultLanguageId select c.Sequence).ToList(); int MaxLevelSequence; if (TestForNull.Count() == 0) { MaxLevelSequence = 1; } else { MaxLevelSequence = (from c in _pageSection.GetAllPageSections() join l in _pageSectionLanguage.GetAllPageSectionLanguages() on c.Id equals l.PageSectionId where c.Id == Id && l.LanguageId == CurrentUser.DefaultLanguageId select c.Sequence).Max(); MaxLevelSequence++; } ExistingLevels.Add(new SelectListItem { Text = "add at bottom", Value = MaxLevelSequence.ToString() }); //PageSectionTypes var ToForm = (from o in _pageSectionType.GetAllPageSectionTypes() join l in _pageSectionTypeLanguage.GetAllPageSectionTypeLanguages() on o.Id equals l.PageSectionTypeId where l.LanguageId == CurrentUser.DefaultLanguageId select new SuObjectVM { Id = o.Id , Name = l.Name }).ToList(); var TypeList = new List <SelectListItem>(); foreach (var TypeFromDb in ToForm) { TypeList.Add(new SelectListItem { Text = TypeFromDb.Name, Value = TypeFromDb.Id.ToString() }); } //PageSectionTypes //ContentType var ContentTypes = (from o in _contentType.GetAllContentTypes() join l in _contentTypeLanguage.GetAllContentTypeLanguages() on o.Id equals l.ContentTypeId where l.LanguageId == CurrentUser.DefaultLanguageId select new SuObjectVM { Id = o.Id , Name = l.Name }).ToList(); var ContentTypeList = new List <SelectListItem> { new SelectListItem { Value = "0", Text = "No type" } }; foreach (var TypeFromDb in ContentTypes) { ContentTypeList.Add(new SelectListItem { Text = TypeFromDb.Name, Value = TypeFromDb.Id.ToString() }); } //ContentType var ClassificationAndStatus = new PageSectionAndStatusViewModel { SuObject = SuObject, SomeKindINumSelectListItem = ExistingLevels, ProbablyTypeListItem = TypeList, ProbablyTypeListItem2 = ContentTypeList }; return(View(ClassificationAndStatus)); }
public async Task <IActionResult> Edit(int Id) { var CurrentUser = await _userManager.GetUserAsync(User); var DefaultLanguageID = CurrentUser.DefaultLanguageId; var UICustomizationArray = new UICustomization(_context); ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID); Menus a = new Menus(_context); var StepField = (from sf in _processTemplateStepField.GetAllProcessTemplateStepFields() join s in _processTemplateStepLanguage.GetAllProcessTemplateStepLanguages() on sf.StepId equals s.StepId join f in _processTemplateFieldLanguage.GetAllProcessTemplateFieldLanguages() on sf.FieldId equals f.ProcessTemplateFieldId where sf.Id == Id && s.LanguageId == CurrentUser.DefaultLanguageId && f.LanguageId == CurrentUser.DefaultLanguageId select new SuObjectVMPageSection { Id = sf.Id , Status = sf.StatusId , Sequence = sf.Sequence , Name = s.Name , Description = f.Name , NotNullId = s.Id , NotNullId2 = f.ProcessTemplateFieldId }).First(); //dropdown for sequence List <SelectListItem> StepFieldList = (from sf in _processTemplateStepField.GetAllProcessTemplateStepFields() join f in _processTemplateFieldLanguage.GetAllProcessTemplateFieldLanguages() on sf.FieldId equals f.ProcessTemplateFieldId where sf.StepId == StepField.NotNullId && f.LanguageId == CurrentUser.DefaultLanguageId orderby sf.Sequence select new SelectListItem { Value = sf.Sequence.ToString() , Text = f.Name }).ToList(); int MaxFields; { MaxFields = (from sf in _processTemplateStepField.GetAllProcessTemplateStepFields() where sf.StepId == StepField.NotNullId select sf.Sequence).Max(); MaxFields++; } StepFieldList.Add(new SelectListItem { Text = "add at bottom", Value = MaxFields.ToString() }); //Existing levels //PageSectionTypes var StatussFromDB = (from s in _processTemplateStepFieldStatus.GetAllProcessTemplateStepFieldStatus() select new SuObjectVM { Id = s.Id , Name = s.Name }).ToList(); var StatusList = new List <SelectListItem>(); foreach (var StatusFromDb in StatussFromDB) { StatusList.Add(new SelectListItem { Text = StatusFromDb.Name, Value = StatusFromDb.Id.ToString() }); } //PageSectionTypes var ProcessTemplateStepFieldAndStatus = new PageSectionAndStatusViewModel { SuObject = StepField, SomeKindINumSelectListItem = StepFieldList, ProbablyTypeListItem = StatusList }; return(View(ProcessTemplateStepFieldAndStatus)); }