Example #1
0
 private void PopulateFieldsListBox(int categoryId)
 {
     lstFields.ValueMember   = "Id";
     lstFields.DisplayMember = "Label";
     lstFields.DataSource    = FieldService.GetFieldsByCategoryId(categoryId)
                               .OrderBy(f => f.DisplayIndex).ToList();
 }
Example #2
0
 private void SaveColumnOrder()
 {
     foreach (DataGridViewColumn column in dgvShed.Columns)
     {
         FieldService.Update((int)column.Tag, column.DisplayIndex);
     }
 }
    async void InitField(int num, CancellationToken cancellationToken)
    {
        _dangeonFieldModel.IsFieldSetting = true;
        // 画面に設置済みのタイルを全て消す
        _dangeonFieldView.RemoveAllTiles();

        // floornum appear
        // _changeFloorCanvasView.SetActiveAll (true);
        // _changeFloorCanvasView.SetFloorNumText ($"FloorNum:{num}");

        using (var makeFieldSevice = new FieldService(
                   _dangeonFieldView.FieldWidth, _dangeonFieldView.FieldHeith,
                   (int)_playerModel.InitPosVec3.x, (int)_playerModel.InitPosVec3.z))
        {
            _dangeonFieldModel.Field = await makeFieldSevice.MakeFieldAsync(num, cancellationToken);

            _dangeonFieldModel.Map  = new MapClass[_dangeonFieldView.FieldWidth, _dangeonFieldView.FieldHeith];
            _dangeonFieldModel.Item = await makeFieldSevice.SetItemsAsync(num + 10, cancellationToken);
        }
        // 画面に設置する
        SetField();
        SetItems();
        // テスト用 ミニマップを全部表示
        //StartCheckWalkedTilesTest (49, 49);

        await UniTask.Delay(1000);  // todo

        // floornum disappear
        //_changeFloorCanvasView.SetActiveAll (false);
        _dangeonFieldModel.IsFieldSetting = false;
    }
Example #4
0
        private void btnRenameField_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(FieldInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    int    selectedFieldId   = (int)lstFields.SelectedValue;
                    string selectedFieldName = lstFields.Text;

                    FieldService.Update((int)lstFields.SelectedValue, frmGetInput.Input);

                    PopulateFieldsListBox((int)lstCategories.SelectedValue);
                    PopulateFieldsColumns((int)lstCategories.SelectedValue);
                    PopulateAccountRows((int)lstCategories.SelectedValue);

                    lstFields.SelectedValue = selectedFieldId;

                    SendMessage("'" + selectedFieldName + "' renamed to '" + frmGetInput.Input + ".'", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }
Example #5
0
        public static FieldViewModel Create(BLL.Field field, string tabId, int parentId)
        {
            var viewModel             = Create <FieldViewModel>(field, tabId, parentId);
            var allVeStylesAndFormats = SiteService.GetAllVeStyles().ToList();

            viewModel.ActiveVeCommands = viewModel.Data.ActiveVeCommandIds.Select(c => new QPCheckedItem {
                Value = c.ToString()
            }).ToList();
            viewModel.DefaultCommandsListItems = FieldService.GetDefaultVisualEditorCommands().Select(c => new ListItem {
                Value = c.Id.ToString(), Text = c.Alias
            }).ToArray();
            viewModel.AllStylesListItems = allVeStylesAndFormats.Where(s => s.IsFormat == false).Select(x => new ListItem {
                Value = x.Id.ToString(), Text = x.Name
            }).ToArray();
            viewModel.AllFormatsListItems = allVeStylesAndFormats.Where(s => s.IsFormat).Select(x => new ListItem {
                Value = x.Id.ToString(), Text = x.Name
            }).ToArray();
            viewModel.ActiveVeStyles = allVeStylesAndFormats.Where(s => s.IsFormat == false && viewModel.Data.ActiveVeStyleIds.Contains(s.Id)).Select(x => new QPCheckedItem {
                Value = x.Id.ToString()
            }).ToList();
            viewModel.ActiveVeFormats = allVeStylesAndFormats.Where(s => s.IsFormat && viewModel.Data.ActiveVeStyleIds.Contains(s.Id)).Select(x => new QPCheckedItem {
                Value = x.Id.ToString()
            }).ToList();
            viewModel.DefaultArticleIds       = viewModel.Data.DefaultArticleIds;
            viewModel.DefaultArticleListItems = viewModel.Data.DefaultArticleListItems;
            viewModel.Init();
            return(viewModel);
        }
Example #6
0
        public ActionResult New(string tabId, int parentId, int?fieldId)
        {
            var field = FieldService.New(parentId, fieldId);
            var model = FieldViewModel.Create(field, tabId, parentId);

            return(JsonHtml("Properties", model));
        }
Example #7
0
        public ActionResult _Index(string tabId, int parentId, int page, int pageSize, string orderBy)
        {
            var listCommand   = GetListCommand(page, pageSize, orderBy);
            var serviceResult = FieldService.List(parentId, listCommand);

            return(new TelerikResult(serviceResult.Data, serviceResult.TotalRecords));
        }
Example #8
0
        public ActionResult Index(string tabId, int parentId)
        {
            var result = FieldService.InitList(parentId);
            var model  = FieldListViewModel.Create(result, tabId, parentId);

            return(JsonHtml("Index", model));
        }
Example #9
0
        public ActionResult _RelateableFields(int?contentId, int?fieldId)
        {
            if (contentId == null)
            {
                return(Json(new
                {
                    success = true
                }));
            }

            if (contentId == 0 && fieldId.HasValue)
            {
                contentId = FieldService.Read(fieldId.Value).ContentId;
            }

            var content = ContentService.Read(contentId.Value);

            if (content == null)
            {
                throw new ArgumentException(string.Format(ContentStrings.ContentNotFound, contentId.Value));
            }

            Func <Field, bool> fieldFilter = f => true;

            if (fieldId.HasValue)
            {
                fieldFilter = f => !f.IsNew && f.Id != fieldId.Value;
            }

            return(Json(new
            {
                success = true,
                data = content.RelateableFields.Where(fieldFilter).Select(f => new { id = f.Id, text = f.Name })
            }));
        }
Example #10
0
        private void btnAddField_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(FieldInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    FieldService.AddNew(new Field {
                        CategoryId = (int)lstCategories.SelectedValue, Label = frmGetInput.Input
                    });

                    PopulateFieldsListBox((int)lstCategories.SelectedValue);
                    lstFields.SelectedIndex = (lstFields.Items.Count - 1);
                    PopulateFieldsColumns((int)lstCategories.SelectedValue);
                    PopulateAccountRows((int)lstCategories.SelectedValue);

                    AdjustGUI();

                    SendMessage("'" + frmGetInput.Input + "' added.", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }
Example #11
0
        public ActionResult _MultipleSelectForExport(
            string tabId, int parentId, [FromForm(Name = "IDs")] string ids, int page, int pageSize, string orderBy)
        {
            var listCommand   = GetListCommand(page, pageSize, orderBy);
            var serviceResult = FieldService.ListForExport(listCommand, parentId, Converter.ToInt32Collection(ids, ','));

            return(new TelerikResult(serviceResult.Data, serviceResult.TotalRecords));
        }
Example #12
0
        public ActionResult Properties(string tabId, int parentId, int id, string backendActionCode, FormCollection collection)
        {
            var field         = FieldService.ReadForUpdate(id);
            var model         = FieldViewModel.Create(field, tabId, parentId);
            var oldOrder      = model.Data.Order;
            var oldViewInList = model.Data.ViewInList;
            var oldLinkId     = model.Data.LinkId;
            var oldBackward   = model.Data.BackwardField;

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                try
                {
                    model.Data = FieldService.Update(model.Data);
                    PersistLinkId(oldLinkId, model.Data.LinkId);
                    PersistBackwardId(oldBackward, model.Data.BackwardField);
                    PersistVirtualFieldIds(model.Data.NewVirtualFieldIds);
                    AppendFormGuidsFromIds("DefaultArticleIds", "DefaultArticleUniqueIds");
                    AppendFormGuidsFromIds("Data.O2MDefaultValue", "Data.O2MUniqueIdDefaultValue");
                }
                catch (UserQueryContentCreateViewException uqEx)
                {
                    if (HttpContext.IsXmlDbUpdateReplayAction())
                    {
                        throw;
                    }

                    ModelState.AddModelError("UserQueryContentCreateViewException", uqEx.Message);
                    return(JsonHtml("Properties", model));
                }
                catch (VirtualContentProcessingException vcpEx)
                {
                    if (HttpContext.IsXmlDbUpdateReplayAction())
                    {
                        throw;
                    }

                    ModelState.AddModelError("VirtualContentProcessingException", vcpEx.Message);
                    return(JsonHtml("Properties", model));
                }

                var newOrder      = model.Data.Order;
                var newViewInList = model.Data.ViewInList;
                return(Redirect("Properties", new
                {
                    tabId,
                    parentId,
                    id = model.Data.Id,
                    successfulActionCode = backendActionCode,
                    orderChanged = newOrder != oldOrder,
                    viewInListAffected = newViewInList != oldViewInList
                }));
            }

            return(JsonHtml("Properties", model));
        }
        public JsonResult LoadVeConfig(int fieldId, int siteId)
        {
            var result = new JSendResponse {
                Status = JSendStatus.Success
            };

            VisualEditorStyleVm StyleMapFn(VisualEditorStyle entry) => new VisualEditorStyleVm
            {
                Name       = entry.Name,
                Element    = entry.Tag,
                Overrides  = entry.OverridesTag,
                Styles     = entry.StylesItems.Any() ? entry.StylesItems.ToDictionary(k => k.Name.Replace(' ', '_'), v => v.ItemValue) : null,
                Attributes = entry.AttributeItems.Any() ? entry.AttributeItems.ToDictionary(k => k.Name, v => v.ItemValue) : null
            };

            VisualEditorPluginVm PluginMapFn(VisualEditorPlugin entry) => new VisualEditorPluginVm
            {
                Name = entry.Name,
                Url  = entry.Url
            };

            var veCommands     = FieldService.GetResultVisualEditorCommands(fieldId, siteId).Where(n => n.On).ToList();
            var includedStyles = FieldService.GetResultStyles(fieldId, siteId).Where(ves => ves.On).OrderBy(ves => ves.Order).ToList();
            var model          = new VisualEditorConfigVm
            {
                StylesSet    = includedStyles.Where(ves => !ves.IsFormat).Select(StyleMapFn),
                FormatsSet   = includedStyles.Where(ves => ves.IsFormat).Select(StyleMapFn).EmptyIfNull(),
                ExtraPlugins = VisualEditorHelpers.GetVisualEditorPlugins(veCommands).Select(PluginMapFn).EmptyIfNull(),
                Toolbar      = VisualEditorHelpers.GenerateToolbar(veCommands)
            };

            if (fieldId != 0)
            {
                var field = FieldService.Read(fieldId);
                model.Language            = field.VisualEditor.Language;
                model.DocType             = field.VisualEditor.DocType;
                model.FullPage            = field.VisualEditor.FullPage;
                model.EnterMode           = field.VisualEditor.EnterMode;
                model.ShiftEnterMode      = field.VisualEditor.ShiftEnterMode;
                model.UseEnglishQuotes    = field.VisualEditor.UseEnglishQuotes;
                model.DisableListAutoWrap = field.VisualEditor.DisableListAutoWrap;
                model.Height      = field.VisualEditor.Height;
                model.BodyClass   = field.RootElementClass;
                model.ContentsCss = field.ExternalCssItems.Select(css => css.Url);
            }

            try
            {
                result.Data = model;
            }
            catch (Exception)
            {
                result.Status  = JSendStatus.Error;
                result.Message = "Непредвиденная ошибка на сервере";
            }

            return(JsonCamelCase(result));
        }
        public ActionResult StringEnum(string elementIdPrefix, int fieldID)
        {
            ViewBag.QueryDropDownListID = elementIdPrefix + "_queryDropDownList";
            ViewBag.IsNullCheckBoxID    = elementIdPrefix + "_isNullCheckBox";
            var model = FieldService.Read(fieldID).StringEnumItems.Select(o => new QPSelectListItem {
                Value = o.Value, Text = o.Alias
            }).ToList();

            return(JsonHtml("StringEnum", model));
        }
        public async Task <ActionResult> StringEnum(string elementIdPrefix, [FromQuery(Name = "fieldID")] int fieldId)
        {
            ViewBag.QueryDropDownListID = elementIdPrefix + "_queryDropDownList";
            ViewBag.IsNullCheckBoxID    = elementIdPrefix + "_isNullCheckBox";
            var model = FieldService.Read(fieldId).StringEnumItems.Select(o => new QPSelectListItem {
                Value = o.Value, Text = o.Alias
            }).ToList();

            return(await JsonHtml("StringEnum", model));
        }
Example #16
0
        public async Task <ActionResult> MultipleSelectForExportExpanded(string tabId, int parentId, [FromBody] SelectedItemsViewModel selModel)
        {
            var result = FieldService.InitList(parentId);
            var model  = new FieldSelectableListViewModel(result, tabId, parentId, selModel.Ids, ActionCode.MultipleSelectFieldForExportExpanded)
            {
                IsMultiple = true
            };

            return(await JsonHtml("MultiSelectIndex", model));
        }
Example #17
0
        public ActionResult MultipleSelectForExportExpanded(string tabId, int parentId, int[] IDs)
        {
            var result = FieldService.InitList(parentId);
            var model  = new FieldSelectableListViewModel(result, tabId, parentId, IDs, ActionCode.MultipleSelectFieldForExportExpanded)
            {
                IsMultiple = true
            };

            return(JsonHtml("MultiSelectIndex", model));
        }
Example #18
0
        public ActionResult VirtualProperties(string tabId, int parentId, int id, string successfulActionCode, bool?orderChanged, bool?viewInListAffected)
        {
            var content = FieldService.VirtualRead(id);
            var model   = FieldViewModel.Create(content, tabId, parentId);

            model.SuccesfulActionCode = successfulActionCode;
            model.OrderChanged        = orderChanged ?? false;
            model.ViewInListAffected  = viewInListAffected ?? false;
            return(JsonHtml("VirtualProperties", model));
        }
        public async Task <ActionResult> Register()
        {
            //Get all fields for display in view
            ViewBag.Field = await FieldService.GetRangeAsync(null);

            //Get all roles
            ViewBag.Roles = await RoleManager.Roles.ToListAsync();

            return(View());
        }
        public async Task <ActionResult> Register(RegisterViewModel model, UserViewModel user, string roleId)
        {
            if (ModelState.IsValid)
            {
                user.Info = new InfoViewModel {
                    FirstName = model.FirstName, LastName = model.LastName, Contact = model.Contact
                };

                bool adminResult = await Service.RegisterUser(AutoMapper.Mapper.Map <Model.Common.IApplicationUser>(user), model.Password);

                if (adminResult)
                {
                    if (!String.IsNullOrEmpty(roleId))
                    {
                        var role = await RoleManager.FindByIdAsync(roleId);

                        var result = await UserManager.AddToRoleAsync(user.Id, role.Name);

                        if (!result.Succeeded)
                        {
                            ModelState.AddModelError("", result.Errors.First().ToString());
                            //Get all fields for display in view
                            ViewBag.Field = await FieldService.GetRangeAsync(null);

                            //Get all roles
                            ViewBag.Roles = await RoleManager.Roles.ToListAsync();

                            return(View());
                        }
                    }
                }
                else
                {
                    //Get all fields for display in view
                    ViewBag.Field = await FieldService.GetRangeAsync(null);

                    //Get all roles
                    ViewBag.Roles = await RoleManager.Roles.ToListAsync();

                    return(View());
                }
                return(RedirectToAction("Index"));
            }
            else
            {
                //Get all fields for display in view
                ViewBag.Field = await FieldService.GetRangeAsync(null);

                //Get all roles
                ViewBag.Roles = await RoleManager.Roles.ToListAsync();

                return(View());
            }
        }
Example #21
0
 public WrapBot(string botName, int botTeam, int botIndex) : base(botName, botTeam, botIndex)
 {
     State        = BotState.Kickoff;
     Action       = BotAction.Default;
     Controller   = new Controller();
     Field        = new FieldService(botTeam);
     Ball         = new BallWrapper();
     Info         = new PlayerWrapper();
     Game         = new GameWrapper();
     DesiredState = null;
 }
Example #22
0
 public EditorPreloadingService(
     FieldService fieldService,
     IReadOnlyArticleService articleService,
     IProductService productService,
     EditorDataService editorDataService)
 {
     _fieldService      = fieldService;
     _articleService    = articleService;
     _productService    = productService;
     _editorDataService = editorDataService;
 }
Example #23
0
        public HomeController(StudentService studentService,
                              GovernorateService governorateService,
                              NeighborhoodService neighborhoodService,
                              FieldService fieldService

                              )
        {
            StudentService      = studentService;
            GovernorateService  = governorateService;
            NeighborhoodService = neighborhoodService;
            FieldService        = fieldService;
        }
Example #24
0
        private void DeleteFieldAndRefreshUI()
        {
            FieldService.Delete((int)lstFields.SelectedValue);

            SendMessage("'" + lstFields.Text + "' field deleted successfully.", Color.Green);

            PopulateFieldsListBox((int)lstCategories.SelectedValue);
            PopulateFieldsColumns((int)lstCategories.SelectedValue);
            PopulateAccountRows((int)lstCategories.SelectedValue);

            AdjustGUI();
        }
Example #25
0
 public JsonResult GetFieldsByEntityId(Guid entityId)
 {
     try
     {
         var records = FieldService.QueryFieldsByEntityId(entityId);
         return(Json(records, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(ex.Message, JsonRequestBehavior.AllowGet));
     }
 }
Example #26
0
        public FieldServiceAdapter(FieldService fieldService, IConnectionProvider connectionProvider)
        {
            if (fieldService == null)
            {
                throw new ArgumentNullException(nameof(fieldService));
            }

            _fieldService = fieldService;
            _fieldMap     = new ConcurrentDictionary <int, Field>();

            _customer = connectionProvider.GetCustomer();
        }
Example #27
0
 public JsonResult GetFieldById(Guid fieldId)
 {
     try
     {
         var record = FieldService.QueryFieldById(fieldId);
         return(Json(record, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(ex.Message, JsonRequestBehavior.AllowGet));
     }
 }
        public async Task <ActionResult> ContentsListForClassifier(string elementIdPrefix, [FromQuery(Name = "fieldID")] int fieldId)
        {
            var classifier = FieldService.Read(fieldId);

            ViewBag.ElementIdPrefix         = elementIdPrefix;
            ViewBag.ContentElementID        = string.Format("{0}_contentID", ViewBag.ElementIdPrefix);
            ViewBag.IsNullCheckBoxElementID = string.Format("{0}_isNullCheckBox", ViewBag.ElementIdPrefix);
            IEnumerable <QPSelectListItem> model = FieldService.GetAggregetableContentsForClassifier(classifier).Select(o => new QPSelectListItem {
                Value = o.Value, Text = o.Text
            }).ToList();

            return(await JsonHtml("ContentsListForClassifier", model));
        }
Example #29
0
        public FieldDetail()
        {
            InitializeComponent();

            _cropDataContext = new CropDataContext();
            _regionDataContext = new RegionDataContext();
            _service = new FieldService();
            _fieldDataAccessLayer = new FieldDataAccessLayer();
            _fieldCropDataAccessLayer = new FieldCropDataAccessLayer();
            _fieldSuveryResult = new FieldSurveyResult();
            App.RegionalCultureOverride = Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
            App.UICultureOverride = Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");
        }
Example #30
0
 public void Setup()
 {
     //Arrange
     manager    = new ConnectionManagementService(connectionString, databaseName);
     metadata   = new MetadataService(null, null);
     branch     = new BranchService();
     state      = new StateService();
     field      = new FieldService();
     validation = new ValidationService();
     KeyId      = new KeyGenerates(8);
     property   = new PropertyService();
     data       = new DataService();
 }
Example #31
0
        public ActionResult VirtualProperties(string tabId, int parentId, int id, FormCollection collection)
        {
            var field         = FieldService.ReadForUpdate(id);
            var model         = FieldViewModel.Create(field, tabId, parentId);
            var oldOrder      = model.Data.Order;
            var oldViewInList = model.Data.ViewInList;

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                try
                {
                    model.Data = VirtualFieldService.Update(model.Data);
                    PersistVirtualFieldIds(model.Data.NewVirtualFieldIds);
                }
                catch (UserQueryContentCreateViewException uqe)
                {
                    if (HttpContext.IsXmlDbUpdateReplayAction())
                    {
                        throw;
                    }

                    ModelState.AddModelError("UserQueryContentCreateViewException", uqe.Message);
                    return(JsonHtml("VirtualProperties", model));
                }
                catch (VirtualContentProcessingException vcpe)
                {
                    if (HttpContext.IsXmlDbUpdateReplayAction())
                    {
                        throw;
                    }

                    ModelState.AddModelError("VirtualContentProcessingException", vcpe.Message);
                    return(JsonHtml("Properties", model));
                }

                var newViewInList = model.Data.ViewInList;
                return(Redirect("VirtualProperties", new
                {
                    tabId,
                    parentId,
                    id = model.Data.Id,
                    successfulActionCode = ActionCode.UpdateField,
                    orderChanged = oldOrder != model.Data.Order,
                    viewInListAffected = newViewInList != oldViewInList
                }));
            }

            return(JsonHtml("VirtualProperties", model));
        }
Example #32
0
 public FieldCreator()
 {
     InitializeComponent();
     ((PivotItem)bodyPiv.Items[0]).Header = "基本信息";
     _guid = new Guid();
     _cropDataContext = new CropDataContext();
     _regionDataContext = new RegionDataContext();
     _fieldSuveryResult = new FieldSurveyResult();
     _regionDataContext.GetAllRegions((data) =>
     {
         _regionData = data;
         esRegion.DataContext = new ExpanderSelectorDataContext(_regionData.ToList<object>());
         _service = new FieldService();
         _fieldDataAccessLayer = new FieldDataAccessLayer();
         _field = new Field();
         _fieldCropList = new List<FieldCrop>();
     });
     App.RegionalCultureOverride = Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
     App.UICultureOverride = Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");
 }
Example #33
0
 public FieldList()
 {
     InitializeComponent();
     _service = new FieldService();
 }
Example #34
0
 public FieldDataContext()
 {
     _service = new FieldService();
     _dataAccessLayer = new FieldDataAccessLayer();
     _cropDataAccessLayer = new FieldCropDataAccessLayer();
 }