public virtual void SetUp()
        {
            GlobalData.Instance.TestMode = true;
            Settings.Default.ReloadCount = 0;

            browserMock  = new DynamicMock(typeof(IE.WebBrowser));
            documentMock = new DynamicMock(typeof(HTMLDocument));
            elementMock  = new List <DynamicMock>();

            webBrowser                      = browserMock.MockInstance as IE.WebBrowser;
            paymentInfo                     = new PaymentInfo();
            paymentInfo.Amount              = "123.12";
            paymentInfo.AmountToPay         = "120.00";
            paymentInfo.BankAccountNo       = "PL 1234567980";
            paymentInfo.BillerName          = "Some Biller Name`~!@#$%^&*_={}[];\"'<>|\\() of the ~`!@#$%^&*()_+{}|:\"<>?=[]\\'";
            paymentInfo.City                = "CityName`~!@#$%^&*_={}[];\"'<>|\\() of the ~`!@#$%^&*()_+{}|:\"<>?=[]\\'";
            paymentInfo.Currency            = "PLN";
            paymentInfo.DefinedTransferName = "Defined Transfer";
            paymentInfo.DueDate             = "20.03.2010";
            paymentInfo.Id                  = "12345";
            paymentInfo.PostalCode          = "12098";
            paymentInfo.State               = State.IDLE;
            paymentInfo.Street              = "Some Street name`~!@#$%^&*_={}[];\"'<>|\\() of the ~`!@#$%^&*()_+{}|:\"<>?=[]\\'";
            paymentInfo.Title               = "Title `~!@#$%^&*_={}[];\"'<>|\\() of the ~`!@#$%^&*()_+{}|:\"<>?=[]\\'payment";

            request  = new PaymentRequest(webBrowser, paymentInfo);
            provider = CreateProvider();
        }
Esempio n. 2
0
        public void GenerateGridDefault(ref int line, TabSettings <TKey> settings)
        {
            if (settings.Gdb.LayoutIndexes != null)
            {
                AbstractProvider metaProvider = AbstractProvider.GetProvider(settings.Gdb.LayoutIndexes);

                if (metaProvider is GroupIndexProvider)
                {
                    AbstractProvider gridProvider = AbstractProvider.GetProvider(settings.Gdb.GridIndexes);
                    gridProvider.GroupAs = typeof(SpecifiedIndexProvider);
                    bool col = false;

                    foreach (IIndexProvider provider in metaProvider.Providers)
                    {
                        AbstractProvider gridLayout = gridProvider.Next <AbstractProvider>();
                        GTabsMaker.PrintGrid(ref line, (col = !col) ? 0 : 3, 1, 2, provider, gridLayout, settings.GeneralProperties, settings.Gdb.AttributeList);
                        if (col)
                        {
                            line--;
                        }
                    }
                }
                else
                {
                    GTabsMaker.Print(ref line, metaProvider, settings.GeneralProperties, settings.Gdb.AttributeList);
                }
            }
            else
            {
                GTabsMaker.Print(ref line, new SpecifiedRangeIndexProvider(new int[] { 0, settings.Gdb.AttributeList.Attributes.Count }), settings.GeneralProperties, settings.Gdb.AttributeList);
            }
        }
Esempio n. 3
0
        private void _generateGrid(ref int line, GenericDatabase database, TabControl control, DisplayableProperty <TKey, ReadableTuple <TKey> > generalProperties, BaseDb gdb)
        {
            if (gdb.LayoutIndexes != null)
            {
                AbstractProvider metaProvider = AbstractProvider.GetProvider(gdb.LayoutIndexes);

                if (metaProvider is GroupIndexProvider)
                {
                    AbstractProvider gridProvider = AbstractProvider.GetProvider(gdb.GridIndexes);
                    gridProvider.GroupAs = typeof(SpecifiedIndexProvider);
                    bool col = false;

                    foreach (IIndexProvider provider in metaProvider.Providers)
                    {
                        AbstractProvider gridLayout = gridProvider.Next <AbstractProvider>();
                        GTabsMaker.PrintGrid(ref line, (col = !col) ? 0 : 3, 1, 2, provider, gridLayout, generalProperties, gdb.AttributeList);
                        if (col)
                        {
                            line--;
                        }
                    }
                }
                else
                {
                    GTabsMaker.Print(ref line, metaProvider, generalProperties, gdb.AttributeList);
                }
            }
            else
            {
                GTabsMaker.Print(ref line, new SpecifiedRangeIndexProvider(new int[] { 0, gdb.AttributeList.Attributes.Count }), generalProperties, gdb.AttributeList);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="mc">matched search results</param>
 /// <param name="prov">Provider to take regexps from</param>
 /// <param name="multi">multi selection</param>
 public SelectResult(MatchCollection mc, AbstractProvider prov, bool multi)
 {
     InitializeComponent();
     mcResults = mc;
     P         = prov;
     Multi     = multi;
     if (multi)
     {
         Height = 336;
         cbResults.Hide();
         lvResults.Show();
     }
     else
     {
         Height = 114;
         cbResults.Show();
         lvResults.Hide();
     }
     if (mc != null && mc.Count > 0)
     {
         for (int i = mc.Count - 1; i >= 0; i--)
         {
             Match  m    = mc[i];
             string name = System.Web.HttpUtility.HtmlDecode(m.Groups["name"].Value + " " + m.Groups["year"].Value);
             if (P.SearchRemove != null)
             {
                 foreach (string str in P.SearchRemove)
                 {
                     if (str != "")
                     {
                         name = Regex.Replace(name, str, "");
                     }
                 }
             }
             if (multi)
             {
                 lvResults.Items.Add(new ListViewItem(name));
                 lblResults.Text = mc.Count.ToString() + " Results found. Select the fitting ones:";
                 lvResults.Sort();
                 lvResults.Refresh();
             }
             else
             {
                 cbResults.Items.Add(name);
                 cbResults.SelectedIndex = 0;
                 lblResults.Text         = mc.Count.ToString() + " Results found. Select the fitting one:";
             }
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mc">matched search results</param>
        /// <param name="prov">Provider to take regexps from</param>
        /// <param name="multi">multi selection</param>
        public SelectResult(MatchCollection mc,AbstractProvider prov,bool multi)
        {
            InitializeComponent();
            mcResults = mc;
            P = prov;
            Multi = multi;
            if (multi)
            {
                Height = 336;
                cbResults.Hide();
                lvResults.Show();
            }
            else
            {
                Height = 114;
                cbResults.Show();
                lvResults.Hide();
            }
            if (mc != null && mc.Count > 0)
            {
                for(int i =mc.Count-1;i>=0;i--){
                    Match m=mc[i];
                    string name = System.Web.HttpUtility.HtmlDecode(m.Groups["name"].Value + " " + m.Groups["year"].Value);
                    if (P.SearchRemove != null)
                    {
                        foreach (string str in P.SearchRemove)
                        {
                            if (str != "")
                            {
                                name = Regex.Replace(name, str, "");
                            }
                        }
                    }
                    if (multi)
                    {
                        lvResults.Items.Add(new ListViewItem(name));
                        lblResults.Text = mc.Count.ToString() + " Results found. Select the fitting ones:";
                        lvResults.Sort();
                        lvResults.Refresh();
                    }
                    else
                    {
                        cbResults.Items.Add(name);
                        cbResults.SelectedIndex = 0;
                        lblResults.Text = mc.Count.ToString() + " Results found. Select the fitting one:";
                    }
                }

            }
        }
Esempio n. 6
0
    /// <summary>
    /// Copies role binding from parent UI element.
    /// </summary>
    /// <param name="element">Element which are permissions copied to</param>
    private void CopyFromParent(UIElementInfo element)
    {
        using (var tr = new CMSTransactionScope())
        {
            if (element != null)
            {
                // Delete existing bindings
                DataSet elemRoles = RoleUIElementInfoProvider.GetRoleUIElements("ElementID = " + element.ElementID, null);
                if (!DataHelper.DataSourceIsEmpty(elemRoles))
                {
                    foreach (DataRow dr in elemRoles.Tables[0].Rows)
                    {
                        // Get role id
                        int roleId = ValidationHelper.GetInteger(dr["RoleID"], 0);
                        // Remove binding
                        RoleUIElementInfoProvider.DeleteRoleUIElementInfo(roleId, element.ElementID);
                    }
                }

                // Add same bindings as parent has
                int parentElemId = element.ElementParentID;

                DataSet parentRoles = RoleUIElementInfoProvider.GetRoleUIElements("ElementID = " + parentElemId, null);
                if (!DataHelper.DataSourceIsEmpty(parentRoles))
                {
                    foreach (DataRow dr in parentRoles.Tables[0].Rows)
                    {
                        // Get role id
                        int roleId = ValidationHelper.GetInteger(dr["RoleID"], 0);
                        // Create binding
                        RoleUIElementInfoProvider.AddRoleUIElementInfo(roleId, element.ElementID);
                    }
                }
            }

            // Commit transaction
            tr.Commit();
        }

        // Invalidate all users
        UserInfo.TYPEINFO.InvalidateAllObjects();

        // Clear hashtables with users
        AbstractProvider.ClearHashtables(UserInfo.OBJECT_TYPE, true);
    }
Esempio n. 7
0
 public ParseHTMLStrategy(AbstractProvider provider, ConfigurationWrapper someConfiguration)
 {
     theProvider      = provider;
     theConfiguration = someConfiguration;
     setSearchRegExp(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.REGEX_PARSE_SEARCH_RESULTS_KEY));
     setSearchResultsUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_RESULTS_URL_KEY));
     setSearchUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_URL_KEY));
     setSeriesUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SERIES_URL_KEY));
     setSearchRemove(theConfiguration.getMultiStringProperty(ParseHTMLStrategyProperties.SEARCH_REMOVE_KEY));
     setSearchStart(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_START_KEY));
     setSearchEnd(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_END_KEY));
     setNotFoundUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.NOT_FOUND_URL_KEY));
     setEncoding(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.ENCODING_KEY));
     setLanguage(theConfiguration.getEnumProperty <Language>(ParseHTMLStrategyProperties.LANGUAGE_KEY));
     setSearchRightToLeft(theConfiguration.getSingleBoolProperty(ParseHTMLStrategyProperties.SEARCH_RIGHT_TO_LEFT_KEY));
     setSearchResultsBlacklist(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.REGEX_SEARCH_RESULTS_BLACKLIST_KEY));
     setRelationsRemove(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.RELATIONS_REMOVE_KEY));
 }
 public ParseHTMLStrategy(AbstractProvider provider, ConfigurationWrapper someConfiguration)
 {
     theProvider = provider;
     theConfiguration = someConfiguration;
     setSearchRegExp(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.REGEX_PARSE_SEARCH_RESULTS_KEY));
     setSearchResultsUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_RESULTS_URL_KEY));
     setSearchUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_URL_KEY));
     setSeriesUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SERIES_URL_KEY));
     setSearchRemove(theConfiguration.getMultiStringProperty(ParseHTMLStrategyProperties.SEARCH_REMOVE_KEY));
     setSearchStart(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_START_KEY));
     setSearchEnd(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.SEARCH_END_KEY));
     setNotFoundUrl(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.NOT_FOUND_URL_KEY));
     setEncoding(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.ENCODING_KEY));
     setLanguage(theConfiguration.getEnumProperty<Language>(ParseHTMLStrategyProperties.LANGUAGE_KEY));
     setSearchRightToLeft(theConfiguration.getSingleBoolProperty(ParseHTMLStrategyProperties.SEARCH_RIGHT_TO_LEFT_KEY));
     setSearchResultsBlacklist(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.REGEX_SEARCH_RESULTS_BLACKLIST_KEY));
     setRelationsRemove(theConfiguration.getSingleStringProperty(ParseHTMLStrategyProperties.RELATIONS_REMOVE_KEY));
 }
Esempio n. 9
0
    protected void gridMatrix_OnItemChanged(object sender, int rowItemId, int colItemId, bool newState)
    {
        if (newState)
        {
            RoleUIElementInfoProvider.AddRoleUIElementInfo(rowItemId, colItemId);
        }
        else
        {
            RoleUIElementInfoProvider.DeleteRoleUIElementInfo(rowItemId, colItemId);
        }

        // Invalidate all users
        UserInfo.TYPEINFO.InvalidateAllObjects();

        // Forget old user
        CurrentUser = null;

        // Clear hashtables with users
        AbstractProvider.ClearHashtables(UserInfo.OBJECT_TYPE, true);

        // Update content before rows
        GenerateBeforeRowsContent();
    }
Esempio n. 10
0
 public HMCommonDataService()
 {
     _abstractPrivder = new AbstractProvider(ConfigurationManager.AppSettings);
 }
Esempio n. 11
0
 public static void GetDeals(wp_user user)
 {
     log.Info("Getting deals for Amazon.");
     log.InfoFormat("Using value <{0}> for the configuration key DB_CONNECTION_STRING.", Config.DB_CONNECTION_STRING);
     AbstractProvider.Execute(MERCHANT.AMAZON, user, DataFeed.Download, Parser.GetDeals, Parser.GetShops);
 }
Esempio n. 12
0
        public static Grid PrintGrid <TKey, TValue>(ref int line, int col, int rowSpan, int colSpan, IIndexProvider provider, AbstractProvider gridProvider, DisplayableProperty <TKey, TValue> generalProperties, AttributeList list) where TValue : Tuple
        {
            if (gridProvider is NullIndexProvider && provider is NullIndexProvider)
            {
                line++;
                return(null);
            }

            if (gridProvider is NullIndexProvider)
            {
                // No grid is being printed, but the provider is not null
                Print(ref line, provider, generalProperties, list);
                return(null);
            }

            if (gridProvider == null)
            {
                return(PrintGrid(ref line, col, rowSpan, colSpan, provider, -1, 0, -1, 0, generalProperties, list));
            }

            return(PrintGrid(ref line, col, rowSpan, colSpan, provider, gridProvider[0], gridProvider[1], gridProvider[2], gridProvider[3], generalProperties, list));
        }
Esempio n. 13
0
 public static void GetDeals(MERCHANT merchant, wp_user user)
 {
     AbstractProvider.Execute(merchant, user, DataFeed.Download, Parser.GetDeals);
 }
Esempio n. 14
0
 public RegisterManager(AbstractProvider abstractProvider) : base(abstractProvider)
 {
 }
Esempio n. 15
0
        public static void TgOnTabVisualUpdate(GDbTabWrapper <TKey, ReadableTuple <TKey> > tab, GTabSettings <TKey, ReadableTuple <TKey> > settings, BaseDb gdb)
        {
            tab.Dispatch(delegate {
                ((UIElement)tab.Content).IsEnabled = IsTabEnabled(settings, gdb);
            });

            List <DbAttribute> attributes = settings.AttributeList.Attributes;

            if (gdb.LayoutIndexes != null)
            {
                AbstractProvider provider = AbstractProvider.GetProvider(gdb.LayoutIndexes);

                if (provider is GroupIndexProvider)
                {
                    return;
                }

                List <int> indexes = provider.GetIndexes();

                int row = 0;
                int column;

                for (int i = 0; i < indexes.Count; i += 2)
                {
                    column = 0;

                    if (indexes[i] > -1 && indexes[i] < attributes.Count)
                    {
                        var attribute = attributes[indexes[i]];
                        if (attribute.IsSkippable)
                        {
                            var  attached = gdb.Attached[attribute.DisplayName];
                            bool isSet    = attached == null || (bool)gdb.Attached[attribute.DisplayName];

                            tab.Dispatch(delegate {
                                var label   = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column);
                                var content = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column + 1);

                                if (label != null)
                                {
                                    label.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed;
                                    label.IsEnabled  = isSet;
                                }

                                if (content != null)
                                {
                                    content.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed;
                                    content.IsEnabled  = isSet;
                                }
                            });
                        }
                    }

                    column += 3;

                    if (i + 1 < indexes.Count)
                    {
                        if (indexes[i + 1] > -1 && indexes[i + 1] < attributes.Count)
                        {
                            var attribute = attributes[indexes[i + 1]];
                            if (attribute.IsSkippable)
                            {
                                var  attached = gdb.Attached[attribute.DisplayName];
                                bool isSet    = attached == null || (bool)gdb.Attached[attribute.DisplayName];

                                tab.Dispatch(delegate {
                                    var label   = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column);
                                    var content = tab._displayGrid.Children.Cast <UIElement>().FirstOrDefault(p => (int)p.GetValue(Grid.RowProperty) == row && (int)p.GetValue(Grid.ColumnProperty) == column + 1);

                                    if (label != null)
                                    {
                                        label.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed;
                                        label.IsEnabled  = isSet;
                                    }

                                    if (content != null)
                                    {
                                        content.Visibility = isSet ? Visibility.Visible : Visibility.Collapsed;
                                        content.IsEnabled  = isSet;
                                    }
                                });
                            }
                        }
                    }

                    row += 2;
                }
            }
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            AbstractProvider abstractProvider = new AbstractProvider(ConfigurationManager.AppSettings);

            abstractProvider.GenerateAllTips();
        }