private async Task <IWebApiUserSearchViewModel> PoulateDropDownListAsync(IWebApiUserSearchViewModel model, CancellationToken cancellationToken)
        {
            if (model == null)
            {
                model = new WebApiUserSearchViewModel();
            }

            DropDownListDAL _ddlDal = new DropDownListDAL();

            model.DDLOrganization = await _ddlDal.GetOrganizationListAsync(userId, -1, cancellationToken);

            model.DDLSystem = await _ddlDal.GetSystemListAsync(userId, cancellationToken);

            model.DDLSearch = await _ddlDal.GetWebApiUserSearchListAsync(userId, cancellationToken);

            model.DDLSystem[0].Identifier       = "ddlSystem";
            model.DDLOrganization[0].Identifier = "ddlOrganization";
            return(model);
        }
示例#2
0
        private async Task <IWebApiUser> PopulateInitialValuesAsync(IWebApiUser model, CancellationToken cancellationToken)
        {
            model.DeviceGropList = new ListBoxSettingsModel();

            try
            {
                _userId = Convert.ToInt64(model.WAUserId);
            }
            catch (Exception ex)
            {
                _userId = 0;
            }

            model.SystemList = await _ddlDAL.GetSystemListAsync(userId, cancellationToken, true);

            if (model.SystemId > 0)
            {
                model.OrganizationList = await _ddlDAL.GetOrganizationListAsync(userId, model.SystemId, cancellationToken, true);
            }
            else
            {
                model.OrganizationList = await _ddlDAL.GetOrganizationListAsync(userId, -1, cancellationToken, true);
            }

            model.TimeZoneList = await _ddlDAL.GetTimeZoneListAsync(userId, cancellationToken);

            model.RoleList = await _ddlDAL.GetWebAPIRoleListAsync(userId, cancellationToken, true);

            //model.DeviceGropList.RequestedListBoxItem = await _ddlDAL.GetAssignedDeviceGroupListAsync(_userId, cancellationToken, 0, userId);
            //model.DeviceGropList.AvailableListBoxItem = await _ddlDAL.GetUnassignedDeviceGroupListAsync(_userId, cancellationToken, 0, userId);

            model.SystemList[0].Identifier       = "ddlSystem";
            model.SystemList[0].SavedValue       = model.SystemId;
            model.OrganizationList[0].Identifier = "ddlOrganization";
            model.OrganizationList[0].SavedValue = model.OrganizationId;



            return(model);
        }