コード例 #1
0
        public async Task <IActionResult> Edit(SuProcessTemplateFlowConditionEditGetWithListModel FromForm)
        {
//            if (ModelState.IsValid)
            {
                var CurrentUser = await _userManager.GetUserAsync(User);

                //                var FieldId

                SqlParameter[] parameters =
                {
                    new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId)
                    ,                               new SqlParameter("@OId", FromForm.Condition.OId)
                    ,                               new SqlParameter("@Name", FromForm.Condition.Name ?? "")
                    ,                               new SqlParameter("@Description", FromForm.Condition.Description ?? "")
                    ,                               new SqlParameter("@MouseOver", FromForm.Condition.MouseOver ?? "")
                    ,                               new SqlParameter("@MenuName", FromForm.Condition.MenuName ?? "")
                    ,                               new SqlParameter("@ConditionTypeId", FromForm.Condition.ProcessTemplateConditionTypeId)
                    ,                               new SqlParameter("@FieldId", FromForm.Condition.ProcessTemplateFieldId)
                    ,                               new SqlParameter("@String", FromForm.Condition.ProcessTemplateFlowConditionString ?? "")
                    ,                               new SqlParameter("@Int", FromForm.Condition.ProcessTemplateFlowConditionInt ?? 0)
                    ,                               new SqlParameter("@Date", FromForm.Condition.ProcessTemplateFlowConditionDate)
                    ,                               new SqlParameter("@ComparisonOperatorId", FromForm.Condition.ComparisonOperatorId)
                    ,                               new SqlParameter("@DataTypeId", FromForm.Condition.DataTypeId)
                };

                _context.Database.ExecuteSqlCommand("ProcessTemplateFlowConditionEditPost " +
                                                    "@LanguageId, @OId, @Name, @Description, @MouseOver, @MenuName, @ConditionTypeId, @FieldId, " +
                                                    "@String, @Int, @Date, @ComparisonOperatorId, @DataTypeId",
                                                    parameters);
            }
            //            return  RedirectToRoute("EditRole" + "/"+test3.Classification.ClassificationId.ToString() );

            return(RedirectToAction("Index", new { Id = FromForm.Condition.OId.ToString() }));
        }
コード例 #2
0
        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);

            ViewBag.menuItems = await a.TopMenu(DefaultLanguageID);

            SqlParameter[] parameters =
            {
                new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId)
                ,                               new SqlParameter("@Id", Id)
            };

            var ProcessTemplateFlowConditionEditGet = _context.ZdbProcessTemplateFlowConditionEditGet.FromSql("ProcessTemplateFlowConditionEditGet @LanguageId, @Id", parameters).First();

            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()
                });
            }


            var ProcessTemplateFlowFieldsFromDb = _context.ZDbStatusList.FromSql($"ProcessTemplateFlowConditionCreateGetFields @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 ComparisonsFromDb = _context.ZDbLanguageList.FromSql($"ProcessTemplateFlowConditionCreateGetComparison").ToList();

            var ComparisonList = new List <SelectListItem>();

            foreach (var ComparisonFromDb in ComparisonsFromDb)
            {
                ComparisonList.Add(new SelectListItem
                {
                    Text  = ComparisonFromDb.Name,
                    Value = ComparisonFromDb.Id.ToString()
                });
            }


            var DataTypesFromDb = _context.ZDbSecurityLevelList.FromSql($"DataTypeSelectAll").ToList();

            var DataTypeList = new List <SelectListItem>();

            foreach (var DataTypeFromDb in DataTypesFromDb)
            {
                DataTypeList.Add(new SelectListItem
                {
                    Text  = DataTypeFromDb.Name,
                    Value = DataTypeFromDb.Id.ToString()
                });
            }



            var ConditionWithLists = new SuProcessTemplateFlowConditionEditGetWithListModel {
                Condition           = ProcessTemplateFlowConditionEditGet
                , ConditionTypeList = ProcessTemplateFlowConditionTypeList
                , FieldList         = ProcessTemplateFlowFieldList
                , ComparisonList    = ComparisonList
                , DataTypeList      = DataTypeList
            };

            return(View(ConditionWithLists));
        }