public void ActivateSwitch()
    {
        anim.SetBool("Trigger", true);
        anim.SetBool("Activate", true);

        AudioSource.PlayClipAtPoint(Sound1, transform.position);
        StopAnim    = true;
        isTriggered = true;
        foreach (GameObject door in Doors)
        {
            door.SendMessage("UnlockDoor");
        }

        if (isRespawner)
        {
            int i = 0;
            foreach (GameObject LookupItem in LookupObjects)
            {
                LookupItem.transform.position = ObjectPos[i];
                i++;
                if (LookupItem.CompareTag("PlatForm"))
                {
                    LookupItem.GetComponent <MoveingPlatform>().isMoving = false;
                }
            }
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Reapply the prioritization function to each of the updates currently
        /// stored in the priority queues.
        /// </summary
        public void Reprioritize(UpdatePriorityHandler handler)
        {
            MinHeapItem item;

            foreach (LookupItem lookup in new List <LookupItem>(m_lookupTable.Values))
            {
                if (lookup.Heap.TryGetValue(lookup.Handle, out item))
                {
                    uint pqueue  = item.PriorityQueue;
                    uint localid = item.Value.Entity.LocalId;

                    if (handler(ref pqueue, item.Value.Entity))
                    {
                        // unless the priority queue has changed, there is no need to modify
                        // the entry
                        pqueue = Util.Clamp <uint>(pqueue, 0, NumberOfQueues - 1);
                        if (pqueue != item.PriorityQueue)
                        {
                            lookup.Heap.Remove(lookup.Handle);

                            LookupItem litem = lookup;
                            litem.Heap = m_heaps[pqueue];
                            litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
                            m_lookupTable[localid] = litem;
                        }
                    }
                    else
                    {
                        // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
                        lookup.Heap.Remove(lookup.Handle);
                        m_lookupTable.Remove(localid);
                    }
                }
            }
        }
        /// <summary>
        /// InitDelegationOfNewTask
        /// </summary>
        /// <param name="listUrl">The listUrl.</param>
        /// <returns></returns>
        private DelegationOfNewTask InitDelegationOfNewTask(string listUrl)
        {
            DelegationOfNewTask delegationOfNewTask = new DelegationOfNewTask();

            delegationOfNewTask.Title    = string.Format("{0} - {1}", this.ddlFromEmployee.SelectedItem.Text, this.ddlToEmployee.SelectedItem.Text);
            delegationOfNewTask.FromDate = this.dtFromDate.SelectedDate.Date;
            delegationOfNewTask.ToDate   = this.dtToDate.SelectedDate.Date;
            DelegationModule delegationModule = this.delegationModulesDAL.GetByListUrl(listUrl);

            if (delegationModule != null)
            {
                delegationOfNewTask.ModuleName           = delegationModule.ModuleName;
                delegationOfNewTask.VietnameseModuleName = delegationModule.VietnameseModuleName;
                delegationOfNewTask.ListUrl = delegationModule.ListUrl;
            }
            delegationOfNewTask.FromEmployee = new LookupItem {
                LookupId = int.Parse(this.ddlFromEmployee.SelectedItem.Value), LookupValue = this.ddlFromEmployee.SelectedItem.Text
            };
            List <LookupItem>    toEmployees = new List <LookupItem>();
            JavaScriptSerializer seriallizer = new JavaScriptSerializer();
            var selectedToEmployees          = seriallizer.Deserialize <List <int> >(this.hdSelectedToEmployees.Value);

            foreach (var toEmployee in selectedToEmployees)
            {
                LookupItem lookupItem = new LookupItem();
                lookupItem.LookupId = toEmployee;
                toEmployees.Add(lookupItem);
            }
            delegationOfNewTask.ToEmployee = toEmployees;

            return(delegationOfNewTask);
        }
        private void cbb_Type_DropDownClosed(object sender, EventArgs e)
        {
            string nameToFind = cbb_Type.Text;

            if (nameToFind != "")
            {
                try
                {
                    LookupItem selectedValue = componentLifeItemList.First(item => item.name == nameToFind);

                    if (selectedValue != null)
                    {
                        materialB1B5Properties.elementdesignlife = selectedValue.value;
                        materialB1B5Properties.assetType         = selectedValue.name;
                    }
                }
                catch
                {
                    materialB1B5Properties.elementdesignlife  = 50;
                    materialB1B5Properties.buildingdesignlife = 50;
                    materialB1B5Properties.assetType          = "General";
                }
            }
            UpdateValue();
        }
Exemplo n.º 5
0
        public void UCITestGetValueFromLookup_MultiAndSingle_ReturnsTheSameResult()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Accounts");

                xrmApp.Grid.SwitchView("Active Accounts");

                xrmApp.Grid.OpenRecord(0);

                xrmApp.ThinkTime(2000);

                var primaryContactLookupItem = new LookupItem {
                    Name = "primarycontactid"
                };

                string lookupValue = xrmApp.Entity.GetValue(primaryContactLookupItem);
                Debug.WriteLine($"Single-Value: {lookupValue ?? "null"}");

                string[] lookupValues = xrmApp.Entity.GetValue(new[] { primaryContactLookupItem });
                Assert.IsNotNull(lookupValues);
                Assert.IsTrue(lookupValues.Length == 0 && lookupValue == string.Empty || string.Equals(lookupValue, lookupValues[0]));

                Debug.WriteLine($"Multi-Value: {lookupValues.FirstOrDefault() ?? "null"}");
            }
        }
Exemplo n.º 6
0
 public FLUTItem(FLUTable frm)
 {
     InitializeComponent();
     parentlForm = frm;
     type        = "Add";
     lookupItem  = new LookupItem();
 }
Exemplo n.º 7
0
        public void WEBTestCreateNewCase()
        {
            using (var xrmBrowser = new Api.Browser(TestSettings.Options))
            {
                xrmBrowser.LoginPage.Login(_xrmUri, _username, _password);

                xrmBrowser.GuidedHelp.CloseGuidedHelp();

                xrmBrowser.ThinkTime(500);
                xrmBrowser.Navigation.OpenSubArea("Service", "Cases");

                xrmBrowser.ThinkTime(3000);

                xrmBrowser.Grid.SwitchView("Active Cases");

                xrmBrowser.ThinkTime(2000);
                xrmBrowser.CommandBar.ClickCommand("New Case");
                xrmBrowser.ThinkTime(2000);

                xrmBrowser.Entity.SetValue("title", "Test API Case");

                var customerLookup = new LookupItem {
                    Name = "customerid", Index = 0
                };
                xrmBrowser.Entity.SelectLookup(customerLookup);

                xrmBrowser.CommandBar.ClickCommand("Save & Close");
                xrmBrowser.ThinkTime(10000);
            }
        }
Exemplo n.º 8
0
        public void UCITestOpenActiveLeadBPF()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecrectKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Leads");

                xrmApp.Grid.OpenRecord(0);

                LookupItem acct = new LookupItem();
                acct.Name  = "parentaccountid";
                acct.Value = "Adventure Works (sample)";

                LookupItem contact = new LookupItem();
                contact.Name  = "parentcontactid";
                contact.Value = "Nancy Anderson (sample)";

                xrmApp.BusinessProcessFlow.SelectStage("Qualify");

                xrmApp.BusinessProcessFlow.SetValue(acct);
                xrmApp.BusinessProcessFlow.SetValue(contact);
                xrmApp.BusinessProcessFlow.SetValue("budgetamount", "100.00");

                xrmApp.ThinkTime(3000);
            }
        }
        public void InserItem(HAPPYWPF.Wrapper.MensagemData item, string nomeFuncionario)
        {
            HAPPYWCF.Mensagem MSNDATA = new Mensagem();
            MSNDATA.Id       = item.Id;
            MSNDATA.Texto    = item.Titulo;
            MSNDATA.Rosa     = item.Rosa;
            MSNDATA.Vermelho = item.Vermelho;
            MSNDATA.Azul     = item.Azul;

            _funcionarioLookupProvider.AddMensagens(MSNDATA);

            LookupItem lk = new LookupItem();

            lk.DisplayValue = item.Titulo;
            lk.Id           = item.Id;
            lk.Rosa         = item.Rosa;
            lk.Vermelho     = item.Vermelho;
            lk.Azul         = item.Azul;


            NavigationItems.Add(
                new MenuItemFuncionariosViewModel(
                    lk.Id,
                    lk.DisplayValue,
                    lk.Rosa,
                    lk.Vermelho,
                    lk.Azul,
                    _eventAggregator));
        }
Exemplo n.º 10
0
 public DelegationModel()
 {
     FromEmployee = new User();
     ToEmployee   = new List <LookupItem>();
     Requester    = new LookupItem();
     Department   = new LookupItem();
 }
Exemplo n.º 11
0
        private async Task CreateCountriesAsync()
        {
            var countriesEn = DataUtility.GetCountries("en");
            var coutriesAr  = DataUtility.GetCountries("ar");

            var index = 1;

            foreach (var country in countriesEn)
            {
                var newCountryEn = new LookupItem
                {
                    CategoryId   = LocaleCategory.Countries,
                    Lang         = Language.en_US,
                    LocaleId     = index,
                    LocaleString = country.Item2
                };

                var newCountryAr = new LookupItem
                {
                    CategoryId   = LocaleCategory.Countries,
                    Lang         = Language.ar_JO,
                    LocaleId     = index,
                    LocaleString = coutriesAr.FirstOrDefault(c => c.Item1 == country.Item1).Item2
                };

                index++;

                await this.context.LookupItems.AddAsync(newCountryEn);

                await this.context.LookupItems.AddAsync(newCountryAr);
            }

            await this.context.SaveChangesAsync();
        }
Exemplo n.º 12
0
        public void Validate_WhenValid_HasNoErrors()
        {
            var mockPickListItem = new PickListItem {
                Id = 123
            };
            var mockLookupItem = new LookupItem {
                Id = Guid.NewGuid()
            };
            var mockPrivacyPolicy = new PrivacyPolicy {
                Id = Guid.NewGuid()
            };

            var request = new MailingListAddMember()
            {
                CandidateId = null,
                PreferredTeachingSubjectId  = mockLookupItem.Id,
                AcceptedPolicyId            = (Guid)mockPrivacyPolicy.Id,
                ConsiderationJourneyStageId = mockPickListItem.Id,
                DegreeStatusId  = mockPickListItem.Id,
                Email           = "*****@*****.**",
                FirstName       = "John",
                LastName        = "Doe",
                AddressPostcode = "KY11 9YU",
            };

            var result = _validator.TestValidate(request);

            // Ensure no validation errors on root object (we expect errors on the Candidate
            // properties as we can't mock them).
            var propertiesWithErrors = result.Errors.Select(e => e.PropertyName);

            propertiesWithErrors.All(p => p.StartsWith("Candidate.")).Should().BeTrue();
        }
Exemplo n.º 13
0
        private void SelectItem(LookupItem item)
        {
            if (item.Id > 0)
            {
                // if backed by a TextFieldViewModel, call SetText to circumvent the typing delay
                var textFieldViewModel = this.DataContext as TextFieldViewModelBase;
                if (textFieldViewModel != null)
                {
                    textFieldViewModel.SetText(item.Label);
                }
                else
                {
                    AutoCompleteText = item.Label;
                }

                SelectAll();

                SelectedId  = item.Id;
                IsPopupOpen = false;
            }
            else
            {
                IsPopupOpen = false;
            }
        }
Exemplo n.º 14
0
        private async Task CreateHoroscpesAsync()
        {
            var horoscpesEn = DataUtility.GetHoroscopes("en");
            var horoscpesAr = DataUtility.GetHoroscopes("ar");

            var index = 1;

            foreach (var horoscope in horoscpesEn)
            {
                var newHoroscopeEn = new LookupItem
                {
                    CategoryId   = LocaleCategory.Horoscopes,
                    Lang         = Language.en_US,
                    LocaleId     = int.Parse(horoscope.Item1),
                    LocaleString = horoscope.Item2
                };

                var newHoroscopeAr = new LookupItem
                {
                    CategoryId   = LocaleCategory.Horoscopes,
                    Lang         = Language.ar_JO,
                    LocaleId     = int.Parse(horoscope.Item1),
                    LocaleString = horoscpesAr.FirstOrDefault(c => c.Item1 == horoscope.Item1).Item2
                };

                index++;

                await this.context.LookupItems.AddAsync(newHoroscopeEn);

                await this.context.LookupItems.AddAsync(newHoroscopeAr);
            }

            await this.context.SaveChangesAsync();
        }
Exemplo n.º 15
0
        public void UCITestOpenContactRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Contacts");

                xrmApp.RelatedGrid.OpenGridRow(0);

                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                string emailAddress = xrmApp.Entity.GetHeaderValue("emailaddress1");

                xrmApp.ThinkTime(2000);
            }
        }
Exemplo n.º 16
0
        public void UCITestOpenCaseRetrieveHeaderValues_SetLookup()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                LookupItem ownerId = new LookupItem {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                client.Browser.Driver.ClearFocus();

                ownerId.Value = "Angel Rodriguez";
                xrmApp.Entity.SetHeaderValue(ownerId);

                ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);
                Assert.AreEqual(ownerId.Value, ownerIdValue);

                xrmApp.ThinkTime(2000);
            }
        }
Exemplo n.º 17
0
        public void UCITestRetrieveBPFFields()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Leads");

                xrmApp.Grid.OpenRecord(0);

                LookupItem contact = new LookupItem()
                {
                    Name = "parentcontactid"
                };
                LookupItem account = new LookupItem()
                {
                    Name = "parentaccountid"
                };

                xrmApp.BusinessProcessFlow.SelectStage("Qualify");

                string contactName = xrmApp.BusinessProcessFlow.GetValue(contact);
                string acctName    = xrmApp.BusinessProcessFlow.GetValue(account);
                string budgetAmt   = xrmApp.BusinessProcessFlow.GetValue("budgetamount");

                string status = xrmApp.Entity.GetFooterStatusValue();

                xrmApp.ThinkTime(1000);
            }
        }
Exemplo n.º 18
0
        public void UCITestLookupSearch()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Contacts");

                xrmApp.Grid.OpenRecord(0);

                LookupItem parentCustomerId = new LookupItem {
                    Name = "parentcustomerid"
                };
                xrmApp.Entity.SelectLookup(parentCustomerId);

                xrmApp.Lookup.SelectRelatedEntity("Accounts");

                xrmApp.Lookup.SwitchView("My Active Accounts");

                xrmApp.Lookup.OpenRecord(0);

                xrmApp.ThinkTime(3000);
            }
        }
Exemplo n.º 19
0
        public void UCITestOpenCase_SetHeaderValues()
        {
            _xrmApp.Grid.SwitchView("Active Cases");

            _xrmApp.Grid.OpenRecord(0);

            LookupItem ownerId = new LookupItem {
                Name = "ownerid"
            };

            ownerId.Value = _xrmApp.Entity.GetHeaderValue(ownerId);

            _client.Browser.Driver.ClearFocus();

            _xrmApp.Entity.SetHeaderValue(ownerId);

            var ownerIdValue = _xrmApp.Entity.GetHeaderValue(ownerId);

            Assert.AreEqual(ownerId.Value, ownerIdValue);

            OptionSet priorityCode = new OptionSet
            {
                Name  = "prioritycode",
                Value = "High"
            };

            _xrmApp.Entity.SetHeaderValue(priorityCode);
            string priorityCodeValue = _xrmApp.Entity.GetHeaderValue(priorityCode);

            Assert.AreEqual(priorityCode.Value, priorityCodeValue);

            _xrmApp.ThinkTime(2000);
        }
Exemplo n.º 20
0
 public static LookupItem StringToLookupItem(string listName, string itemTitle)
 {
     if (itemTitle.Contains(":"))
     {
         string[]   itemTitleSplit = itemTitle.Split(':');
         LookupItem rc             = new LookupItem(itemTitleSplit[0].ToInt(), itemTitleSplit[1]);
         if (rc.ItemId == 0)
         {
             return(null);
         }
         else
         {
             return(rc);
         }
     }
     else
     {
         int?itemId = SPHelper.GetListItemId(listName, itemTitle);
         if (itemId.HasValue)
         {
             return(new LookupItem(itemId.Value, itemTitle));
         }
         else
         {
             return(null);
         }
     }
 }
Exemplo n.º 21
0
        public void UCITestOpenCaseRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                OptionSet priorityCode = new OptionSet()
                {
                    Name = "prioritycode"
                };
                string priorityCodeValue = xrmApp.Entity.GetHeaderValue(priorityCode);

                xrmApp.ThinkTime(2000);
            }
        }
Exemplo n.º 22
0
        public void UCITestCreateCase()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.CommandBar.ClickCommand("New Case");

                xrmApp.ThinkTime(5000);

                xrmApp.Entity.SetValue("title", TestSettings.GetRandomString(5, 10));

                LookupItem customer = new LookupItem {
                    Name = "customerid", Value = "Test Lead"
                };
                xrmApp.Entity.SetValue(customer);

                xrmApp.Entity.Save();
            }
        }
Exemplo n.º 23
0
        private static PBNProposalWrappedLookupItem GetWrappedLookupItemForMethods(
            LookupItem <MethodsInfo> candidate,
            CoReProposal[] coreProposals)
        {
            var proposals      = candidate.ToProposals();
            var matches        = Lists.NewList <IName>();
            var probabilities2 = Lists.NewList <double>();

            // for all proposals
            foreach (var p in proposals)
            {
                // find the first prediction with matching name
                var coreP = coreProposals.FirstOrDefault(NameMatches(p));
                if (coreP != null)
                {
                    // remember the IName of the proposal
                    if (p.Name != null)
                    {
                        matches.Add(p.Name);
                    }
                    // as well as the probability
                    probabilities2.Add(coreP.Probability);
                }
            }

            var presentedProbability = probabilities2.GetPresentedProbability();

            return(presentedProbability.IsValidProbability()
                ? new PBNProposalWrappedLookupItem(candidate, presentedProbability, matches.FirstOrDefault())
                : null);
        }
Exemplo n.º 24
0
        public void UCITestCreateCase()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.CommandBar.ClickCommand("New Case");

                xrmApp.ThinkTime(2500);

                xrmApp.Entity.SetValue("title", "Test Case " + TestSettings.GetRandomString(5, 10));

                xrmApp.ThinkTime(2500);

                LookupItem customer = new LookupItem {
                    Name = "customerid", Value = "David", Index = 0
                };
                xrmApp.Entity.SetValue(customer);

                var customerName = xrmApp.Entity.GetValue(customer);
                Assert.IsNotNull(customerName);
                Assert.IsTrue(customerName.Contains("David"));

                xrmApp.Entity.Save();
                xrmApp.ThinkTime(2500);
            }
        }
Exemplo n.º 25
0
        public void UCITestOpenCaseRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Cases");

                xrmApp.Grid.SwitchView("Active Cases");

                xrmApp.Grid.OpenRecord(0);

                OptionSet priorityCode = new OptionSet()
                {
                    Name = "prioritycode"
                };
                string priorityCodeValue = xrmApp.Entity.GetHeaderValue(priorityCode);

                // Bug: Fails to resolve ownerid
                // OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@data-id='header_ownerId.fieldControl-Lookup_ownerId']"}
                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerId"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                xrmApp.ThinkTime(2000);
            }
        }
        public override IEnumerable<ILookupItem> Select(ILookupQuery query){
            var crit = DetachedCriteria.For(typeof (ICommonDictionaryValue));
            if (query.First){
                crit.SetMaxResults(1);
            }
            crit.Add(Restrictions.Eq("Dictionary", ParentDict));
            if (query.Code.hasContent()){
                if (query.CodeMask){
                    crit.Add(Restrictions.Like("Code", query.Code));
                }
                else{
                    crit.Add(Restrictions.Eq("Code", query.Code));
                }
            }

            if (query.Name.hasContent()){
                if (query.NameMask){
                    crit.Add(Restrictions.Like("Name", query.Name));
                }
                else{
                    crit.Add(Restrictions.Eq("Name", query.Name));
                }
            }
            var result = new List<ILookupItem>();
            var res = storage.Query<ICommonDictionaryValue>(crit);
            foreach (var value in res){
                var item = new LookupItem{Alias = query.Alias, Code = value.Code, Name = value.Name};
                item.Properties["Comment"] = value.Comment;
                item.Properties["Id"] = value.Id;
                item.Properties["Idx"] = value.Idx;
                item.Properties["Value"] = value.Value;
                result.Add(item);
            }
            return result;
        }
Exemplo n.º 27
0
        public void UCITestOpenContactRetrieveHeaderValues()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.CustomerService);

                xrmApp.Navigation.OpenSubArea("Service", "Contacts");

                xrmApp.RelatedGrid.OpenGridRow(0);

                // Bug: Fails to resolve ownerid
                // OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@data-id='header_ownerId.fieldControl-Lookup_ownerId']"}
                LookupItem ownerId = new LookupItem()
                {
                    Name = "ownerid"
                };
                string ownerIdValue = xrmApp.Entity.GetHeaderValue(ownerId);

                string emailAddress = xrmApp.Entity.GetHeaderValue("emailaddress1");

                xrmApp.ThinkTime(2000);
            }
        }
        public void Validate_WhenValid_HasNoErrors()
        {
            var mockPickListItem = new PickListItem {
                Id = 123
            };
            var mockLookupItem = new LookupItem {
                Id = Guid.NewGuid()
            };

            _mockStore
            .Setup(mock => mock.GetLookupItems("dfe_teachingsubjectlist"))
            .Returns(new[] { mockLookupItem }.AsQueryable());
            _mockStore
            .Setup(mock => mock.GetPickListItems("dfe_candidatepastteachingposition", "dfe_educationphase"))
            .Returns(new[] { mockPickListItem }.AsQueryable());

            var position = new CandidatePastTeachingPosition
            {
                SubjectTaughtId  = mockLookupItem.Id,
                EducationPhaseId = mockPickListItem.Id,
            };

            var result = _validator.TestValidate(position);

            result.IsValid.Should().BeTrue();
        }
        public Task AddItem(Type type, LookupItem item)
        {
            return(Task.Run(
                       () =>
            {
                if (item.Key == default(int) || type == null)
                {
                    throw new ArgumentNullException();
                }

                if (this.lookupLists.ContainsKey(type))
                {
                    if (this.lookupLists[type].ContainsKey(item.Key))
                    {
                        throw new ArgumentException($"An item with the same key already exists");
                    }

                    this.lookupLists[type].Add(item.Key, item);
                }
                else
                {
                    this.lookupLists.Add(type, new Dictionary <int, LookupItem>());
                    this.lookupLists[type].Add(item.Key, item);
                }
            }));
        }
Exemplo n.º 30
0
        public void UCITestOpenOpportunityLookupAccount()
        {
            var client = new WebClient(TestSettings.Options);

            using (var xrmApp = new XrmApp(client))
            {
                xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey);

                xrmApp.Navigation.OpenApp(UCIAppName.Sales);

                xrmApp.Navigation.OpenSubArea("Sales", "Opportunities");

                xrmApp.Grid.SwitchView("Open Opportunities");

                xrmApp.Grid.OpenRecord(0);

                LookupItem parentAccountId = new LookupItem {
                    Name = "parentaccountid"
                };
                xrmApp.Entity.SelectLookup(parentAccountId);

                xrmApp.ThinkTime(1000);
                xrmApp.Lookup.OpenRecord(0);
            }
        }
Exemplo n.º 31
0
        public void TestInitialization()
        {
            var item = new LookupItem(1, "Test");

            Assert.That(item.Id, Is.EqualTo(1));
            Assert.That(item.Label, Is.EqualTo("Test"));
            Assert.That(item.IsSelected, Is.False);
        }
		protected virtual LookupItem InitializeLookupItem (XmlNode item)
		{
			LookupItem result = new LookupItem();
			result.LookupID = item.Attributes[idAttributeName].Value;
			result.LookupCode = item.Attributes[codeAttributeName].Value;
			result.ViewOrder = Int32.Parse(item.Attributes[viewOrderAttributeName].Value);
			result.LookupDesc = item.InnerText;
			
			return result;
		}
Exemplo n.º 33
0
		public void CanReadAddRemoveLookupItem ()
		{
			LookupDataModelProvider lookupDataModel = ProviderFactory.GetInstance<LookupDataModelFactory> (ProviderRepositoryFactory.Instance.Provider).GetDefaultProvider<LookupDataModelProvider> ();
			
			Assert.AreNotEqual (lookupDataModel.GetLookups ("dataType").Count, 0);
			Assert.AreEqual (lookupDataModel.GetLookups ("dataType").Count, 2);
			Assert.AreEqual (lookupDataModel.GetLookups ("dataType")["1"].LookupID, "1");
			Assert.AreEqual (lookupDataModel.GetLookups ("dataType")["1"].LookupDesc, "String");

			LookupItemCollection dataTypes = lookupDataModel.GetLookups ("dataType");
			LookupItem newItem = new LookupItem ();
			newItem.LookupID = "3";
			newItem.LookupDesc = "Percentage";
			newItem.LookupCode = "3";
			
			dataTypes.Add (newItem);
			
			lookupDataModel.SaveLookups (dataTypes);
			
			var xmlDoc = new XmlDocument ();
			xmlDoc.Load (lookupDataModel.XmlFileName);
		
			var dataTypeNode = xmlDoc.DocumentElement.SelectSingleNode (String.Format ("lookupCollection[@name='{0}']", dataTypes.CollectionName));
			Assert.AreEqual (dataTypeNode.ChildNodes.Count, 3);
			Assert.AreEqual (dataTypeNode.ChildNodes[2].Attributes["code"].Value, "3");
		
			dataTypes = lookupDataModel.GetLookups ("dataType");
			dataTypes.Remove (dataTypes["3"]);
			lookupDataModel.SaveLookups (dataTypes);
			
			xmlDoc = new XmlDocument ();
			xmlDoc.Load (lookupDataModel.XmlFileName);
			
			dataTypeNode = xmlDoc.DocumentElement.SelectSingleNode (String.Format ("lookupCollection[@name='{0}']", dataTypes.CollectionName));
			Assert.AreEqual (dataTypeNode.ChildNodes.Count, 2);
			Assert.AreNotEqual (dataTypeNode.ChildNodes[1].Attributes["code"].Value, "3");
		
			
		}
Exemplo n.º 34
0
        /// <summary>
        /// Assigns the developer list.
        /// </summary>
        /// <param name="developers">The developers.</param>
        /// <returns>return developers list</returns>
        public TaskPresenter AssignDeveloperList(IList<DeveloperListItem> developers)
        {
            if (developers != null)
            {
                var sessionDeveloper = SessionData.Instance.UserInfo.Developer;
                foreach (var developer in developers)
                {
                    LookupItem developerDetail = new LookupItem { ID = developer.DeveloperID, Name = developer.DeveloperName };
                    this.developerList.Add(developerDetail);
                }

                this.developerList.Insert(0, new LookupItem { ID = -1, Name = Resources.SelectDeveloper });
            }

            return this;
        }
Exemplo n.º 35
0
        /// <summary>
        /// Assigns the developer list.
        /// </summary>
        /// <param name="developers">The developers.</param>
        /// <returns>return developers list</returns>
        public TicketPresenter AssignDeveloperList(IList<LookupItem> developers)
        {
            if (developers != null)
            {
                foreach (var developer in developers)
                {
                    LookupItem developerDetail = new LookupItem { ID = developer.ID, Name = developer.Name };
                    this.developerList.Add(developerDetail);
                }

                ////this.developerList.Insert(0, new LookupItem { ID = -1, Name = Resources.SelectDeveloper });
            }

            return this;
        }
Exemplo n.º 36
0
 private static int CompareLookupItem(LookupItem x, LookupItem y)
 {
     return x.Order.CompareTo(y.Order);
 }
Exemplo n.º 37
0
        /// <summary>
        /// Assigns the developer list by project id.
        /// </summary>
        /// <param name="developersByProjectId">The developers by project id.</param>
        /// <returns>returns developers by project id</returns>
        public TaskPresenter AssignDeveloperListByProjectId(IList<DeveloperByProjectId> developersByProjectId)
        {
            if (developersByProjectId != null)
            {
                foreach (var developer in developersByProjectId)
                {
                    LookupItem developerDetail = new LookupItem { ID = developer.DeveloperID, Name = developer.DeveloperName };
                    this.developerList.Add(developerDetail);
                }

                this.developerList.Insert(0, new LookupItem { ID = -1, Name = Resources.SelectDeveloper });
            }

            return this;
        }
        /// <summary>
        /// Assigns the developer list.
        /// </summary>
        /// <param name="developers">The developers.</param>
        /// <returns>return developers list</returns>
        public TeamDashboardPresenter AssignDeveloperList(IList<LookupItem> developers)
        {
            if (developers != null)
            {
                foreach (var developer in developers)
                {
                    LookupItem developerDetail = new LookupItem { ID = developer.ID, Name = developer.Name };
                    this.developerListCollection.Add(developerDetail);
                }
            }

            return this;
        }
Exemplo n.º 39
0
 public static void LoadResourceLookupFromDb(IResourceLookupRepository resourceLookupRepository)
 {
     ListLock.EnterWriteLock();
     try {
         ResourceLookupList.Clear();
         ResourceLookupByteList.Clear();
         var items = resourceLookupRepository.GetActiveValues();
         if (items.Length > 0) {
             var lookupName = items[0].LookupName;
             var language = items[0].Language;
             var list = new List<LookupItem>();
             foreach (var item in items) {
                 if (item.LookupName == lookupName && item.Language == language) {
                     var lookupItem = new LookupItem {Key = item.ResourceKey, Value = item.Value, Order = item.Order, ByteValue = item.LookupValue};
                     var found = list.Any(i => i.Key == lookupItem.Key);
                     if(!found)
                         list.Add(lookupItem);
                     else {
                         Debug.WriteLine("Double " + lookupItem.Key);
                     }
                 } else {
                     try {
                         list.Sort(CompareLookupItem);
                         var key = lookupName + language;
                         if (ResourceLookupList.ContainsKey(key)) {
                             ResourceLookupList.Add(key, list.ToDictionary(r => r.Key, r => r.Value));
                         } else {
                             ResourceLookupList[key] = list.ToDictionary(r => r.Key, r => r.Value);
                         }
                         if (ResourceLookupByteList.ContainsKey(key)) {
                             ResourceLookupByteList.Add(key, list.ToDictionary(r => r.Key, r => r.ByteValue));
                         } else {
                             ResourceLookupByteList[key] = list.ToDictionary(r => r.Key, r => r.ByteValue);
                         }
                     } catch (Exception ex) {
                         throw new KatushaResourceLookupException(lookupName, ex);
                     }
                     lookupName = item.LookupName;
                     language = item.Language;
                     list = new List<LookupItem> { new LookupItem { Key = item.ResourceKey, Value = item.Value, Order = item.Order, ByteValue = item.LookupValue } };
                 }
             }
         }
     } finally {
         ListLock.ExitWriteLock();
     }
 }
Exemplo n.º 40
0
        /// <summary>
        /// Assigns the team developers.
        /// </summary>
        /// <param name="developerList">The developer list.</param>
        /// <returns>returns developer list of a under Logged in user</returns>
        public ReportPresenter AssignTeamDevelopers(IList<TeamEngagementDeveloperListItem> developerList)
        {
            foreach (var developer in developerList)
            {
                if (developer.DeveloperID != null)
                {
                    var teamDeveloper = new LookupItem { ID = (int)developer.DeveloperID, Name = developer.DeveloperName };
                    this.teamMembersList.Add(teamDeveloper);
                }
            }

            return this;
        }
Exemplo n.º 41
0
        /// <summary>
        /// Assigns the team developers.
        /// </summary>
        /// <param name="developerList">The developer list.</param>
        /// <returns>returns developer list of a under Logged in user</returns>
        public ReportPresenter AssignTeamDevelopers(IList<DeveloperListItem> developerList)
        {
            foreach (var developer in developerList)
            {
                LookupItem teamDeveloper = new LookupItem { ID = developer.DeveloperID, Name = developer.DeveloperName };
                this.teamMembersList.Add(teamDeveloper);
            }

            return this;
        }
Exemplo n.º 42
0
 /// <summary>
 /// Adds the onsite developer.
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 /// <param name="selectedPersonId">The selected person identifier.</param>
 /// <param name="projectPerson">The project person.</param>
 /// <param name="selectedRole">The selected role.</param>
 /// <param name="developerItem">The developer item.</param>
 private static void AddOnsiteDeveloper(ProjectPresenter presenter, string selectedPersonId, ProjectPerson projectPerson, LookupItem selectedRole, Developer developerItem)
 {
     projectPerson = new ProjectPerson();
     projectPerson.PointOfContactFlag = presenter.PointContactFlag;
     projectPerson.ProjectID = presenter.Project.ProjectID;
     projectPerson.ModifiedByDeveloperID = SessionData.Instance.UserInfo.Developer.DeveloperID;
     projectPerson.ModifiedDate = DateTime.Now;
     projectPerson.Email = developerItem.Email;
     projectPerson.Skype = developerItem.Skype;
     projectPerson.RoleName = selectedRole.Name;
     projectPerson.RoleID = selectedRole.ID;
     projectPerson.Name = developerItem.Name;
     projectPerson.PersonID = Convert.ToInt32(selectedPersonId, CultureInfo.CurrentCulture);
     projectPerson.PersonType = Persontype.OnSiteTeam;
     projectPerson.DeveloperImage = developerItem.LoginID.RetrieveDeveloperImageName();
     projectPerson.ApplicationEntityState = ApplicationEntityState.Added;
     presenter.Project.ProjectPersons.Add(projectPerson);
 }
Exemplo n.º 43
0
        /// <summary>
        /// Assigns the role groups.
        /// </summary>
        /// <param name="developerRoleGroupList">The developer role group list.</param>
        /// <returns>
        /// return role group list
        /// </returns>
        public ReportPresenter AssignDeveloperByRoleGroups(IList<RoleGroupListItem> developerRoleGroupList)
        {
            var list = developerRoleGroupList.GroupBy(item => item.RoleGroup).ToList();
            this.developersByRoleDrilldownList = new List<DevelopersByRole>();
            foreach (var listItems in list)
            {
                DevelopersByRole developerByRole = new DevelopersByRole();
                developerByRole.Role = listItems.Key;

                foreach (var listItem in listItems)
                {
                    LookupItem role = new LookupItem { ID = listItem.RoleID, Name = listItem.Role };
                    developerByRole.DevelopersList.Add(role);
                }

                this.DevelopersByRoleDrilldownList.Add(developerByRole);
            }

            return this;
        }
Exemplo n.º 44
0
        /// <summary>
        /// Maps the estimation Hour.
        /// </summary>
        /// <param name="estimationHour">The estimation hour.</param>
        /// <param name="estimationCategory">The estimation category.</param>
        /// <returns>Estimation Hour</returns>
        private static EstimatedHour MapEstimationHour(EstimatedHour estimationHour, LookupItem estimationCategory)
        {
            if (estimationHour != null)
            {
                estimationHour.EstimationCategoryName = estimationCategory.Name;
            }

            return estimationHour;
        }
Exemplo n.º 45
0
 /// <summary>
 /// Updates the stack holder.
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 /// <param name="selectedPersonId">The selected person identifier.</param>
 /// <param name="stackHolderItem">The stack holder item.</param>
 /// <param name="projectPerson">The project person.</param>
 /// <param name="selectedRole">The selected role.</param>
 private static void UpdateStackHolder(ProjectPresenter presenter, string selectedPersonId, StackHolder stackHolderItem, ProjectPerson projectPerson, LookupItem selectedRole)
 {
     projectPerson.PointOfContactFlag = presenter.PointContactFlag;
     projectPerson.ProjectID = presenter.Project.ProjectID;
     projectPerson.ModifiedByDeveloperID = SessionData.Instance.UserInfo.Developer.DeveloperID;
     projectPerson.ModifiedDate = DateTime.Now;
     projectPerson.RoleName = selectedRole.Name;
     projectPerson.RoleID = selectedRole.ID;
     projectPerson.Name = stackHolderItem.FirstName;
     projectPerson.Email = stackHolderItem.Email;
     projectPerson.Skype = stackHolderItem.Skype;
     projectPerson.PersonID = Convert.ToInt32(selectedPersonId, CultureInfo.CurrentCulture);
     projectPerson.PersonType = Persontype.StakeHolder;
     projectPerson.DeveloperImage = stackHolderItem.Skype.RetrieveStackHolderImageName();
     projectPerson.ApplicationEntityState = projectPerson.ProjectPersonID > 0 ? ApplicationEntityState.Modified : ApplicationEntityState.Added;
     presenter.Project.ProjectPersons.Where(a => a.PersonID == Convert.ToInt32(selectedPersonId)).Select(a => a = projectPerson);
 }
Exemplo n.º 46
0
 protected bool Equals(LookupItem other)
 {
     return string.Equals(label, other.label) && string.Equals(value, other.value);
 }
        /// <summary>
        /// Maps the environment title
        /// </summary>
        /// <param name="releaseType">The release status.</param>
        /// <param name="processItem">The process item.</param>
        /// <returns>Estimation Hour</returns>
        private static ProcessComplianceListItem MapProcessComplianceEnvironmentTitle(LookupItem releaseType, ProcessComplianceListItem processItem)
        {
            if (processItem != null)
            {
                processItem.EnvironmentTitle = releaseType.Name;
            }

            return processItem;
        }
        /// <summary>
        /// Maps the status title.
        /// </summary>
        /// <param name="artifactStatus">The artifact status.</param>
        /// <param name="processItem">The process item.</param>
        /// <returns>Estimation Hour</returns>
        private static ProcessComplianceListItem MapProcessComplianceStatusTitle(LookupItem artifactStatus, ProcessComplianceListItem processItem)
        {
            if (processItem != null)
            {
                processItem.StatusTitle = artifactStatus.Name;
            }

            return processItem;
        }