Пример #1
0
       public void Main()
       {
           var listController = new ListController(1);
           var request = new ListRequest();
           request.Pageindex = 0;
           request.Pagesize = 50;
           listController.Index(request);

       }
Пример #2
0
        /// <summary>
        /// The run job.
        /// </summary>
        private void RunJob()
        {
            while (true)
            {
                try
                {
                    Logger.Info("wXmpService start");
                    ////采集
                    var wXmpService = new WXmpService(1);

                    wXmpService.Main();

                    Logger.Info("wXmpService end");

                    Logger.Info("ContentController start");
                    ////内容页
                    var contentController = new ContentController(1);
                    contentController.BuildAllContent();
                    ////列表页
                    Logger.Info("ListController start");
                    var listController = new ListController(1);
                    listController.BuildAllList();

                    Logger.Info("HomeController start");
                    ////首页
                    var homeController = new HomeController(1);
                    homeController.Index();

                    Logger.Info("end");
                }

                catch (Exception ex)
                {
                    ////包括记录异常的内部包含异常
                    while (ex != null)
                    {
                        ex = ex.InnerException;
                        Logger.Error(ex);
                    }
                }

                Thread.Sleep(this._timeSpan);
            }
        }
Пример #3
0
        private void AddProperty(ProfilePropertyDefinition property)
        {
            if (this.userForm.Items.Any(i => i.ID == property.PropertyName))
            {
                return;
            }

            var           controller = new ListController();
            ListEntryInfo imageType  = controller.GetListEntryInfo("DataType", "Image");

            if (property.DataType != imageType.EntryID)
            {
                DnnFormEditControlItem formItem = new DnnFormEditControlItem
                {
                    ID                      = property.PropertyName,
                    ResourceKey             = string.Format("ProfileProperties_{0}", property.PropertyName),
                    LocalResourceFile       = "~/DesktopModules/Admin/Security/App_LocalResources/Profile.ascx.resx",
                    ValidationMessageSuffix = ".Validation",
                    ControlType             = EditorInfo.GetEditor(property.DataType),
                    DataMember              = "Profile",
                    DataField               = property.PropertyName,
                    Visible                 = property.Visible,
                    Required                = property.Required,
                };

                // To check if the property has a deafult value
                if (!string.IsNullOrEmpty(property.DefaultValue))
                {
                    formItem.Value = property.DefaultValue;
                }

                if (!string.IsNullOrEmpty(property.ValidationExpression))
                {
                    formItem.ValidationExpression = property.ValidationExpression;
                }

                this.userForm.Items.Add(formItem);
            }
        }
Пример #4
0
            public async Task When_A_User_Has_Tasks_Then_A_OK_Response_With_Tasks_Is_Returned()
            {
                // Arrange
                var tasks = new List <BasicTask>
                {
                    new BasicTask
                    {
                        UserId      = "1234",
                        TaskId      = Guid.NewGuid(),
                        Description = "Clean Dishes",
                        DueBy       = new DateTime(2018, 12, 01),
                        IsComplete  = false
                    },
                    new BasicTask
                    {
                        UserId      = "1234",
                        TaskId      = Guid.NewGuid(),
                        Description = "Do homework",
                        DueBy       = new DateTime(2018, 09, 21),
                        IsComplete  = true
                    }
                };
                var dataStore = new Mock <IDataStore>();

                dataStore.Setup(x => x.Read("1234")).Returns(Task.FromResult(tasks));
                var listController = new ListController(dataStore.Object);

                // Act
                var okObjectResult = await listController.GetByUserId("1234") as OkObjectResult;

                // Assert
                Assert.That(okObjectResult, Is.Not.Null, "OkResponse is returning null");
                var okObjectResultValue = okObjectResult.Value as List <AdvanceTask>;

                Assert.That(okObjectResultValue, Is.Not.Null, "OkResponseValue is returning null");
                Assert.That(okObjectResultValue.Count, Is.EqualTo(2));
                Assert.That(okObjectResultValue[0].Description, Is.EqualTo("Clean Dishes"));
                Assert.That(okObjectResultValue[1].Description, Is.EqualTo("Do homework"));
            }
Пример #5
0
        public static IDependency GetDependency(XPathNavigator dependencyNav)
        {
            IDependency dependency     = null;
            string      dependencyType = Util.ReadAttribute(dependencyNav, "type");

            switch (dependencyType.ToLowerInvariant())
            {
            case "coreversion":
                dependency = new CoreVersionDependency();
                break;

            case "package":
                dependency = new PackageDependency();
                break;

            case "permission":
                dependency = new PermissionsDependency();
                break;

            case "type":
                dependency = new TypeDependency();
                break;

            default:
                ListController listController = new ListController();
                ListEntryInfo  entry          = listController.GetListEntryInfo("Dependency", dependencyType);
                if (entry != null && !string.IsNullOrEmpty(entry.Text))
                {
                    dependency = (DependencyBase)Reflection.CreateObject(entry.Text, "Dependency_" + entry.Value);
                }
                break;
            }
            if (dependency == null)
            {
                dependency = new InvalidDependency(Util.INSTALL_Dependencies);
            }
            dependency.ReadManifest(dependencyNav);
            return(dependency);
        }
Пример #6
0
    public void LoadShopOffers()
    {
        int shopsize1 = 3;

        if (level > 19)
        {
        }
        if (level > 9)
        {
        }
        //     ListController shop1 = shopControler.LoadShop();
        //    shop1.UiText.text = "Unlock Cards";
        //    shop1.LoadList(cardLockedT1,true,ClickEffect.unlock,Zones.shop1,true,false, shopsize1);
        ListController shop2 = shopControler.LoadShop();

        shop2.UiText.text = "Buy Factory for starting deck";
        shop2.LoadList(cardShopT1, true, ClickEffect.shop, Zones.startingDeck, true, false, shopsize1);
        ListController shop3 = shopControler.LoadShop();

        shop3.UiText.text = "Buy More starting Resources";
        shop3.LoadList(cardHolder.ResorceCards(cardEng, this), false, ClickEffect.resorce, Zones.shop1, true, false);
    }
Пример #7
0
    public void checkTypeTarget()
    {
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            if (actual != null)
            {
                actual.disablePointer();
            }
            actual = enemies [0].GetComponent <ListController> ();
            actual.activePointer();
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            if (actual != null)
            {
                actual.disablePointer();
            }
            actual = players [0].GetComponent <ListController> ();
            actual.activePointer();
        }
    }
        //Updates Controller and Action
        public ActionResult UpdateBusiness(string nameSpace, string returnUrl = "Index")
        {
            //LAy danh sach Contorller va Action
            ReflectionController rc = new ReflectionController();
            List <Type>          listControllerType = rc.GetControllers("TeduCoreApp.Areas.Admin.Controllers");
            List <string>        listControllerOld  = _context.ListControllers.Select(c => c.ControllerName).ToList();
            List <string>        listActionOld      = _context.ListActions.Select(p => p.ActionName).ToList();

            foreach (var c in listControllerType)
            {
                if (!listControllerOld.Contains(c.Name))
                {
                    ListController b = new ListController()
                    {
                        ControllerName = c.Name, DiscriptionAction = "Chưa có mô tả"
                    };
                    _context.ListControllers.Add(b);
                    _context.SaveChanges();
                }

                List <string> listAction = rc.GetActions(c);

                foreach (var p in listAction)
                {
                    if (!listActionOld.Contains(c.Name + "-" + p))
                    {
                        var        controllerOld = _context.ListControllers.SingleOrDefault(x => x.ControllerName == c.Name);
                        ListAction action        = new ListAction()
                        {
                            IdController = controllerOld.Id, ActionName = c.Name + "-" + p, Discription = "Chưa có mô tả"
                        };
                        _context.ListActions.Add(action);
                    }
                }
            }
            _context.SaveChanges();
            TempData["err"] = "<div class='alert alert-info' role='alert'><span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span><span class='sr-only'></span>Cập Nhật thành công</div>";
            return(RedirectToAction(returnUrl));
        }
Пример #9
0
        private void saveSupplier(string _faktur, DateTime _tanggal, Int32 _id_kredit_pembelian, Int32 _id_supplier_pembelian, DateTime?_jatuhtempo, double _subtotal, Int32 _diskon, double _grandtotal, double _tunai, double _kembali, GridView _gridview)
        {
            GlobalVar.Success = false;
            InsertController ic = new InsertController();
            ListController   lc = new ListController();
            MPembelian       i  = new MPembelian()
            {
                faktur                = _faktur,
                tanggal               = _tanggal,
                id_kredit_pembelian   = _id_kredit_pembelian,
                id_supplier_pembelian = _id_supplier_pembelian,
                jatuhtempo            = _jatuhtempo,
                subtotal              = _subtotal,
                diskon                = _diskon,
                grandtotal            = _grandtotal,
                tunai   = _tunai,
                kembali = _kembali
            };
            OBJSQL obj = ic.SaveNewPembelian(i, _gridview);

            if (GlobalVar.Success)
            {
                textFaktur.Text          = "";
                searchLookKode.Text      = "";
                spinJumlah.Value         = 0;
                textNama.Text            = "";
                spinBeli.Value           = 0;
                spinDisc.Value           = 0;
                spinNetto.Value          = 0;
                spinSubTotal.Value       = 0;
                spinTotal.Value          = 0;
                spinGrandTotal.Value     = 0;
                spinTunai.Value          = 0;
                spinKembalian.Value      = 0;
                gridPembelian.DataSource = null;
                gridPembelian.DataSource = CreateTable(1);
                dateJatuhTempo.Enabled   = false;
            }
        }
Пример #10
0
        public void LoadLists()
        {
            var listController = new ListController();

            foreach (ListInfo objList in listController.GetListInfoCollection())
            {
                if (!objList.SystemList)
                {
                    // for some reason, the "DataType" is not marked as a system list, but we want to exclude that one too
                    if (objList.DisplayName != "DataType")
                    {
                        cboCategoriesList.Items.Add(new ListItem(objList.DisplayName, objList.DisplayName));
                    }
                }
            }

            if (cboCategoriesList.Items.Count == 0)
            {
                lstNoListsAvailable.Text    = Localization.GetString("msgNoListsAvailable.Text", LocalResourceFile);
                lstNoListsAvailable.Visible = true;
            }
        }
Пример #11
0
        /// <summary>
        /// Checks if user entered password is on the list of banned passwords
        /// combines host level list with current site level list
        /// </summary>
        /// <param name="inputString">user entered password</param>
        /// <returns>true if password found, false otherwise</returns>
        public bool FoundBannedPassword(string inputString)
        {
            const string listName = "BannedPasswords";

            var            listController = new ListController();
            PortalSettings settings       = PortalController.GetCurrentPortalSettings();

            IEnumerable <ListEntryInfo> listEntryHostInfos = listController.GetListEntryInfoItems(listName, "",
                                                                                                  Null.NullInteger);
            IEnumerable <ListEntryInfo> listEntryPortalInfos =
                listController.GetListEntryInfoItems(listName + "-" + settings.PortalId, "", settings.PortalId);

            IEnumerable <ListEntryInfo> query2 = listEntryHostInfos.Where(test => test.Text == inputString);
            IEnumerable <ListEntryInfo> query3 = listEntryPortalInfos.Where(test => test.Text == inputString);

            if (query2.Any() || query3.Any())
            {
                return(true);
            }

            return(false);
        }
Пример #12
0
        /// <summary>
        /// Searches the profile property values for a string (doesn't need to be the beginning).
        /// </summary>
        /// <param name="portalId">The portal identifier.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="searchString">The search string.</param>
        /// <returns>List of matching values</returns>
        public static List <string> SearchProfilePropertyValues(int portalId, string propertyName, string searchString)
        {
            var res = new List <string> {
            };
            var autoCompleteType = new ListController().GetListEntryInfo("DataType", "AutoComplete");
            var def = GetPropertyDefinitionByName(portalId, propertyName);

            if (def.DataType != autoCompleteType.EntryID)
            {
                return(res);
            }
            using (
                IDataReader ir = Data.DataProvider.Instance()
                                 .SearchProfilePropertyValues(portalId, propertyName, searchString))
            {
                while (ir.Read())
                {
                    res.Add(Convert.ToString(ir[0]));
                }
            }
            return(res);
        }
Пример #13
0
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                ListController          listController = new ListController();
                ListEntryInfoCollection countries      = listController.GetListEntryInfoCollection("Country");
                ddlVendorCountry.DataSource     = countries;
                ddlVendorCountry.DataTextField  = "Text";
                ddlVendorCountry.DataValueField = "Value";
                try
                {
                    ddlVendorCountry.DataBind();
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    ddlVendorCountry.SelectedValue = ddlVendorCountry.Items[0].Value;
                    ddlVendorCountry.DataBind();
                }
            }

            base.OnLoad(e);
        }
Пример #14
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets a Profile Property Value from the Profile.
        /// </summary>
        /// <remarks></remarks>
        /// <param name="propName">The name of the propoerty to retrieve.</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public string GetPropertyValue(string propName)
        {
            string propValue = Null.NullString;
            ProfilePropertyDefinition profileProp = this.GetProperty(propName);

            if (profileProp != null)
            {
                propValue = profileProp.PropertyValue;

                if (profileProp.DataType > -1)
                {
                    var controller = new ListController();
                    var dataType   = controller.GetListEntryInfo("DataType", profileProp.DataType);
                    if (dataType.Value == "Country" || dataType.Value == "Region")
                    {
                        propValue = this.GetListValue(dataType.Value, propValue);
                    }
                }
            }

            return(propValue);
        }
Пример #15
0
        private void LoadControls()
        {
            CountryName.Text = StringValue;
            int    countryId   = -1;
            string countryCode = StringValue;

            if (!string.IsNullOrEmpty(StringValue) && int.TryParse(StringValue, out countryId))
            {
                var listController = new ListController();
                var c = listController.GetListEntryInfo(countryId);
                CountryName.Text = c.Text;
                countryCode      = c.Value;
            }
            CountryId.Value = StringValue;

            var regionControl2 = ControlUtilities.FindFirstDescendent <DNNRegionEditControl>(Page, c => IsCoupledRegionControl(c));

            if (regionControl2 != null)
            {
                regionControl2.ParentKey = "Country." + countryCode;
            }
        }
Пример #16
0
        public ActionResult UpdateListEntryOrders(UpdateListEntryOrdersRequest request)
        {
            ActionResult actionResult = new ActionResult();

            try
            {
                int pid = request.PortalId ?? PortalSettings.PortalId;
                if (!UserInfo.IsSuperUser && PortalSettings.PortalId != pid)
                {
                    actionResult.AddError(HttpStatusCode.Unauthorized.ToString(), Components.Constants.AuthFailureMessage);
                }

                if (actionResult.IsSuccess)
                {
                    ListController listController = new ListController();
                    for (int i = 0; i <= request.Entries.Length - 1; i++)
                    {
                        if (request.Entries[i].EntryId.HasValue)
                        {
                            ListEntryInfo entry = listController.GetListEntryInfo(request.Entries[i].EntryId.Value);
                            if (entry.SortOrder != request.Entries[i].SortOrder)
                            {
                                entry.SortOrder = request.Entries[i].SortOrder.Value;
                                Managers.MemberProfileManager.UpdateSortOrder(entry);
                                string cacheKey = string.Format(DataCache.ListEntriesCacheKey, pid, entry.ListName);
                                DataCache.RemoveCache(cacheKey);
                            }
                        }
                    }
                    DataCache.ClearListsCache(pid);
                }
            }
            catch (Exception exc)
            {
                actionResult.AddError(HttpStatusCode.InternalServerError.ToString(), exc.Message);
            }
            return(actionResult);
        }
Пример #17
0
        public ActionResult Search(string q)
        {
            try
            {
                var portalId = PortalController.GetEffectivePortalId(PortalSettings.PortalId);

                var controller = new ListController();

                var textType    = controller.GetListEntryInfo("DataType", "Text");
                var regionType  = controller.GetListEntryInfo("DataType", "Region");
                var countryType = controller.GetListEntryInfo("DataType", "Country");

                IList <SearchResult> results = new List <SearchResult>();
                foreach (var definition in ProfileController.GetPropertyDefinitionsByPortal(portalId)
                         .Cast <ProfilePropertyDefinition>()
                         .Where(definition => definition.DataType == textType.EntryID ||
                                definition.DataType == regionType.EntryID ||
                                definition.DataType == countryType.EntryID))
                {
                    AddProperty(results, definition.PropertyName, q);
                }

                AddProperty(results, "Email", q);
                AddProperty(results, "DisplayName", q);
                AddProperty(results, "Username", q);
                AddProperty(results, "Password", q);
                AddProperty(results, "PasswordConfirm", q);
                AddProperty(results, "PasswordQuestion", q);
                AddProperty(results, "PasswordAnswer", q);

                return(Json(results.OrderBy(sr => sr.id), JsonRequestBehavior.AllowGet));
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
        }
Пример #18
0
        // Use this for initialization
        void Start()
        {
            bbMenuController = bbMenuPanel.GetComponent <BandBridgeMenuController>();
            listController   = listViewport.GetComponent <ListController>();
            GameManager.instance.ListController = listController;
            // add options to game type dropdown:
            List <string> gameOptions = new List <string>();

            foreach (var option in gameTypes)
            {
                gameOptions.Add(option.ToString());
            }
            gameTypeDropdown.AddOptions(gameOptions);
            for (int i = 0; i < gameTypes.Length; i++)
            {
                if (gameTypes[i] == (GameMode)GameManager.instance.BiofeedbackMode)
                {
                    gameTypeDropdown.value = i;
                    break;
                }
            }
            // if autoGameModeToggle is on, disable gameTypeDropdown:
            autoGameTypeToggle.isOn = true;
            SetAutoGameMode(autoGameTypeToggle);

            // set up analytics, debug mode and simulator toggles:
            analyticsToggle.isOn = GameManager.instance.AnalyticsEnabled;
            debugModeToggle.isOn = GameManager.instance.DebugMode;
            simulatorToggle.isOn = GameManager.instance.BBModule.IsSimulatorEnabled;

            // update chosen game language and language toggles:
            GameManager.instance.ChosenLanguage = GameLanguage.Default;
            togglePolish.isOn = !(toggleEnglish.isOn = true);
            GameManager.instance.UpdatedLanguage();

            // turn off settingsPanel visibility:
            TurnOffSettingsMenu();
        }
Пример #19
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Adds the default property definitions for a portal
        /// </summary>
        /// <param name="portalId">Id of the Portal</param>
        /// -----------------------------------------------------------------------------
        public static void AddDefaultDefinitions(int portalId)
        {
            portalId = GetEffectivePortalId(portalId);

            _orderCounter = 1;
            var listController = new ListController();
            Dictionary <string, ListEntryInfo> dataTypes = listController.GetListEntryInfoDictionary("DataType");

            AddDefaultDefinition(portalId, "Name", "Prefix", "Text", 50, UserVisibilityMode.AllUsers, dataTypes);
            AddDefaultDefinition(portalId, "Name", "FirstName", "Text", 50, UserVisibilityMode.AllUsers, dataTypes);
            AddDefaultDefinition(portalId, "Name", "MiddleName", "Text", 50, UserVisibilityMode.AllUsers, dataTypes);
            AddDefaultDefinition(portalId, "Name", "LastName", "Text", 50, UserVisibilityMode.AllUsers, dataTypes);
            AddDefaultDefinition(portalId, "Name", "Suffix", "Text", 50, UserVisibilityMode.AllUsers, dataTypes);
            AddDefaultDefinition(portalId, "Address", "Unit", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Address", "Street", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Address", "City", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Address", "Region", "Region", 0, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Address", "Country", "Country", 0, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Address", "PostalCode", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Contact Info", "Telephone", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Contact Info", "Cell", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Contact Info", "Fax", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Contact Info", "Website", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Contact Info", "IM", "Text", 50, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Preferences", "Biography", "Multi-line Text", 0, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Preferences", "TimeZone", "TimeZone", 0, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Preferences", "PreferredTimeZone", "TimeZoneInfo", 0, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Preferences", "PreferredLocale", "Locale", 0, UserVisibilityMode.AdminOnly, dataTypes);
            AddDefaultDefinition(portalId, "Preferences", "Photo", "Image", 0, UserVisibilityMode.AllUsers, dataTypes);

            //6.0 requires the old TimeZone property to be marked as Deleted
            ProfilePropertyDefinition pdf = GetPropertyDefinitionByName(portalId, "TimeZone");

            if (pdf != null)
            {
                DeletePropertyDefinition(pdf);
            }
        }
Пример #20
0
        private void LoadRegions(string CountryId)
        {
            var ctlList = new ListController();
            IEnumerable <ListEntryInfo> regions = null;

            regions = ctlList.GetListEntryInfoItems("Region", string.Concat("Country.", CountryId), PortalId);

            if (regions != null && regions.Any())
            {
                cboRegion.DataSource     = regions;
                cboRegion.DataTextField  = "Text";
                cboRegion.DataValueField = "Value";
                cboRegion.DataBind();

                cboRegion.Items.Insert(0, new ListItem("---"));

                ToggleRegion(RegionState.DropDownList);
            }
            else
            {
                ToggleRegion(RegionState.TextBox);
            }
        }
Пример #21
0
        //TODO TESTS
        private static AssingNode VariableAssign(ListController <TokenModel> lc)
        {
            var variableToken = lc.GetNext();

            CheckEqual(TryGetNext(lc, "= expected"), "=", "= expected");
            var func     = TryGetNext(lc, "Expression expected");
            var res      = new AssingNode();
            var variable = VarTable.Get(variableToken.Text);

            res.Left = variable;
            if (FuncTable.Contains(func.Text))
            {
                lc.SetBack();
                var fn = FuncExecute(lc);
                res.Right = fn;
            }
            else
            {
                throw new ParseException("Function expected", func);
            }

            return(res);
        }
Пример #22
0
        public static void Lang(ListController <TokenModel> lc)
        {
            while (true)
            {
                Command(lc);
                if (!lc.TryGetNext(out var sc))
                {
                    throw new ParseException("; expected", lc.GetPrevious(), true);
                }

                if (sc.Text != ";")
                {
                    throw new ParseException("; expected", lc.GetPrevious(), true);
                }

                if (!lc.TryGetNext(out _))
                {
                    return;
                }

                lc.SetBack();
            }
        }
        public async Task testUpdateConfirmSuccess()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "testUpdateConfirmSuccess")
                          .Options;

            using (var context = new ApplicationDbContext(options))
            {
                context.Projects.Add(proj1);
                context.Projects.Add(proj2);
                context.Projects.Add(proj3);
                context.Projects.Add(proj6);
                context.SaveChanges();
            };

            using (var context = new ApplicationDbContext(options))
            {
                var service = new ListController(context);
                var result  = await service.UpdateConfirm(vievProj6);

                Assert.IsInstanceOfType(result, typeof(OkObjectResult));
            }
        }
Пример #24
0
        public void FillReportTypeDropDown()
        {
            try
            {
                var ReportType = new ListController().GetListEntryInfoItems("InventoryReportingType", "", this.PortalId);
                if (ReportType.ToList().Count == 0)
                {
                    CreateList();
                    ReportType = new ListController().GetListEntryInfoItems("InventoryReportingType", "", this.PortalId);
                }

                ddlReportType.DataTextField  = "Text";
                ddlReportType.DataValueField = "Value";
                ddlReportType.DataSource     = ReportType;
                ddlReportType.DataBind();

                ddlReportType.Items.Insert(0, new ListItem("--Select--", ""));
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Пример #25
0
        private void SendEditedDataToList()
        {
            if (currentSection == Sections.Movie)
            {
                string[] row = { NameTextBox.Text, GenreComboBox.Text };
                newEditedData = new ListViewItem(row);
            }
            if (currentSection == Sections.Serie)
            {
                string[] row = { NameTextBox.Text, GenreComboBox.Text };
                newEditedData = new ListViewItem(row);
            }
            if (currentSection == Sections.Book)
            {
                string[] row = { NameTextBox.Text, AuthorTextBox.Text, GenreComboBox.Text };
                newEditedData = new ListViewItem(row);
            }

            var index = currentListView.SelectedIndices[0];

            currentListView.Items.RemoveAt(index);
            ListController.InsertEditedDataToList(index, newEditedData, currentListView);
        }
Пример #26
0
        public void GetDropDownListStates()

        {
            try
            {
                // Get State Dropdown from DNN Lists

                var vStates = new ListController().GetListEntryInfoItems("Region", "Country.US", this.PortalId);

                //  State
                ddlStates.DataTextField  = "Value";
                ddlStates.DataValueField = "Text";
                ddlStates.DataSource     = vStates;
                ddlStates.DataBind();
                ddlStates.Items.Insert(0, new ListItem("--", ""));
                ddlStates.SelectedValue = "Massachusetts";
                //    ddlStates.SelectedValue = "MA";
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Пример #27
0
        private void FillAuthorizedCountries(string authorizedCountries)
        {
            ListController       listController = new ListController();
            List <ListEntryInfo> listEntries    = new List <ListEntryInfo>(listController.GetListEntryInfoItems("Country"));

            if (listEntries.Count > 0)
            {
                lbAuthorizedCountries.DataSource = listEntries;
                lbAuthorizedCountries.DataBind();

                if (!string.IsNullOrEmpty(authorizedCountries))
                {
                    foreach (string authorizedCountry in authorizedCountries.Split(','))
                    {
                        ListItem item = lbAuthorizedCountries.Items.FindByValue(authorizedCountry);
                        if (item != null)
                        {
                            item.Selected = true;
                        }
                    }
                }
            }
        }
Пример #28
0
        void Start()
        {
            testshit   = Object.FindObjectOfType <Testshit>();
            buildables = new List <Buildable>();

            ui_manager = Object.FindObjectOfType <ListController>();

            for (var i = 0; i < component.buildables.Length; i += 1)
            {
                if (component.buildables[i] == null)
                {
                    continue;
                }
                var name      = component.buildables[i];
                var buildable = new Buildable();
                buildable.name      = name;
                buildable.id        = i;
                buildable.uiElement = ui_manager.AddUiElement(Resources.Load <Sprite>("Sprites/" + name),
                                                              name,
                                                              (cancel) => DoBuild(buildable, cancel));
                buildables.Add(buildable);
            }
        }
        public ProfileDefinitionDto(ProfilePropertyDefinition definition)
        {
            PropertyCategory     = definition.PropertyCategory;
            PropertyName         = definition.PropertyName;
            Required             = definition.Required;
            ValidationExpression = definition.ValidationExpression;
            PropertyValue        = definition.PropertyValue;
            Visible = definition.Visible;
            Length  = definition.Length;

            var dataTypeId     = definition.DataType;
            var listController = new ListController();
            var dataTypes      = listController.GetListEntryInfoDictionary("DataType");

            if (dataTypes.Any(i => i.Value.EntryID == dataTypeId))
            {
                DataType = dataTypes.First(i => i.Value.EntryID == dataTypeId).Key.ToLowerInvariant().Substring(9);
            }
            else
            {
                DataType = "unknown";
            }
        }
Пример #30
0
            public static ActionResult GetListInfo(string listName, int?portalId)
            {
                ActionResult actionResult = new ActionResult();

                try
                {
                    int pid = portalId ?? PortalSettings.Current.PortalId;
                    if (!PortalSettings.Current.UserInfo.IsSuperUser && PortalSettings.Current.PortalId != pid)
                    {
                        actionResult.AddError(HttpStatusCode.Unauthorized.ToString(), Components.Constants.AuthFailureMessage);
                    }

                    if (actionResult.IsSuccess)
                    {
                        ListController listController = new ListController();
                        System.Collections.Generic.IEnumerable <ListEntryInfo> entries = listController.GetListEntryInfoItems(listName, "", pid);
                        var response = new
                        {
                            Success = true,
                            listController.GetListInfo(listName, "", pid)?.EnableSortOrder,
                            Entries = entries.Select(t => new
                            {
                                t.EntryID,
                                t.Text,
                                t.Value,
                                t.SortOrder
                            }).OrderBy(x => x.SortOrder)
                        };
                        actionResult.Data = response;
                    }
                }
                catch (Exception exc)
                {
                    actionResult.AddError(HttpStatusCode.InternalServerError.ToString(), exc.Message);
                }
                return(actionResult);
            }
Пример #31
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                if (!Page.IsPostBack)
                {
                    ClientAPI.RegisterKeyCapture(txtSearch, cmdSearch, 13);
                    //Load the Search Combo
                    ddlSearchType.Items.Add(AddSearchItem("Username"));
                    ddlSearchType.Items.Add(AddSearchItem("Email"));
                    ddlSearchType.Items.Add(AddSearchItem("DisplayName"));
                    var           controller    = new ListController();
                    ListEntryInfo imageDataType = controller.GetListEntryInfo("DataType", "Image");
                    ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId, false, false);
                    foreach (ProfilePropertyDefinition definition in profileProperties)
                    {
                        if (imageDataType != null && definition.DataType != imageDataType.EntryID)
                        {
                            ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName));
                        }
                    }

                    //Sent controls to current Filter
                    if ((!String.IsNullOrEmpty(Filter) && Filter.ToUpper() != "NONE") && !String.IsNullOrEmpty(FilterProperty))
                    {
                        txtSearch.Text = Filter;
                        ddlSearchType.SelectedValue = FilterProperty;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            //Before we bind the Profile to the editor we need to "update" the visible data
            var properties = new ProfilePropertyDefinitionCollection();
            var imageType  = new ListController().GetListEntryInfo("DataType", "Image");

            foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties)
            {
                if (IsAdmin && !IsProfile)
                {
                    profProperty.Visible = true;
                }

                if (!profProperty.Deleted && (Request.IsAuthenticated || profProperty.DataType != imageType.EntryID))
                {
                    properties.Add(profProperty);
                }
            }

            ProfileProperties.User           = User;
            ProfileProperties.ShowVisibility = ShowVisibility;
            ProfileProperties.DataSource     = properties;
            ProfileProperties.DataBind();
        }