private List <SelectionItem> BuildSelectionItemsList(Node selSetNode, NamedRequestObject parentItem)
        {
            var selItems = new List <SelectionItem>();

            foreach (var selNode in selSetNode.ChildNodes)
            {
                SelectionItem selItem = null;
                switch (selNode.Term.Name)
                {
                case TermNames.SelField:
                    selItem = BuildSelectionField(selNode, parentItem);
                    break;

                case TermNames.FragmSpread:
                    var name = selNode.ChildNodes[1].GetText();
                    selItem = new FragmentSpread()
                    {
                        Name = name, SourceLocation = selNode.GetLocation()
                    };
                    var dirListNode = selNode.FindChild(TermNames.DirListOpt);
                    selItem.Directives = BuildDirectives(dirListNode, DirectiveLocation.Field, selItem);
                    break;

                case TermNames.InlineFragm:
                    selItem = BuildInlineFragment(selNode);
                    break;
                }
                if (selItem != null)
                {
                    selItems.Add(selItem);
                }
            }
            return(selItems);
        }
        /// <summary>
        /// 选择倍率
        /// </summary>
        /// <param name="obj"></param>
        private void RateSelected(object obj)
        {
            SelectionItem item = (SelectionItem)obj;

            SelectedRate = item.Header;
            IsOpen       = false;
        }
        private CustomFieldDefinitionModel LoadFieldTranslation(CustomFieldDefinitionModel original, string prefix, EntityTransaltion translation)
        {
            prefix = prefix + "[" + original.Name + "].";

            var translated = new CustomFieldDefinitionModel
            {
                Id          = original.Id,
                Name        = original.Name,
                ControlType = original.ControlType
            };

            if (translation != null)
            {
                translated.Label        = translation.GetTranslatedText(prefix + "Label");
                translated.DefaultValue = translation.GetTranslatedText(prefix + "DefaultValue");
            }

            foreach (var item in original.SelectionItems)
            {
                var translatedItem = new SelectionItem {
                    Value = item.Value
                };
                if (translation != null)
                {
                    translatedItem.Text = translation.GetTranslatedText(prefix + "SelectionItems[" + item.Value + "]");
                }
                translated.SelectionItems.Add(item);
            }

            return(translated);
        }
        private CustomFieldDefinitionModel LoadFieldDiff(CustomFieldDefinitionModel compared, string prefix, EntityTransaltion translation)
        {
            prefix = prefix + "[" + compared.Name + "].";

            var diff = new CustomFieldDefinitionModel
            {
                Id          = compared.Id,
                Name        = compared.Name,
                ControlType = compared.ControlType
            };

            if (translation != null)
            {
                diff.Label        = DiffHelper.GetDiffHtml(translation.GetOriginalText(prefix + "Label"), compared.Label);
                diff.DefaultValue = DiffHelper.GetDiffHtml(translation.GetOriginalText(prefix + "DefaultValue"), compared.DefaultValue);
            }

            foreach (var item in compared.SelectionItems)
            {
                var itemDiff = new SelectionItem {
                    Value = item.Value
                };
                if (translation != null)
                {
                    itemDiff.Text = DiffHelper.GetDiffHtml(translation.GetOriginalText(prefix + "SelectionItems[" + item.Value + "]"), item.Text);
                }
                diff.SelectionItems.Add(itemDiff);
            }

            return(diff);
        }
Example #5
0
 public FormAppByLocation()
 {
     m_SQLProfileManager               = new SQLProfileManager();
     m_LastSavedSelectionItem          = new SelectionItem();
     m_LastSavedSelectionItem.ItemName = "Last Selected Items";
     InitializeComponent();
 }
    IEnumerator initScene()
    {
        yield return(Request.ReadPersistent("ui/ui.xml", LayoutLoaded));

        if (layout != null)
        {
            XElement itemsEle = layout.Element("items");
            var      items    = itemsEle.Elements();
            int      index    = 0;
            foreach (XElement item in items)
            {
                string desc = item.Attribute("desc").Value;
                string icon = item.Attribute("icon").Value;
                Debug.Log(item);
                GameObject obj = GameObject.Instantiate(selectionItem);
                //obj.transform.r
                //obj.transform.parent = itemsPanel.gameObject.transform;
                //obj.GetComponent<RectTransform> ().localPosition = Vector3.zero;
                obj.transform.SetParent(itemsPanel.transform, false);
                RectTransform rectT = obj.GetComponent <RectTransform> ();
                rectT.localPosition = new Vector3(rectT.localPosition.x, rectT.localPosition.y - 170 * index);
                selectionItems.Add(obj);

                SelectionItem itemComp = obj.GetComponent <SelectionItem> ();
                itemComp.name      = desc;
                itemComp.text.text = I18n.Translate(desc);
                itemComp.SetOnClick(OnItemClick);
//				WWW www = new WWW(Path.Combine(Application.persistentDataPath, "ui/"+icon));
//				itemComp.image.sprite = Sprite.Create(www.texture, new Rect(0,0,www.texture.width, www.texture.height), new Vector2(0,0));
                StartCoroutine(LoadIcon("ui/" + icon, itemComp.image));
                index++;
            }
        }
    }
        /// <summary>
        /// adds an element to the element and listens to its "IsSelected" property to update the SelectionCount property
        /// use this method insteand of the "Add" one
        /// </summary>
        /// <param name="element"></param>
        public void AddItem(T element)
        {
            var item = new SelectionItem <T>(element);

            item.PropertyChanged += item_PropertyChanged;
            Add(item);
        }
Example #8
0
        private void listBoxSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            SelectionItem item = listBoxSelection.SelectedItem as SelectionItem;

            if (item != null)
            {
                MessageBox.Show(item.Range.Start.GetDocument().body.outerHTML);
            }
        }
Example #9
0
        /// <summary>
        /// Determines whether the specified item and feature is selected.
        /// </summary>
        /// <param name="index">The index of the item.</param>
        /// <param name="feature">The feature.</param>
        /// <returns><c>true</c> if the item is selected; otherwise, <c>false</c>.</returns>
        public bool IsItemSelected(int index, Enum feature = null)
        {
            if (this.IsEverythingSelected())
            {
                return(true);
            }

            var si = new SelectionItem(index, feature);

            return(this.selection.ContainsKey(si));
        }
Example #10
0
 override public void AddItem(SelectionItem item)
 {
     if (item is SelectionItemTraits traitItem)
     {
         AddTraitItem(traitItem);
     }
     else
     {
         AddTraitItem(new SelectionItemTraits(item));
     }
 }
Example #11
0
        /// <summary>
        /// Unselects the specified item.
        /// </summary>
        /// <param name="index">The index of the item.</param>
        /// <param name="feature">The feature.</param>
        public void Unselect(int index, Enum feature = null)
        {
            var si = new SelectionItem(index, feature);

            if (!this.selection.ContainsKey(si))
            {
                throw new InvalidOperationException("Item " + index + " and feature " + feature + " is not selected. Cannot unselect.");
            }

            this.selection.Remove(si);
        }
Example #12
0
        public void AddItem(Drawable item, Selected fcn_ptr, string music_name)
        {
            SelectionItem temp = new SelectionItem();

            temp.m_sprite = item;

            m_num_items++;

            if (++m_x == m_columns)
            {
                m_x = 0;
            }

            temp.m_sprite.X_Pos = m_xpos + (m_x * item.Width) + (m_x * m_spacing);
            temp.m_sprite.Y_Pos = m_ypos + (m_y * item.Height) + (m_y * m_spacing);
            // Make the item selectable
            m_grid[m_y, m_x].m_selectable = true;
            m_grid[m_y, m_x].m_list_index = m_num_items - 1;

            Console.WriteLine("Grid[" + m_y + ", " + m_x + "] Set to true");

            // Update rows
            if (m_y != (int)((m_num_items / m_columns)))
            {
                m_y++;
                m_rows++;
                m_grid = HelperUtils.ResizeArray <GridItem>(m_grid, m_rows, m_columns);

                // Set new constructed row to false
                for (int i = 0; i < m_columns; i++)
                {
                    m_grid[m_rows - 1, i] = new GridItem();
                    m_grid[m_rows - 1, i].m_selectable = false;
                }
            }
            temp.m_music_name = music_name;
            temp.m_fcn_ptr    = fcn_ptr;
            temp.m_border     = HelperUtils.BuildBorder(new Rectangle((int)temp.m_sprite.X_Pos, (int)temp.m_sprite.Y_Pos, temp.m_sprite.Width, temp.m_sprite.Height), m_border_width);

            if (m_list.Count == 0)
            {
                temp.m_selected = true;
                m_selected_x    = 0;
                m_selected_y    = 0;
                m_cue           = m_soundbank.GetCue(music_name);
            }
            else
            {
                temp.m_selected = false;
            }

            m_list.Add(temp);
        }
Example #13
0
        virtual public void AddItem(SelectionItem item)
        {
            items.Add(items.Count, item);
            string key            = item.GetDisplay();
            int    duplicateIndex = 0;

            while (alphaItems.ContainsKey(key))
            {
                key = item.GetDisplay() + "_" + duplicateIndex++;
            }
            alphaItems.Add(key, item);
        }
        public static void btnOK_OnClickStep(IQuickInsertAccountContact form, EventArgs args)
        {
            IUser    currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser;
            IContact contact     = form.CurrentEntity as IContact;
            IAccount account     = Sage.Platform.EntityFactory.Create <IAccount>();

            IAddress ad = Sage.Platform.EntityFactory.Create <IAddress>();

            ad.Description = contact.Address.Description;
            ad.Address1    = contact.Address.Address1;
            ad.Address2    = contact.Address.Address2;
            ad.Address3    = contact.Address.Address3;
            ad.Address4    = contact.Address.Address4;
            ad.City        = contact.Address.City;
            ad.State       = contact.Address.State;
            ad.PostalCode  = contact.Address.PostalCode;
            ad.Country     = contact.Address.Country;
            ad.County      = contact.Address.County;
            ad.Salutation  = contact.Address.Salutation;

            account.Address        = ad;
            account.AccountName    = form.txtAccount.Text;
            account.AccountManager = currentUser;
            account.Owner          = currentUser.DefaultOwner;
            account.Type           = form.pklType.PickListValue;
            account.MainPhone      = form.phAccountMain.Text;
            //if ((string.IsNullOrEmpty(contact.LastName)&&(string.IsNullOrEmpty(contact.FirstName))))
            //{
            //   contact.LastName = string.Format("New Contact for {0}",currentUser.UserInfo.UserName );
            //}
            contact.Account        = account;
            contact.AccountManager = currentUser;
            contact.Owner          = currentUser.DefaultOwner;
            contact.SaveContactAccount(account);

            ISelectionService srv     = ApplicationContext.Current.Services.Get <ISelectionService>(true);
            ISelectionContext sc      = new SimpleSelectionContext();
            SelectionInfo     selInfo = new SelectionInfo();
            SelectionItem     item    = new SelectionItem();

            item.Id = contact.Id.ToString();
            selInfo.Selections.Add(item);
            sc.Key           = "QuickInsertAccountContact";
            sc.SelectionInfo = selInfo;
            srv.SetSelectionContext(sc.Key, sc);

            Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>();
            if (refresher != null)
            {
                refresher.RefreshAll();
            }
        }
Example #15
0
        public PackageManagementForm()
        {
            InitializeComponent();

            _selector.Items.AddRange(new object[]
            {
                SelectionItem.Create(PackageCategory.Installed, Labels.Installed),
                SelectionItem.Create(PackageCategory.Online, Labels.Online),
                SelectionItem.Create(PackageCategory.Updates, Labels.Updates)
            });

            _packageDetails.Visible = false;
        }
Example #16
0
 private void InitSelectionItem()
 {
     RateColor               = "#FF818181";
     SelectedRate            = "1.0X";
     SelectionItemCollection = new ObservableCollection <SelectionItem>();
     string[] NameList = { "4.0X", "2.0X", "1.0X", "-2.0X", "-4.0X" };
     foreach (var item in NameList)
     {
         SelectionItem st = new SelectionItem();
         st.Header = item;
         SelectionItemCollection.Add(st);
     }
 }
        public async Task <IActionResult> SelectCandidate(int?credentialID, int candidateIndex, string submitButton)
        {
            SettingItem settingItem = await settingService.GetLatestSetting();

            SelectionItem selectionItem = new SelectionItem
            {
                CredentialID   = credentialID,
                CandidateIndex = candidateIndex,
                SelectionCount = settingItem.SelectionCount
            };

            return(View("SelectCandidate", selectionItem));
        }
Example #18
0
 private void ForceIsSelectedUpdate(ListBox listBoxControl)
 {
     for (int i = 0; i < listBoxControl.Items.Count; i++)
     {
         SelectionItem <string> it = listBoxControl.Items[i] as SelectionItem <string>;
         if (it.IsSelected)
         {
             it.IsSelected = !it.IsSelected;
             it.IsSelected = !it.IsSelected;
             listBoxControl.SelectedItems.Add(listBoxControl.Items[i]);
         }
     }
 }
        private void AddRuntimeRequestDirectives(SelectionItem selItem)
        {
            if (selItem.Directives == null || selItem.Directives.Count == 0)
            {
                return;
            }
            var allReqDirs = _requestContext.ParsedRequest.AllDirectives;

            foreach (var dir in selItem.Directives)
            {
                dir.MappedArgs = MapArguments(dir.Args, dir.Def.Args, dir);
                var rtDir = new RuntimeDirective(dir, allReqDirs.Count);
                allReqDirs.Add(rtDir);
            }
        }
Example #20
0
        private void DisplayPixelInfo(IRasterSource raster, NodeData nodePixel, SelectionItem pixel)
        {
            int bufferX, bufferY;

            raster.ImageToBuffer(pixel.Column, pixel.Row, out bufferX, out bufferY);

            if (raster.RenderingType != RasterRendering.Rgb)
            {
                var band = raster.ActiveBand;
                if (band != null)
                {
                    var nodeBand = nodePixel.AddSubItem("Band", raster.ActiveBandIndex);

                    double value;
                    nodeBand.AddSubItem("Value",
                                        band.GetValue(pixel.Column, pixel.Row, out value)
                            ? value.ToString(CultureInfo.InvariantCulture)
                            : "Failed to retrieve");

                    ShowRasterCellInfo(nodeBand, raster);

                    nodeBand.AddSubItem("Interpretation", band.ColorInterpretation.EnumToString());

                    ShowLocalStatistics(nodePixel, band, pixel);
                }
            }
            else
            {
                var nodeInfo = nodePixel.AddSubItem("Info", " ");
                ShowRasterCellInfo(nodeInfo, raster);
            }

            AddColor(nodePixel, raster.GetPixel(bufferY, bufferX));

            if (raster.RenderingType == RasterRendering.Rgb)
            {
                if (raster.UseRgbBandMapping)
                {
                    NodeData nodeRgb = nodePixel.AddSubItem("RGB mapping", " ");

                    DisplayRgbMapping(nodeRgb, raster, pixel);
                }
            }

            DisplayPixelPosition(nodePixel, pixel, raster);
        }
Example #21
0
        private void ExecuteCommands()
        {
            if (!IsSelected)
            {
                return;
            }
            var idList  = SelectionItem.Split(',');
            var command = GetKnownCommand();

            if (command != null)
            {
                foreach (var valueList in idList)
                {
                    command.Execute(valueList);
                }
            }
        }
Example #22
0
        private void DisplayRgbMapping(NodeData nodeRgb, IRasterSource raster, SelectionItem pixel)
        {
            var indices = new List <int>();

            if (!raster.UseRgbBandMapping)
            {
                for (int i = 1; i <= Math.Max(4, raster.NumBands); i++)
                {
                    indices.Add(i);
                }
            }
            else
            {
                indices.Add(raster.RedBandIndex);
                indices.Add(raster.GreenBandIndex);
                indices.Add(raster.BlueBandIndex);
                indices.Add(raster.AlphaBandIndex);
            }

            for (int i = 0; i < indices.Count; i++)
            {
                if (indices[i] <= 0 || indices[i] > raster.NumBands)
                {
                    continue;
                }

                string channel  = ((RgbChannel)i).EnumToString();
                var    nodeBand = nodeRgb.AddSubItem("Band " + (i + 1), channel);

                var band = raster.Bands[indices[i]];
                if (band != null)
                {
                    double value;
                    nodeBand.AddSubItem("Value",
                                        band.GetValue(pixel.Column, pixel.Row, out value)
                             ? value.ToString(CultureInfo.InvariantCulture)
                             : "Failed to retrieve");

                    if (raster.UseRgbBandMapping)
                    {
                        nodeBand.AddSubItem("Original index", indices[i]);
                    }
                }
            }
        }
Example #23
0
        public PackageListControl()
        {
            InitializeComponent();

            RestartPending = false;

            foreach (var button in _pager.Controls.OfType <PackagePageButton>())
            {
                if (button != _page1Button)
                {
                    button.Visible = false;
                }
            }

            foreach (Control control in _container.Controls)
            {
                control.Dock = DockStyle.Fill;
            }

            Loading = true;

            _packageStability.Items.AddRange(new object[]
            {
                SelectionItem.Create(PackageStability.StableOnly, Labels.StableOnly),
                SelectionItem.Create(PackageStability.IncludePrerelease, Labels.IncludePrerelease)
            });

            _packageStability.SelectedIndex = 0;

            _sortBy.Items.AddRange(new object[]
            {
                SelectionItem.Create(PackageQueryOrder.MostDownloads, Labels.MostDownloads),
                SelectionItem.Create(PackageQueryOrder.PublishedDate, Labels.PublishedDate),
                SelectionItem.Create(PackageQueryOrder.NameAscending, Labels.NameAscending),
                SelectionItem.Create(PackageQueryOrder.NameDescending, Labels.NameDescending),
            });

            _sortBy.SelectedIndex = 0;

            ReloadBoldFont();

            Disposed += PackageListControl_Disposed;
        }
Example #24
0
        private void DisplayPixelPosition(NodeData nodePixel, SelectionItem pixel, IRasterSource raster)
        {
            var nodeBuffer = nodePixel.AddSubItem("Position", " ");

            double projX, projY;

            raster.ImageToProjection(pixel.Column, pixel.Row, out projX, out projY);

            double degX, degY;

            if (_context.Map.ProjToDegrees(projX, projY, out degX, out degY))
            {
                nodeBuffer.AddSubItem("Latitude", GeoAngle.FromDouble(degY).ToString());
                nodeBuffer.AddSubItem("Longitude", GeoAngle.FromDouble(degX).ToString());
            }

            nodeBuffer.AddSubItem("Projected X", projX.ToString("0.0"));
            nodeBuffer.AddSubItem("Projected Y", projY.ToString("0.0"));
        }
Example #25
0
        public void Can_get_description_from_work_item()
        {
            try
            {
                TestUtils.InsertRows(_emptyIssuesGdb, _featureClass0, _poly0, 1);
                Row row = TestUtils.GetRow(_emptyIssuesGdb, _featureClass0, 1);

                var item = new SelectionItem(42, row);
                Assert.NotNull(item.Description);

                string description = item.GetDescription();

                Assert.NotNull(description);
            }
            finally
            {
                TestUtils.DeleteAllRows(_emptyIssuesGdb, _featureClass0);
            }
        }
Example #26
0
        public void UncheckOthers()
        {
            IsChecked = true;
            List <IBaseItem> list = GetParent().GetParent().GetItems();

            foreach (var item in list)
            {
                SelectionItem tmp = item as SelectionItem;
                if (item.Equals(GetParent()) || tmp == null)
                {
                    continue;
                }

                VisualContact _current = (tmp.GetContent() as VisualContact);
                _current.IsChecked = false;
                _current.Update();
            }
            Update();
        }
        public void SetSource(string key, IEnumerable <TModel> items, IEnumerable <TModel> excludeItems)
        {
            var properties = TypeDescriptor.GetProperties(typeof(TModel));
            var property   = properties.Cast <PropertyDescriptor>().FirstOrDefault(i => i.Name.EqIgnoreCase(key));

            if (property != null)
            {
                foreach (var item in items)
                {
                    var itemvalue     = property.GetValue(item);
                    var selectionItem = new SelectionItem(item)
                    {
                        IsEnabled = (excludeItems != null) ? !excludeItems.Any(i => Equals(itemvalue, property.GetValue(i))) : true
                    };
                    selectionItem.Checked = !selectionItem.IsEnabled;
                    Items.Add(selectionItem);
                }
            }
        }
Example #28
0
        private void ShowLocalStatistics(NodeData parent, RasterBand band, SelectionItem pixel)
        {
            double min, max, mean, stdDev;
            int    count;

            if (!band.ComputeLocalStatistics(pixel.Column, pixel.Row, LocalStatsRange, out min, out max, out mean, out stdDev,
                                             out count))
            {
                parent.AddSubItem("Local stats", "<failed to compute>");
            }
            else
            {
                var nodeStats = parent.AddSubItem("Local stats", LocalStatsRange + " pixel range");
                nodeStats.AddSubItem("Minimum", min);
                nodeStats.AddSubItem("Maximum", max);
                nodeStats.AddSubItem("Mean", mean);
                nodeStats.AddSubItem("Std. deviation", stdDev);
                nodeStats.AddSubItem("Count", count);
            }
        }
        public IActionResult SaveSelectionItem(SelectionItem selectionItem, string submitButton)
        {
            bool?operationResult = null;

            if (submitButton == "Continue")
            {
                operationResult = selectionService.SaveSelectionItem(selectionItem);
                return(RedirectToAction("SelectCandidate", "Selection", new { credentialID = selectionItem.CredentialID, candidateIndex = selectionItem.CandidateIndex + 1 }));
            }
            else if (submitButton == "Confirm")
            {
                operationResult = selectionService.SaveSelectionItem(selectionItem);
                return(RedirectToAction("ConfirmSelection", "Selection", new { credentialID = selectionItem.CredentialID }));
            }
            else
            {
                operationResult = selectionService.CancelSelections((int)selectionItem.CredentialID);
                return(RedirectToAction("Index", "Selection"));
            }
        }
        override public void AddItem(SelectionItem item)
        {
            string key            = item.GetDisplay();
            int    duplicateIndex = 0;

            while (alphaTraitItems.ContainsKey(key))
            {
                key = item.GetDisplay() + "_" + duplicateIndex++;
            }

            if (item is SelectionItemTraits)
            {
                traitItems.Add(traitItems.Count, item as SelectionItemTraits);
                alphaTraitItems.Add(key, item as SelectionItemTraits);
            }
            else
            {
                traitItems.Add(traitItems.Count, new SelectionItemTraits(item));
                alphaTraitItems.Add(key, new SelectionItemTraits(item));
            }
        }
Example #31
0
        public void AddItem(Drawable item, Selected fcn_ptr, string music_name)
        {
            SelectionItem temp = new SelectionItem();
            temp.m_sprite = item;

            m_num_items++;

            if (++m_x == m_columns)
            {
                m_x = 0;
            }

            temp.m_sprite.X_Pos = m_xpos + (m_x * item.Width) + (m_x * m_spacing);
            temp.m_sprite.Y_Pos = m_ypos + (m_y * item.Height) + (m_y * m_spacing);
            // Make the item selectable
            m_grid[m_y, m_x].m_selectable = true;
            m_grid[m_y, m_x].m_list_index = m_num_items - 1;

            Console.WriteLine("Grid[" + m_y + ", " + m_x + "] Set to true");

            // Update rows
            if (m_y != (int)((m_num_items/ m_columns)))
            {
                m_y++;
                m_rows++;
                m_grid = HelperUtils.ResizeArray<GridItem>(m_grid, m_rows, m_columns);

                // Set new constructed row to false
                for (int i = 0; i < m_columns; i++)
                {
                    m_grid[m_rows - 1, i] = new GridItem();
                    m_grid[m_rows - 1, i].m_selectable = false;
                }
            }
            temp.m_music_name = music_name;
            temp.m_fcn_ptr = fcn_ptr;
            temp.m_border = HelperUtils.BuildBorder(new Rectangle((int)temp.m_sprite.X_Pos, (int)temp.m_sprite.Y_Pos, temp.m_sprite.Width, temp.m_sprite.Height), m_border_width);

            if (m_list.Count == 0)
            {
                temp.m_selected = true;
                m_selected_x = 0;
                m_selected_y = 0;
                m_cue = m_soundbank.GetCue(music_name);
            }
            else
            {
                temp.m_selected = false;
            }

            m_list.Add(temp);
        }
Example #32
0
        private CustomFieldDefinitionModel LoadFieldTranslation(CustomFieldDefinitionModel original, string prefix, EntityTransaltion translation)
        {
            prefix = prefix + "[" + original.Name + "].";

            var translated = new CustomFieldDefinitionModel
            {
                Id = original.Id,
                Name = original.Name,
                ControlType = original.ControlType
            };

            if (translation != null)
            {
                translated.Label = translation.GetTranslatedText(prefix + "Label");
                translated.DefaultValue = translation.GetTranslatedText(prefix + "DefaultValue");
            }

            foreach (var item in original.SelectionItems)
            {
                var translatedItem = new SelectionItem { Value = item.Value };
                if (translation != null)
                {
                    translatedItem.Text = translation.GetTranslatedText(prefix + "SelectionItems[" + item.Value + "]");
                }
                translated.SelectionItems.Add(item);
            }

            return translated;
        }
Example #33
0
        private CustomFieldDefinitionModel LoadFieldDiff(CustomFieldDefinitionModel compared, string prefix, EntityTransaltion translation)
        {
            prefix = prefix + "[" + compared.Name + "].";

            var diff = new CustomFieldDefinitionModel
            {
                Id = compared.Id,
                Name = compared.Name,
                ControlType = compared.ControlType
            };

            if (translation != null)
            {
                diff.Label = DiffHelper.GetDiffHtml(translation.GetOriginalText(prefix + "Label"), compared.Label);
                diff.DefaultValue = DiffHelper.GetDiffHtml(translation.GetOriginalText(prefix + "DefaultValue"), compared.DefaultValue);
            }

            foreach (var item in compared.SelectionItems)
            {
                var itemDiff = new SelectionItem { Value = item.Value };
                if (translation != null)
                {
                    itemDiff.Text = DiffHelper.GetDiffHtml(translation.GetOriginalText(prefix + "SelectionItems[" + item.Value + "]"), item.Text);
                }
                diff.SelectionItems.Add(itemDiff);
            }

            return diff;
        }
        public static void btnOK_OnClickStep( IQuickInsertAccountContact form,  EventArgs args)
        {
            IUser currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser;
            IContact contact = form.CurrentEntity as IContact;
            IAccount account  = Sage.Platform.EntityFactory.Create<IAccount>();

            IAddress ad = Sage.Platform.EntityFactory.Create<IAddress>();
            ad.Description = contact.Address.Description;
            ad.Address1 = contact.Address.Address1;
            ad.Address2 = contact.Address.Address2;
            ad.Address3 = contact.Address.Address3;
            ad.Address4 = contact.Address.Address4;
            ad.City = contact.Address.City;
            ad.State = contact.Address.State;
            ad.PostalCode = contact.Address.PostalCode;
            ad.Country = contact.Address.Country;
            ad.County = contact.Address.County;
            ad.Salutation = contact.Address.Salutation;

            account.Address = ad;
            account.AccountName = form.txtAccount.Text;
            account.AccountManager = currentUser;
            account.Owner = currentUser.DefaultOwner;
            account.Type = form.pklType.PickListValue;
            account.MainPhone = form.phAccountMain.Text;
            //if ((string.IsNullOrEmpty(contact.LastName)&&(string.IsNullOrEmpty(contact.FirstName))))
            //{
            //   contact.LastName = string.Format("New Contact for {0}",currentUser.UserInfo.UserName );
            //}
            contact.Account = account;
            contact.AccountManager = currentUser;
            contact.Owner = currentUser.DefaultOwner;
            contact.SaveContactAccount(account);

            ISelectionService srv =  ApplicationContext.Current.Services.Get<ISelectionService>(true);
            ISelectionContext sc = new SimpleSelectionContext();
            SelectionInfo selInfo = new SelectionInfo();
            SelectionItem item = new SelectionItem();
            item.Id = contact.Id.ToString();
            selInfo.Selections.Add(item);
            sc.Key = "QuickInsertAccountContact";
            sc.SelectionInfo = selInfo;
            srv.SetSelectionContext(sc.Key,sc);

            Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get<Sage.Platform.WebPortal.Services.IPanelRefreshService>();
            if (refresher != null)
            {
                refresher.RefreshAll();
            }
        }
Example #35
0
        internal static bool GetSccFiles(SelectionItem item, out string[] files, bool includeSpecial, bool includeNoScc, IDictionary<string, uint> map)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            if (GetSccFiles(item.Hierarchy, item.SccProject, item.Id, out files, includeSpecial, includeNoScc, map))
            {
                // The managed package SDK for VS 2005 and VS2008 returns
                // new string[] { GetMkDocument() }; on the generic HierarchyNode
                // without checking if GetMkDocument returns a valid path

                // So: Unless the project itself overrides this method it might contain garbage
                // At least the BlackBerry add-in 1.0.1 has this issue, so we have to check

                int nEmpty = 0;

                foreach (string s in files)
                {
                    if (!IsValidPath(s))
                    {
                        nEmpty++;
                    }
                }

                if (nEmpty == 0)
                    return true; // No need to copy

                string[] fls = new string[files.Length - nEmpty];

                if (fls.Length > 0)
                {
                    int n = 0;
                    for (int i = 0; i < files.Length; i++)
                    {
                        string s = files[i];
                        if (!IsValidPath(s))
                            continue;

                        fls[n++] = s;
                    }
                }

                files = fls;
                return true;
            }

            return false;
        }
Example #36
0
 public TabPage(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
     selectionItem = new SelectionItem(automationElement, actionListener);
 }