// GET: Aspects
        public ActionResult Insert()
        {
            var model = new AspectViewModel();

            model.Operation = "I";
            var resultD = _domainsManager.Get();

            ViewBag.Domains = (IEnumerable <DomainEntity>)resultD.Entity;

            var listTypes        = new List <SelectListItem>();
            var listTypesStrings = _enumManager.GetActionsTypes();

            foreach (var item in listTypesStrings)
            {
                var sItem = new SelectListItem
                {
                    Text  = item,
                    Value = item
                };
                listTypes.Add(sItem);
            }

            ViewBag.ListTypes = listTypes;


            return(View("InsertEdit", model));
        }
Example #2
0
    public void OnViewShow(string ItemId, int _Index)
    {
        if (ItemId == null)
        {
            MainUICtr.Instance?.OnMessageBox("_AspectViewModel data error");
            return;
        }

        Index = _Index;

        ShowImageIndex.text = (_Index + 1).ToString();

        AspectViewModel = DataManager.Instance.DicAspect[ItemId];
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="AddSectionAspectWindow"/> class.
        /// </summary>
        public AddSectionAspectWindow()
        {
            InitializeComponent();

            AspectTypes = new List<AspectViewModel>();
            foreach (Type type in SectionParserCache.Types)
            {
                AspectViewModel vm = new AspectViewModel();
                vm.Type = type.Name;
                vm.DisplayName = InformationAttribute.GetDisplayName(type);
                vm.Description = InformationAttribute.GetDescription(type);

                AspectTypes.Add(vm);
            }

            SelectedType = AspectTypes[0];

            this.DataContext = this;
        }
        public ActionResult InsertEdit(AspectViewModel model)
        {
            if (!ModelState.IsValid)
            {
                TempData["ErrorMessage"] = "Transaction error";
                return(RedirectToAction("Index"));
            }
            model.ActionsList = !string.IsNullOrEmpty(model.ActionsListJson)? JsonConvert.DeserializeObject <List <ActionEntity> >(model.ActionsListJson) : new List <ActionEntity>();
            var entity = _mapper.Map <AspectViewModel, AspectEntity>(model);
            var result = model.Operation == "E" ? _aspectsManager.Update(entity) : _aspectsManager.Insert(entity);

            TempData["Result"] = result;
            if (!result.Success)
            {
                return(RedirectToAction("Index"));
            }
            var operation = model.Operation == "E" ? "Edit Aspect" : "Insert Aspect";

            StoreLog("Aspects", operation, (int)result.Entity);
            return(RedirectToAction("Edit", new { id = (int)result.Entity }));
        }
Example #5
0
 public void OnSetCurAspectModel(AspectViewModel _CurAspectModel)
 {
     CurDataSelectState.CurAspectModel = _CurAspectModel;
     CurDataSelectState.AspectId       = _CurAspectModel.Id;
 }