Ejemplo n.º 1
0
        public List <PlanoViewModel> PlanosAssinatura()
        {
            int id = AppExtension.IdUsuarioLogado();

            Entities context = new Entities();

            var cliente = context.Cliente.FirstOrDefault(cli => cli.Id == id && cli.Situacao == true);

            if (cliente == null)
            {
                throw new Exception("Objeto não encontrado");
            }

            string tipo = cliente.FlagCliente == "P" ? "P" : "A";

            var query = context.Plano.Where(pla => pla.TipoPlano == tipo);
            List <PlanoViewModel> lista = new List <PlanoViewModel>();

            query.ToList().ForEach(obj =>
            {
                lista.Add(new PlanoViewModel(obj));
            });

            return(lista);
        }
        public void Verify_Map_Option()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.RestartApp(platform);
                AppExtension.SetPlatform(platform);
                app.CheckLocation(SYSTEM);
                app.TapHamburgerMenu();
                app.Assert(e => e.Id("design_menu_item_text"), true);
                app.Assert("mapview_map", true);
                app.TapOption("fab_gps_fixed_map");
                app.Screenshot("Hamburger Menu: Map Option").MoveTo($"C:\\Screenshots\\Maps_DashMap__{Guid.NewGuid()}.png");
                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapHamburgerMenu();
                app.Assert("button_close_main_menu", true);
                app.TapOption(e => e.Id("cell_text_main_menu").Text(app.GetLabel("Map")));
                app.Assert("button_close_main_menu", false);
                app.Assert("mapview_map", true);
                break;
            }
        }
Ejemplo n.º 3
0
        public bool AlterarSenha([FromBody] dynamic param)
        {
            int id = AppExtension.IdUsuarioLogado();

            Entities context = new Entities();
            var      obj     = context.Usuario.FirstOrDefault(op => op.Id == id);

            string senhaanterior  = param.SenhaAnterior?.ToString();
            string novasenha      = param.NovaSenha?.ToString();
            string confirmarsenha = param.ConfirmarSenha?.ToString();

            if (obj.Senha == senhaanterior)
            {
                if (novasenha == confirmarsenha)
                {
                    if (novasenha.Count() >= 4)
                    {
                        obj.Senha = novasenha;
                        context.SaveChanges();
                        return(true);
                    }

                    throw new Exception("Sua senha precisa ter mais do que 4 caracteres.");
                }

                throw new Exception("Confirmar Senha precisa ser igual a Nova Senha.");
            }

            throw new Exception("A Senha Atual está incorreta.");
        }
        public void Verify_Stations_Option()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.RestartApp(platform);
                AppExtension.SetPlatform(platform);
                app.CheckLocation(SYSTEM);
                app.TapHamburgerMenu();
                app.TapOption("Stations");
                app.Screenshot("Hamburger Menu: Stations List").MoveTo($"C:\\Screenshots\\Stations_StationsList__{Guid.NewGuid()}.png");
                app.TapOption("search_button");
                app.EnterTextAndDismissKeyboard("search_src_text", SYSTEM_STATION);
                app.Assert(e => e.Id("text_name_station_list_item_template").Marked(SYSTEM_STATION), true);
                app.Tap(e => e.Text(SYSTEM_STATION));
                app.Screenshot("Stations: Station Details").MoveTo($"C:\\Screenshots\\Stations_StationDetails__{Guid.NewGuid()}.png");


                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapHamburgerMenu();
                app.TapOption(e => e.Id("cell_text_main_menu").Text(app.GetLabel("Stations")));
                app.EnterTextAndDismissKeyboard("search_station_list", SYSTEM_STATION);
                app.Assert(e => e.Id("cell_text_station_list").Marked(SYSTEM_STATION), true);
                break;
            }
        }
        public void Verify_Contact_Customer_Service()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.RestartApp(platform);
                AppExtension.SetPlatform(platform);
                app.TapProfile();
                app.WaitForElement(e => e.Text("Sign In"));
                app.Tap(e => e.Marked("text_forgot_password_login"));
                app.Screenshot("Account Recovery: Reset Password Screen").MoveTo($"C:\\Screenshots\\AccountRecovery_ResetPasswordScreen__{Guid.NewGuid()}.png");
                app.TapOption("text_contact_customer_service_forgot_password");
                app.Assert(e => e.Marked("content_support_menu"), true);
                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapProfile();
                app.TapOption("bar_button_forgot_password_login");
                app.TapOption("text_contact_customer_service_forgot_password");
                app.Assert("content_support", true);
                break;
            }
        }
Ejemplo n.º 6
0
    /// <summary>
    /// Light・Darkテーマ変換対応
    /// </summary>
    private static void ChangeTheme()
    {
        var paletteHelper = new PaletteHelper();
        var theme         = paletteHelper.GetTheme();

        bool isDark = Services.GetService <MainModel>() !.Setting.IsAppDarkTheme;

        theme.SetBaseTheme(
            isDark
                ? Theme.Dark
                : Theme.Light);

        theme.PrimaryDark  = new ColorPair((Color)Current.Resources["Primary700"], Colors.White);
        theme.PrimaryMid   = new ColorPair((Color)Current.Resources["Primary500"], Colors.White);
        theme.PrimaryLight = (Color)Current.Resources["Primary300"];
        theme.Paper        = AppExtension.ToColorOrDefault(isDark
            ? "#1e242a"
            : "#E8EDF2");

        //ベース色とのコントラストが
        Current.Resources["HighContrastBrush"] =
            (isDark ? theme.PrimaryLight : theme.PrimaryDark)
            .Color.ToSolidColorBrush(true);

        paletteHelper.SetTheme(theme);
    }
        public void Verify_All_Locations_Option()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.StartApp(platform);
                AppExtension.SetPlatform(platform);
                app.TapAllLocations();
                app.GoTo(SYSTEM_DASH);
                app.SkipWalkthrough();
                app.TapHamburgerMenu();
                app.TapOption("All Locations");
                app.Screenshot("Hamburger Menu: All Locations").MoveTo($"C:\\Screenshots\\HamburgerMenu_AllLocations__{Guid.NewGuid()}.png");
                app.Assert(e => e.Marked("text_go_to_location_map"), true);
                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapHamburgerMenu();
                app.TapOption(e => e.Id("cell_text_main_menu").Text(app.GetLabel("AllLocations")));
                app.Assert("text_or_tap_here_locations_map", true);
                break;
            }
        }
Ejemplo n.º 8
0
        // loads an extension
        public async Task LoadExtension(AppExtension ext)
        {
            // get unique identifier for this extension
            string identifier = ext.AppInfo.PackageFamilyName + Consts.ArraySeparator + ext.Id;

            // load the extension if the package is OK
            if (!(ext.Package.Status.VerifyIsOK()
#if !DEBUG
                  && Settings.Current.DebugModeEnabled ? true : ext.Package.SignatureKind == PackageSignatureKind.Store
#endif
                  ))
            {
                // if this package doesn't meet our requirements
                // ignore it and return
                return;
            }
            var properties = await ext.GetExtensionPropertiesAsync() as PropertySet;

            var cates = ((properties["Category"] as PropertySet)["#text"] as string).Split(';');

            // if its already existing then this is an update
            var exting = ExtensionList.Where(e => e.UniqueId == identifier).FirstOrDefault();
            // new extension
            if (exting == null)
            {
                // get extension properties
                ExtensionList.Add(new ExtensionViewModel(ext, properties));
            }
            // update
            else
            {
                // update the extension
                await exting.Update(ext);
            }
        }
Ejemplo n.º 9
0
        protected void SpawnSubZone(int index)
        {
            AppExtension extension = AppExtension.exe;

            switch (Application.platform)
            {
            //STANDALONE
            case RuntimePlatform.WindowsPlayer: extension = AppExtension.exe; break;

            case RuntimePlatform.OSXPlayer: extension = AppExtension.app; break;

            case RuntimePlatform.LinuxPlayer: extension = AppExtension.x86_64; break;

            //EDITOR
            case RuntimePlatform.WindowsEditor: extension = AppExtension.exe; break;

            case RuntimePlatform.OSXEditor: extension = AppExtension.app; break;

            case RuntimePlatform.LinuxEditor: extension = AppExtension.x86_64; break;
                //MOBILE + CONSOLE

                /* //NOTE: Probably no reason to use these for a server...maybe in some cases though (couch co-op games etc)
                 * case RuntimePlatform.WebGLPlayer: break; case RuntimePlatform.IPhonePlayer: break; case RuntimePlatform.Android: break;
                 * case RuntimePlatform.PS4: break; case RuntimePlatform.XboxOne: break; case RuntimePlatform.Switch: break;*/
            }
            Process process = new Process();

            //process.StartInfo.FileName = Tools.GetProcessPath; //DEPRECIATED
            process.StartInfo.FileName  = "Server" + "." + extension.ToString();
            process.StartInfo.Arguments = argZoneIndex + " " + index.ToString();
            process.Start();

            debug.LogFormat(this.name, nameof(SpawnSubZone), index.ToString()); //DEBUG
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Prepares the extension so that the ExtensionManager can present it as an available extension
        /// </summary>
        /// <returns></returns>
        public async Task MarkAsLoaded()
        {
            // make sure package is OK to load
            if (!AppExtension.Package.Status.VerifyIsOK())
            {
                return;
            }

            Enabled = true;

            // Don't reload
            if (Loaded)
            {
                return;
            }

            // The public folder is shared between the extension and the host.
            // We don't use it in this sample but you can see https://github.com/Microsoft/Build2016-B808-AppExtensibilitySample for an example of it can be used.
            StorageFolder folder = await AppExtension.GetPublicFolderAsync();

            Loaded  = true;
            Visible = Visibility.Visible;
            RaisePropertyChanged("Visible");
            Offline = false;
        }
Ejemplo n.º 11
0
        public ExtensionLite(AppExtension ext, IPropertySet properties) : this() {
            AppExtension = ext;
            _valueset = properties;
            AppExtensionUniqueId = ext.AppInfo.AppUserModelId + "!" + ext.Id;

            Manifest = new ExtensionManifest();
            Manifest.AppExtensionUniqueID = AppExtensionUniqueId;
            foreach (var prop in properties)
            {
                switch (prop.Key)
                {
                    case "Title": Manifest.Title = GetValueFromProperty(prop.Value); break;
                    case "IconUrl": Manifest.IconUrl = GetValueFromProperty(prop.Value); break;
                    case "Publisher": Manifest.Publisher = GetValueFromProperty(prop.Value); break;
                    case "Version": Manifest.Version = GetValueFromProperty(prop.Value); break;
                    case "Abstract": Manifest.Abstract = GetValueFromProperty(prop.Value); break;
                    case "FoundInToolbarPositions": Manifest.FoundInToolbarPositions = (ExtensionInToolbarPositions)Enum.Parse(typeof(ExtensionInToolbarPositions), GetValueFromProperty(prop.Value)); break;
                    case "LaunchInDockPositions": Manifest.LaunchInDockPositions = (ExtensionInToolbarPositions)Enum.Parse(typeof(ExtensionInToolbarPositions), GetValueFromProperty(prop.Value)); break;
                    case "ContentControl": Manifest.ContentControl = GetValueFromProperty(prop.Value); break;
                    case "AssemblyName": Manifest.AssemblyName = GetValueFromProperty(prop.Value); break;
                    case "IsExtEnabled": Manifest.IsExtEnabled = bool.Parse(GetValueFromProperty(prop.Value)); AppSettings.AppExtensionEnabled = Manifest.IsExtEnabled; break;
                    case "IsUWPExtension": Manifest.IsUWPExtension = bool.Parse(GetValueFromProperty(prop.Value)); break;
                    case "Size": Manifest.Size = int.Parse(GetValueFromProperty(prop.Value)); break;
                }
            }

        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取特定app在电商中的当前生效的积分扩展信息。
        /// </summary>
        /// <param name="paramDto">查询参数</param>
        /// <returns></returns>
        public ResultDTO <UserScoreDTO> GetUserScoreInAppExt(Param2DTO paramDto)
        {
            Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.UserScoreDTO> result = new ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.UserScoreDTO>();
            UserScoreDTO usDto = new UserScoreDTO();

            result.Data = usDto;

            try
            {
                if (paramDto == null)
                {
                    result.Message    = "参数错误,参数不能为空!";
                    result.ResultCode = 1;
                    return(result);
                }
                if (paramDto.UserId == Guid.Empty)
                {
                    result.Message    = "参数错误,appId不能为空!";
                    result.ResultCode = 1;
                    return(result);
                }
                if (paramDto.AppId == Guid.Empty)
                {
                    result.Message    = "参数错误,appId不能为空!";
                    result.ResultCode = 1;
                    return(result);
                }
                var appIsCashForScore = (from ae in AppExtension.ObjectSet()
                                         where ae.Id == paramDto.AppId
                                         select ae.IsCashForScore).FirstOrDefault();
                if (appIsCashForScore == null || appIsCashForScore == false)
                {
                    usDto.IsCashForScore = false;
                    return(result);
                }
                usDto.IsCashForScore = appIsCashForScore;

                var ssFirst = (from ss in ScoreSetting.ObjectSet()
                               where ss.AppId == paramDto.AppId
                               orderby ss.SubTime descending
                               select ss.ScoreCost).FirstOrDefault();
                if (!ssFirst.HasValue)
                {
                    return(result);
                }
                usDto.ScoreCost = ssFirst.Value;
                int score = Jinher.AMP.BTP.TPS.SignSV.Instance.GiveUserScore(paramDto.UserId, paramDto.AppId);
                usDto.Score = score;
                usDto.Money = DecimalExt.ToMoney((decimal)score / usDto.ScoreCost);
            }
            catch (Exception ex)
            {
                string str = string.Format("ScoreSettingSV.GetUserScoreInAppExt中发生异常,参数AppId:{0},异常信息:{1}", paramDto.AppId, ex);
                LogHelper.Error(str);

                result.Message    = "服务异常!";
                result.ResultCode = 2;
            }
            return(result);
        }
Ejemplo n.º 13
0
    public ReplacePatternViewModel(ReplacePattern replacePattern)
    {
        this.replacePattern = replacePattern;

        AsExpression = replacePattern
                       .ToReactivePropertyAsSynchronized(x => x.AsExpression)
                       .AddTo(this.CompositeDisposable);

        TargetPattern = replacePattern
                        .ToReactivePropertyAsSynchronized(
            x => x.TargetPattern,
            mode: ReactivePropertyMode.Default | ReactivePropertyMode.IgnoreInitialValidationError,
            ignoreValidationErrorValue: true)
                        .SetValidateNotifyError(x => AppExtension.IsValidRegexPattern(x, AsExpression.Value) ? null : "Invalid Pattern")
                        .AddTo(this.CompositeDisposable);

        ReplaceText = replacePattern
                      .ToReactivePropertyAsSynchronized(
            x => x.ReplaceText,
            mode: ReactivePropertyMode.Default | ReactivePropertyMode.IgnoreInitialValidationError,
            ignoreValidationErrorValue: true)
                      .SetValidateNotifyError(x => AppExtension.IsValidReplacePattern(x, AsExpression.Value) ? null : "Invalid Pattern")
                      .AddTo(this.CompositeDisposable);

        AsExpression
        .Subscribe(x => TargetPattern.ForceValidate());
    }
Ejemplo n.º 14
0
 public AppExtensionWrapper(AppExtension extension)
 {
     WrappedExtension = extension;
     Package          = new AppPackageWrapper(WrappedExtension.Package);
     Description      = extension.Description;
     DisplayName      = extension.DisplayName;
 }
Ejemplo n.º 15
0
    /// <summary>
    /// Creates an Extension object that represents an extension in the extension manager
    /// </summary>
    /// <param name="ext">The extension as represented by the system</param>
    /// <param name="properties">Properties about the extension</param>
    /// <param name="logo">The logo associated with the package that the extension is defined in</param>
    public Extension(AppExtension ext, PropertySet properties, BitmapImage logo)
    {
        AppExtension    = ext;
        this.properties = properties;
        Enabled         = false;
        Loaded          = false;
        Offline         = false;
        Logo            = logo;
        Visible         = Visibility.Collapsed;

        #region Properties

        serviceName = null;
        if (this.properties != null)
        {
            if (this.properties.ContainsKey("Service"))
            {
                PropertySet serviceProperty = this.properties["Service"] as PropertySet;
                serviceName = serviceProperty["#text"].ToString();
            }
        }

        #endregion Properties

        UniqueId = $"{ext.AppInfo.AppUserModelId}!{ext.Id}"; // The name that identifies this extension in the extension manager
    }
Ejemplo n.º 16
0
    public async Task LoadFile_MannyFiles()
    {
        var files = Enumerable.Range(0, 10000)
                    .Select(i => $"ManyFile-{i:0000}.txt")
                    .Select(x => Path.Combine(targetDirPath, x));

        MainModel model = CreateDefaultSettingModel(AppExtension.CreateMockFileSystem(files));

        var progressInfos = model.CurrentProgressInfo
                            .Skip(1)
                            .WhereNotNull()
                            .ToReadOnlyList();

        progressInfos
        .Should().BeEmpty("まだメッセージがないはず");

        //たくさんのファイルを読み込む
        await model.LoadFileElements();

        model.FileElementModels
        .Select(f => f.InputFilePath)
        .Should().HaveCount(10000, "規定数ファイルが読み込まれたはず");

        progressInfos.Select(x => x !.Message).Where(x => x.Contains("ManyFile"))
        .Should().HaveCountGreaterThan(2, "ファイル名を含んだメッセージがいくつか来たはず");
    }
Ejemplo n.º 17
0
        public void Verify_About_System()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.StartApp(platform);
                AppExtension.SetPlatform(platform);
                app.TapAllLocations();
                app.GoTo(SYSTEM);
                app.SkipWalkthrough();
                app.TapHamburgerMenu();
                app.TapOption(e => e.Marked("About"));
                app.Screenshot("About: About Menu").MoveTo($"C:\\Screenshots\\About_AboutMenu__{Guid.NewGuid()}test.com");
                app.TapOption(e => e.Marked("About " + SYSTEM));
                app.Screenshot("About: About Website").MoveTo($"C:\\Screenshots\\AboutMenu_AboutWebsite__{Guid.NewGuid()}.png");
                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapHamburgerMenu();
                app.TapOption(app.GetLabel("About"));
                app.Assert(app.GetLabel("AboutLocation", SYSTEM), true);
                app.TapOption(app.GetLabel("AboutLocation", SYSTEM));
                break;
            }
        }
        public Extension(AppExtension ext, PropertySet properties, BitmapImage logo)
        {
            _extension  = ext;
            _properties = properties;
            _enabled    = false;
            _loaded     = false;
            _offline    = false;
            _logo       = logo;
            _visibility = Visibility.Collapsed;
            _extwebview = new WebView();

            #region Properties
            _serviceName = null;
            if (_properties != null)
            {
                if (_properties.ContainsKey("Service"))
                {
                    PropertySet serviceProperty = _properties["Service"] as PropertySet;
                    _serviceName = serviceProperty["#text"].ToString();
                }
            }
            #endregion

            //AUMID + Extension ID is the unique identifier for an extension
            _uniqueId = ext.AppInfo.AppUserModelId + "!" + ext.Id;

            // webview event when the extension notifies us that something happened
            _extwebview.ScriptNotify += ExtensionCallback;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 获取特定app在电商中的扩展信息。
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.AppExtensionDTO> GetAppExtensionByAppIdExt(System.Guid appId)
        {
            Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.AppExtensionDTO> resultAppExt = new ResultDTO <Jinher.AMP.BTP.Deploy.AppExtensionDTO>();

            try
            {
                if (appId == Guid.Empty)
                {
                    resultAppExt.Message    = "参数错误,appId不能为空!";
                    resultAppExt.ResultCode = 1;
                }
                var aeList = (from ae in AppExtension.ObjectSet()
                              where ae.Id == appId
                              select ae).ToList();
                if (aeList.Any())
                {
                    var aeFirst = aeList.FirstOrDefault();
                    Jinher.AMP.BTP.Deploy.AppExtensionDTO aeDto = aeFirst.ToEntityData();
                    resultAppExt.Data = aeDto;
                }
            }
            catch (Exception ex)
            {
                string str = string.Format("AppExtensionSV.GetAppExtensionByAppIdExt中发生异常,参数AppId:{0},异常信息:{1}", appId, ex);
                LogHelper.Error(str);

                resultAppExt.Message    = "服务异常!";
                resultAppExt.ResultCode = 2;
            }
            return(resultAppExt);
        }
Ejemplo n.º 20
0
        public Extension(AppExtension ext, IPropertySet properties, BitmapImage logo)
        {
            _extension = ext;
            _valueset  = properties;
            _offline   = false;
            _supported = false;
            _logo      = logo;
            _version   = "Unknown";

            // get version from properties
            //if (_valueset != null)
            //{
            //    PropertySet versionProperty = _valueset["TargetVersion"] as PropertySet;
            //    if (versionProperty != null) _version = versionProperty["#text"].ToString();
            //}

            //// check for unsupported version
            //if (_version == "Unknown" || _version.CompareTo("1.4") > 0)
            //{
            //    _version += " (Unsupported Version!)";
            //}
            //else
            //{
            //    _supported = true;
            //}

            //AUMID + Extension ID is the unique identifier for an extension
            _uniqueId = ext.AppInfo.AppUserModelId + "!" + ext.Id;
        }
Ejemplo n.º 21
0
        public void Check_Login_Options()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.StartApp(platform);
                AppExtension.SetPlatform(platform);
                app.TapAllLocations();
                app.GoTo(SYSTEM_DASH);
                app.SkipWalkthrough();
                app.TapProfile();
                app.Screenshot("Login Options").MoveTo($"C:\\Screenshots\\Login_LogInOptions__{Guid.NewGuid()}.png");
                app.Assert(e => e.Id("text_join_bcycle_login").Text(app.GetLabel("JoinBCycle")), true);
                app.Assert(e => e.Id("text_forgot_password_login").Text(app.GetLabel("ForgotPassword")), true);
                app.Tap(e => e.Marked("Navigate up"));
                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapProfile();
                app.Assert(e => e.Id("bar_button_join_bcycle_login").Marked(app.GetLabel("JoinBCycle")), true);
                app.Assert(e => e.Id("bar_button_forgot_password_login").Marked(app.GetLabel("ForgotPassword")), true);
                break;
            }
        }
Ejemplo n.º 22
0
        public bool Salvar([FromBody] dynamic param)
        {
            int id = Convert.ToInt32(param.Id);

            Entities context = new Entities();
            var      obj     = context.Banner.FirstOrDefault(ban => ban.Id == id) ?? new Banner();

            if (Convert.ToInt32(param.IdTipoAcao) == 0)
            {
                obj.Link     = param.Link.ToString();
                obj.Telefone = null;
            }
            else
            {
                obj.Link     = null;
                obj.Telefone = param.Telefone.ToString();
            }
            obj.IdCliente = Convert.ToInt32(param.Cliente.Id);
            obj.Descricao = param.Descricao.ToString();
            obj.Titulo    = param.Titulo.ToString();
            obj.Estreia   = AppExtension.ToDateTime(param.Estreia);
            obj.Expiracao = AppExtension.ToDateTime(param.Expiracao);
            obj.Imagem    = FileController.ConfirmUpload(param.Imagem?.ToString());
            obj.Situacao  = param.Situacao.ToString();

            if (id <= 0)
            {
                obj.Cadastro = DateTime.Now;
                context.Banner.Add(obj);
            }
            context.SaveChanges();
            return(true);
        }
Ejemplo n.º 23
0
        public bool Senha([FromBody] dynamic param)
        {
            string anterior  = param.anterior?.ToString();
            string nova      = param.nova?.ToString();
            string confirmar = param.confirmar?.ToString();

            Entities context = new Entities();
            var      obj     = context.Cliente.Find(AppExtension.IdUsuarioLogado());

            if (anterior != obj.Senha)
            {
                throw new Exception("A senha atual está errada");
            }

            if (nova != confirmar)
            {
                throw new Exception("A nova senha está diferente da confirmação");
            }

            if (nova == null || nova.Length < 4)
            {
                throw new Exception("Sua senha precisa ter pelo menos 4 digitos");
            }

            obj.Senha = nova;

            return(context.SaveChanges() > 0);
        }
        public void Verify_Username_Reset_Password()
        {
            switch (platform)
            {
            case Platform.Android:
                app = AppInitializer.RestartApp(platform);
                AppExtension.SetPlatform(platform);
                app.TapProfile();
                app.WaitForElement(e => e.Text("Sign In"));
                app.Tap(e => e.Text("Forgot password?"));
                app.TapOption("edit_text_location_forgot_password");
                app.WaitForElement("content_location_list_item_template");
                app.GoTo(SYSTEM);
                app.EnterTextAndDismissKeyboard("edit_text_user_forgot_password", USERNAME);
                app.TapOption("button_reset_forgot_password");
                app.Screenshot("Account Recovery: Reset Password Confirmation Message").MoveTo($"C:\\Screenshots\\AccountRecovery_ResetPWConfirmation__{Guid.NewGuid()}.png");
                app.Assert(e => e.Id("alertTitle").Property("text").StartsWith(app.GetLabel("ResetPasswordConfirmation")), true);
                app.TapOption("button1");
                app.Assert(e => e.Text("Sign In"), true);
                break;

            case Platform.iOS:
                app.SkipWalkthrough();
                app.GoTo(SYSTEM);
                app.TapProfile();
                app.TapOption("bar_button_forgot_password_login");
                app.TapOption("button_select_location_forgot_password");
                app.WaitForElement("content_location_list", timeout: TimeSpan.FromSeconds(45));
                app.TapElementInList(SYSTEM);
                app.EnterTextAndDismissKeyboard("edit_text_username_forgot_password", USERNAME);
                app.TapOption("button_send_forgot_password");
                app.Assert(e => e.Property("text").StartsWith(app.GetLabel("ResetPasswordConfirmation")), true);
                break;
            }
        }
        public InfinityPagedList <ServicoContabilViewModel> MeusServicoSolicitados([FromBody] dynamic param)
        {
            int    page     = Convert.ToInt32(param.page);
            int    pageSize = 5;
            string status   = param.status?.ToString();
            int    cliente  = AppExtension.IdUsuarioLogado();

            Entities context = new Entities();
            DateTime now     = DateTime.Now;

            List <ServicoContabilViewModel> list = new List <ServicoContabilViewModel>();
            var query = context.ServicoContabil.AsQueryable();

            query = query.Where(ban => ban.IdCliente == cliente);

            query = query.Where(ban => ban.Status == status);

            query.OrderByDescending(ban => ban.DataSolicitacao).Skip(page * pageSize).Take(pageSize).ToList().ForEach(obj =>
            {
                list.Add(new ServicoContabilViewModel(obj));
            });

            InfinityPagedList <ServicoContabilViewModel> paged = new InfinityPagedList <ServicoContabilViewModel>();

            paged.list     = list;
            paged.pageSize = pageSize;
            paged.current  = page;

            return(paged);
        }
Ejemplo n.º 26
0
 public void InitParamsCodeLogin(string html)
 {
     fb_dtsg = AppExtension.RegexByNameHtml(html, "fb_dtsg", 1);
     lsd     = AppExtension.RegexByNameHtml(html, "lsd", 1);
     jazoest = AppExtension.RegexByNameHtml(html, "jazoest", 1);
     m_ts    = AppExtension.RegexByNameHtml(html, "m_ts", 1);
     li      = AppExtension.RegexByNameHtml(html, "li", 1);
 }
Ejemplo n.º 27
0
 public void ExtensionInit()
 {
     AppExtension.CheckSystemFolder();
     AppExtension.CheckSystemFile();
     fileDao.WriteHeader(AppExtension.GetUserHeader, AppConst.dataPath);
     fileDao.WriteHeader(AppExtension.GetAwardsProperty, AppConst.awardsPath);
     fileDao.WriteHeader(AppExtension.GetUserAwardsProperty, AppConst.userAwardsPath);
 }
Ejemplo n.º 28
0
 public void CreateRegexOrNull()
 {
     AppExtension.CreateRegexOrNull("abc")
     .Should().NotBeNull();
     AppExtension.CreateRegexOrNull("\\w")
     .Should().NotBeNull();
     AppExtension.CreateRegexOrNull("\\l")
     .Should().BeNull();
 }
Ejemplo n.º 29
0
        public static async Task <BitmapImage> GetLogoAsync(this AppExtension extension)
        {
            var logo       = new BitmapImage();
            var fileStream = await extension.AppInfo.DisplayInfo.GetLogo(new Size(1, 1)).OpenReadAsync();

            await logo.SetSourceAsync(fileStream);

            return(logo);
        }
Ejemplo n.º 30
0
            public Extension(AppExtension ext, PropertySet properties, BitmapImage logo)
            {
                _extension = ext;
                _logo      = logo;

                _serviceName = null;

                //AUMID + Extension ID is the unique identifier for an extension
                _uniqueId = ext.AppInfo.AppUserModelId + "!" + ext.Id;
            }
Ejemplo n.º 31
0
        public static async Task <(string, string)> GetConnectionInfo(this AppExtension appExtension)
        {
            var packageFamilyname = appExtension.Package.Id.FamilyName;
            var props             = await appExtension.GetExtensionPropertiesAsync();

            var serviceName = (string)((PropertySet)props["Service"])["#text"];


            return(packageFamilyname, serviceName);
        }
Ejemplo n.º 32
0
        public async Task LoadUWPExtension(AppExtension ext)
        {
            // get unique identifier for this extension
            string identifier = ext.AppInfo.AppUserModelId + "!" + ext.Id;

            // load the extension if the package is OK
            if (!(ext.Package.Status.VerifyIsOK()
                    // This is where we'd normally do signature verfication, but don't care right now
                    //&& extension.Package.SignatureKind == PackageSignatureKind.Store
                    ))
            {
                // if this package doesn't meet our requirements
                // ignore it and return
                return;
            }



            // if its already existing then this is an update
            var existingExt = _extensions.Where(e => e.AppExtensionUniqueId == identifier).FirstOrDefault();

            // new extension
            if (existingExt == null)
            {
                try
                {
                    // get extension properties
                    IPropertySet properties = await ext.GetExtensionPropertiesAsync();
                    //IPropertySet properties = null;
                    
                    // create new extension
                    var nExt = new ExtensionLite(ext, properties);

                    // get content and do stuff with it
                    #region content
                    var folder = await ext.GetPublicFolderAsync();
                    if (folder != null)
                    {
                        var file = await folder.GetFileAsync(nExt.Manifest.IconUrl);
                        using (var randomAccessStream = await file.OpenReadAsync())
                        {
                            BitmapImage logo = new BitmapImage();
                            logo.SetSource(randomAccessStream);
                            nExt.Manifest.IconBitmap = logo;
                            nExt.Manifest.IconUrl = "bitmap";
                        }
                    }
                    //var publicFolder = await ext.Package.InstalledLocation.GetFolderAsync("public");
                    //var file = publicFolder.GetFileAsync("Aws.png");


                    //// get logo 
                    //var filestream = await (ext.AppInfo.DisplayInfo.GetLogo(new Windows.Foundation.Size(1, 1))).OpenReadAsync();
                    //BitmapImage logo = new BitmapImage();
                    //logo.SetSource(filestream);
                    #endregion


                    // Add it to extension list
                    _extensions.Add(nExt);

                    // load it
                    //await nExt.Load();
                }
                catch //(Exception ex)
                {
                    //chances are if it fails retrieving properties that the app was added with no properties .. Uninstall the app and reinstall it and hopefully the latest metadata will be there
                }
            }
            // update
            else
            {
                // unload the extension
                existingExt.UnloadUWPExtension();

                // update the extension
                await existingExt.UpdateUWPExtension(ext);
            }
        }
Ejemplo n.º 33
0
        public async Task UpdateUWPExtension(AppExtension ext)
        {
            // ensure this is the same uid
            string identifier = ext.AppInfo.AppUserModelId + "!" + ext.Id;
            if (identifier != this.AppExtensionUniqueId)
            {
                return;
            }

            // get extension properties
            ValueSet properties = await ext.GetExtensionPropertiesAsync() as ValueSet;

            // get logo 
            var filestream = await (ext.AppInfo.DisplayInfo.GetLogo(new Windows.Foundation.Size(1, 1))).OpenReadAsync();
            BitmapImage logo = new BitmapImage();
            logo.SetSource(filestream);

            // update the extension
            this.AppExtension = ext;
            this._valueset = properties;
            //this._logo = logo;
            /*
            // get version from properties
            if (_props.ContainsKey("Version"))
            {
                this._version = this._props["Version"] as string;
            }
            else
            { */
            //this._version = "Unknown";
            //}

            // load it
            await LoadUWPExtension();
        }