コード例 #1
0
 public JsonResult SaveGlobalData(GlobalDataViewModel model)
 {
     return(ExecuteFunctionRun(() =>
     {
         ActionResult result = new ActionResult();
         //全局变量增加编码规范,不许输入特殊字符,目的是同步java导入流程包时,有特殊字符系统会报错的问题 add qiancheng
         System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^[\u4E00-\u9FA5a-zA-Z0-9_@\\\\.]*$");
         //^[\u4E00-\u9FA5a-zA-Z0-9_@\\\\.]*$
         if (!regex.Match(model.ItemName).Success)
         {
             result.Success = false;
             result.Message = "EditBizObjectSchemaProperty.Msg4";
             return Json(result, "text/html");
         }
         //TODO 增加新方法 CreatePrimitiveItem(GlobalDataViewModel Model)
         if (string.IsNullOrEmpty(model.ItemName))
         {
             //保存 Bugger:失败成功都返回0
             result.Success = this.Engine.MetadataRepository.CreatePrimitiveItem(model.ItemName, model.ItemValue, model.Description);//.GlobalDataManager.CreateItem(itemName, itemDesc, itemValue);
         }
         else
         {
             //更新
             result.Success = this.Engine.MetadataRepository.SetPrimitiveItemValue(model.ItemName, model.ItemValue, model.Description);//.GlobalDataManager.SetItemValue(itemName, itemValue);
         }
         return Json(result, JsonRequestBehavior.AllowGet);
     }));
 }
コード例 #2
0
        private async void Init()
        {
            GlobalDataViewModel thisMod = new GlobalDataViewModel(new GlobalDataLoaderClass(this), this);
            await thisMod.InitAsync();

            DataEntryHelper helps = new DataEntryHelper(thisMod);

            BindingContext = thisMod;
            if (thisMod.MainNickName == "")
            {
                helps.AddNormalTextRow("Main Nick Name", nameof(GlobalDataViewModel.MainNickName));
            }
            else
            {
                helps.AddNormalTextRow("Secondary Nick Name", nameof(GlobalDataViewModel.SecondaryNickName));
            }
            helps.AddNormalTextRow("Azure End Point", nameof(GlobalDataViewModel.AzureEndPointAddress));
            helps.AddNormalTextRow("Local Address", nameof(GlobalDataViewModel.HostIPAddress));
            helps.AddButton("Home Hosting", nameof(GlobalDataViewModel.ChangeServerOptionsCommand), EnumServerMode.HomeHosting);
            helps.AddButton("Azure Hosting", nameof(GlobalDataViewModel.ChangeServerOptionsCommand), EnumServerMode.AzureHosting);
            helps.AddButton("Local Hosting", nameof(GlobalDataViewModel.ChangeServerOptionsCommand), EnumServerMode.LocalHosting);
            helps.AddButton("Host In App", nameof(GlobalDataViewModel.ChangeServerOptionsCommand), EnumServerMode.MobileServer);
            helps.AddButton("Default Azure EP", nameof(GlobalDataViewModel.DefaultAzureCommand));
            helps.AddButton("Clear Azure", nameof(GlobalDataViewModel.ClearAzureCommand));
            helps.AddLabelRow("Current Nick Name", nameof(GlobalDataViewModel.CurrentNickName));
            helps.AddLabelRow("Server Hosting Option", nameof(GlobalDataViewModel.ServerMode), new ServerConverter());
            helps.AddButton("Save Settings", nameof(GlobalDataViewModel.SaveCommand));
            helps.AddButton("Use Main Nick Name", nameof(GlobalDataViewModel.MainNickCommand));
            ScrollView scroll = new ScrollView();

            scroll.Orientation = ScrollOrientation.Both; //try both this time.
            scroll.Content     = helps.CurrentGrid;
            Content            = scroll;
        }
コード例 #3
0
 public JsonResult GetGlobalData(string itemName)
 {
     return(ExecuteFunctionRun(() =>
     {
         //返回全局变量实例
         var item = this.Engine.MetadataRepository.GetPrimitiveItem(itemName);// .GlobalDataManager.GetItem(ItemName);
         GlobalDataViewModel model = null;
         if (item != null)
         {
             model = new GlobalDataViewModel()
             {
                 ObjectID = item.ObjectID,
                 ItemName = item.ItemName,
                 ItemValue = item.ItemValue,
                 Description = item.Description
             };
         }
         return Json(model, JsonRequestBehavior.AllowGet);
     }));
 }