Пример #1
0
        public string GetFilterLayoutJs(string userId = "")
        {
            List <string> fileds = this.CanFilterFields(userId);

            if (fileds == null || fileds.Count == 0)
            {
                return(string.Empty);
            }
            List <FilterField> filterFiledList = new List <FilterField>();

            foreach (var item in fileds)
            {
                DataTable dt = this.DataSet.Tables[0];
                if (dt.Columns[item] == null)
                {
                    throw new Exception("字段不存在");
                }
                DefineField df = DataSourceHelper.ConvertToDefineField(dt.Columns[item]);
                filterFiledList.Add(new FilterField(df.ControlType, df.Name, df.DisplayName));
            }
            if (this.Template.BillType == BillType.Rpt)
            {
                return(JsBuilder.BuildFilterFieldJs(filterFiledList));
            }

            else
            {
                // 主数据、单据、Grid
                return(JsBuilder.BuildFilterFieldJsForBillListing(filterFiledList));
            }
        }
Пример #2
0
        /// <summary>
        /// Execute as list.
        /// </summary>
        /// <typeparam name="T">Given type of object</typeparam>
        /// <param name="storedProcedureName">Store procedure name.</param>
        /// <param name="parameterCollection">Accept Key Value collection for parameters.</param>
        /// <returns>Type of list of object implementing.</returns>
        public List <T> ExecuteAsList <T>(string storedProcedureName, List <KeyValuePair <string, object> > parameterCollection)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(ConnectionString))
            {
                NpgsqlCommand command = new NpgsqlCommand();
                command.Connection  = conn;
                command.CommandText = storedProcedureName;
                command.CommandType = CommandType.StoredProcedure;

                for (int i = 0; i < parameterCollection.Count; i++)
                {
                    NpgsqlParameter sqlParaMeter = new NpgsqlParameter();
                    sqlParaMeter.IsNullable    = true;
                    sqlParaMeter.ParameterName = parameterCollection[i].Key;
                    sqlParaMeter.Value         = parameterCollection[i].Value;
                    command.Parameters.Add(sqlParaMeter);
                }

                conn.Open();
                NpgsqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                List <T>         mList  = new List <T>();
                mList = DataSourceHelper.FillCollection <T>(reader);
                if (reader != null)
                {
                    reader.Close();
                }
                reader.Close();
                return(mList);
            }
        }
Пример #3
0
        public async Task <PageLayoutViewModel> GetLayoutElement(string pageName, int siteID)
        {
            var ds = await new BlockDataProvider().GetLayoutElement(pageName, siteID);
            PageLayoutViewModel obj = new PageLayoutViewModel()
            {
                Elements = new List <LayoutElements>(),
            };
            IList <LayoutElement> lstElements = DataSourceHelper.FillCollection <LayoutElement>(ds.Tables[0]);
            IList <ViewModule>    lstModule   = DataSourceHelper.FillCollection <ViewModule>(ds.Tables[1]);

            foreach (var e in lstElements)
            {
                if (e.HasInnerElement)
                {
                    LayoutElements ele = CreateElements(e);
                    ele.InnerElements = GetInnerElement(e.ElementID, lstElements, lstModule);
                    obj.Elements.Add(ele);
                }
                else
                {
                    break;
                }
            }
            return(obj);
        }
Пример #4
0
        public void InitalizingMapPresenterWithNonEmptyMapHasUndefinedView()
        {
            MockRepository mocks = new MockRepository();

            Map map = new Map(_factories.GeoFactory);

            map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer(_factories.GeoFactory));

            IMapView2D mapView = mocks.Stub <IMapView2D>();

            SetupResult.For(mapView.Dpi).Return(ScreenHelper.Dpi);
            mapView.ViewSize = new Size2D(1000, 1000);

            mocks.ReplayAll();

            TestPresenter2D mapPresenter = new TestPresenter2D(map, mapView);

            //Assert.Equal(map.Center[Ordinates.X], mapPresenter.GeoCenter[Ordinates.X]);
            //Assert.Equal(map.Center[Ordinates.Y], mapPresenter.GeoCenter[Ordinates.Y]);
            Assert.Equal(0, mapPresenter.WorldWidth);
            Assert.Equal(0, mapPresenter.WorldHeight);
            Assert.Equal(0, mapPresenter.WorldUnitsPerPixel);
            Assert.Equal(1, mapPresenter.WorldAspectRatio);
            Assert.Equal(0, mapPresenter.PixelWorldWidth);
            Assert.Equal(0, mapPresenter.PixelWorldHeight);
            Assert.Equal(null, mapPresenter.ToViewTransform);
            Assert.Equal(null, mapPresenter.ToWorldTransform);
        }
Пример #5
0
        public void MovingRowTriggersViewListChangedItemMovedNotification()
        {
            // TODO: implement MovingRowTriggersViewListChangedItemMovedNotification
            FeatureProvider  data  = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureDataTable table = new FeatureDataTable(_factories.GeoFactory);

            IExtents halfBounds = data.GetExtents();

            halfBounds.Scale(0.5);

            FeatureQueryExpression query  = FeatureQueryExpression.Intersects(data.GetExtents());
            IFeatureDataReader     reader = data.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);
            FeatureDataView view = new FeatureDataView(table);

            Boolean addNotificationOccured = false;

            view.ListChanged += delegate(Object sender, ListChangedEventArgs e)
            {
                if (e.ListChangedType == ListChangedType.ItemMoved)
                {
                    addNotificationOccured = true;
                }
            };

            Assert.True(addNotificationOccured);
        }
Пример #6
0
        public void SettingOidFilterAllowsOnlyFeaturesContainingFilteredOidsInView()
        {
            FeatureProvider         data   = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureDataTable <Guid> table  = new FeatureDataTable <Guid>("Oid", _factories.GeoFactory);
            FeatureQueryExpression  query  = FeatureQueryExpression.Intersects(data.GetExtents());
            IFeatureDataReader      reader = data.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);
            Guid[] ids = new Guid[3];
            ids[0] = (table.Rows[1] as FeatureDataRow <Guid>).Id;
            ids[1] = (table.Rows[4] as FeatureDataRow <Guid>).Id;
            ids[2] = (table.Rows[6] as FeatureDataRow <Guid>).Id;
            FeatureDataView view = new FeatureDataView(table);

            view.OidFilter = new OidCollectionExpression(ids);

            Assert.Equal(3, view.Count);
            Assert.True(view.Find(ids[0]) > -1);
            Assert.True(view.Find(ids[1]) > -1);
            Assert.True(view.Find(ids[2]) > -1);
            Assert.Equal(-1, view.Find((table.Rows[0] as FeatureDataRow <Guid>).Id));
            Assert.Equal(-1, view.Find((table.Rows[2] as FeatureDataRow <Guid>).Id));
            Assert.Equal(-1, view.Find((table.Rows[3] as FeatureDataRow <Guid>).Id));
            Assert.Equal(-1, view.Find((table.Rows[5] as FeatureDataRow <Guid>).Id));
        }
Пример #7
0
        public void ChangeViewSpatialFilterTriggersNotification()
        {
            FeatureProvider        data   = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureDataTable       table  = new FeatureDataTable(_factories.GeoFactory);
            FeatureQueryExpression query  = FeatureQueryExpression.Intersects(data.GetExtents());
            IFeatureDataReader     reader = data.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);
            FeatureDataView view = new FeatureDataView(table);

            Boolean resetNotificationOccured = false;

            view.ListChanged += delegate(Object sender, ListChangedEventArgs e)
            {
                if (e.ListChangedType == ListChangedType.Reset)
                {
                    resetNotificationOccured = true;
                }
            };

            Assert.False(resetNotificationOccured);

            IExtents queryExtents = _factories.GeoFactory.CreateExtents2D(0, 0, 10, 10);
            SpatialBinaryExpression expression = SpatialBinaryExpression.Intersects(queryExtents);

            view.SpatialFilter = expression;

            Assert.True(resetNotificationOccured);
        }
Пример #8
0
        public void AddingRowToTableTriggersViewListChangedItemAddedNotification()
        {
            FeatureProvider  data  = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureDataTable table = new FeatureDataTable(_factories.GeoFactory);

            IExtents halfBounds = data.GetExtents();

            halfBounds.Scale(0.5);

            FeatureQueryExpression query  = FeatureQueryExpression.Intersects(halfBounds);
            IFeatureDataReader     reader = data.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);
            FeatureDataView view = new FeatureDataView(table);

            Boolean addNotificationOccured = false;

            view.ListChanged += delegate(Object sender, ListChangedEventArgs e)
            {
                if (e.ListChangedType == ListChangedType.ItemAdded)
                {
                    addNotificationOccured = true;
                }
            };

            FeatureDataRow row = table.NewRow();

            row["Oid"]         = Guid.NewGuid();
            row["FeatureName"] = "New row";
            row.Geometry       = _factories.GeoFactory.CreatePoint2D(44, 44);
            table.AddRow(row);

            Assert.True(addNotificationOccured);
        }
Пример #9
0
        public void ChangeViewSpatialFilterReturnsOnlyFilteredRows()
        {
            FeatureProvider        data   = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureDataTable       table  = new FeatureDataTable(_factories.GeoFactory);
            FeatureQueryExpression query  = FeatureQueryExpression.Intersects(data.GetExtents());
            IFeatureDataReader     reader = data.ExecuteFeatureQuery(query);

            table.Load(reader);
            IGeometry queryExtents = _factories.GeoFactory.CreateExtents2D(0, 0, 10, 10).ToGeometry();

            List <FeatureDataRow> expectedRows = new List <FeatureDataRow>();

            foreach (FeatureDataRow row in table)
            {
                IGeometry g = row.Geometry;

                if (queryExtents.Intersects(g))
                {
                    expectedRows.Add(row);
                }
            }

            FeatureDataView         view       = new FeatureDataView(table);
            SpatialBinaryExpression expression = SpatialBinaryExpression.Intersects(queryExtents);

            view.SpatialFilter = expression;

            Assert.Equal(expectedRows.Count, view.Count);
        }
Пример #10
0
        public void ChangeViewAttributeFilterTriggersNotification()
        {
            FeatureProvider        data   = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory);
            FeatureDataTable       table  = new FeatureDataTable(_factories.GeoFactory);
            FeatureQueryExpression query  = FeatureQueryExpression.Intersects(data.GetExtents());
            IFeatureDataReader     reader = data.ExecuteFeatureQuery(query);

            table.Load(reader, LoadOption.OverwriteChanges, null);
            FeatureDataView view = new FeatureDataView(table);

            Boolean resetNotificationOccured = false;

            view.ListChanged += delegate(Object sender, ListChangedEventArgs e)
            {
                if (e.ListChangedType == ListChangedType.Reset)
                {
                    resetNotificationOccured = true;
                }
            };

            Assert.False(resetNotificationOccured);

            Assert.Throws <NotSupportedException>(delegate { view.RowFilter = "FeatureName LIKE 'A m*'"; });
            Assert.True(resetNotificationOccured);
        }
Пример #11
0
        //GetInterestForCampaign
        public async Task <IList <InterestInfo> > GetInterestForCampaign(int SiteID)
        {
            NL_Provider provider = new NL_Provider();
            DataSet     ds       = await provider.GetInterestForCampaign(SiteID);

            List <InterestInfo>      finalList = new List <InterestInfo>();
            IList <InterestTempInfo> infos     = new List <InterestTempInfo>();

            if (ds.Tables.Count > 0)
            {
                infos = DataSourceHelper.FillCollection <InterestTempInfo>(ds.Tables[0]);

                List <string> appNames = infos.Select(x => x.AppName).Distinct().ToList();

                foreach (string appName in appNames)
                {
                    List <InterestTempInfo> tempInfos  = infos.ToList <InterestTempInfo>().FindAll(x => x.AppName == appName);
                    List <string>           categories = tempInfos.Select(x => x.CategoryName).Distinct().ToList();
                    foreach (string category in categories)
                    {
                        List <InterestTempInfo> tempCatInfos = tempInfos.FindAll(x => x.CategoryName == category);
                        List <string>           keywords     = tempCatInfos.Select(x => x.KeyWord).ToList();
                        InterestInfo            objInfo      = new InterestInfo();
                        objInfo.AppName      = appName;
                        objInfo.CategoryName = category;
                        objInfo.KeyWordList  = keywords;
                        finalList.Add(objInfo);
                    }
                }
            }
            return(finalList);
        }
Пример #12
0
        private void Initialization()
        {
            if (tableDataSource == null)
            {
                DataTable filterRefTable = DataSourceHelper.GetDataTable(DataSource);

                // Initialization SessionWorker
                if (SessionWorker == null)
                {
                    var sw = new SessionWorker {
                        Key = Guid.NewGuid().ToString()
                    };
                    sw.SetSession(HttpContext.Current.Session);
                    sw.Object     = filterRefTable.DataSet;
                    SessionWorker = sw;
                }

                // Initialization tableDataSource
                Type tableAdapterType =
                    TableAdapterTools.GetTableAdapterType(filterRefTable.GetType());
                tableDataSource = new TableDataSource
                {
                    ID            = "tableDataSource_ID",
                    TypeName      = tableAdapterType.FullName,
                    SelectMethod  = this._storage.SelectMethod,
                    FillType      = TableDataSourceFillType.ParametersNotChanged,
                    SessionWorker = this.SessionWorker,
                    SetFilterByCustomConditions = false,
                };
                tableDataSource.View.CustomConditions.AddRange(_storage.CustomConditions);
            }
        }
        public void RenderFeatureTest()
        {
            IFeatureProvider   provider       = DataSourceHelper.CreateGeometryDatasource(_factories.GeoFactory);
            TestVectorRenderer vectorRenderer = new TestVectorRenderer();
            BasicGeometryRenderer2D <RenderObject> geometryRenderer =
                new BasicGeometryRenderer2D <RenderObject>(vectorRenderer);

            FeatureDataTable       features = new FeatureDataTable(_factories.GeoFactory);
            IExtents               extents  = provider.GetExtents();
            FeatureQueryExpression query    = new FeatureQueryExpression(extents.ToGeometry(),
                                                                         SpatialOperation.Intersects,
                                                                         provider);

            features.Merge(provider.ExecuteFeatureQuery(query) as IEnumerable <IFeatureDataRecord>,
                           provider.GeometryFactory);

            foreach (FeatureDataRow feature in features)
            {
                IGeometry           g = feature.Geometry;
                List <RenderObject> renderedObjects = new List <RenderObject>(geometryRenderer.RenderFeature(feature));

                for (Int32 i = 0; i < renderedObjects.Count; i++)
                {
                    RenderObject ro = renderedObjects[i];
                }
            }
        }
Пример #14
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            plotter.AddLineGraph(DataSourceHelper.CreateDataSource(x => x != 0 ? 10 * Math.Sin(x) / x : 1));


            var line = plotter.AddLineGraph(DataSourceHelper.CreateDataSource(x => Math.Sqrt(x)));

            // this will set different look to line chart's legend item - text from the left and line segment from the right
            NewLegend.SetLegendItemsBuilder(line, new LegendItemsBuilder(CreateDifferentlyLookingLegendItem));

            // creating and adding to plotter line chart's description editor
            StackPanel textEditingPanel = new StackPanel {
                Orientation = Orientation.Horizontal, Background = Brushes.LightGray
            };
            TextBlock label = new TextBlock {
                Text = "Chart's legend description:", Margin = new Thickness(5, 10, 0, 10), VerticalAlignment = VerticalAlignment.Center
            };
            TextBox editor = new TextBox {
                DataContext = line, Margin = new Thickness(5, 10, 5, 10)
            };

            editor.SetBinding(TextBox.TextProperty, new Binding {
                Path = new PropertyPath("(0)", NewLegend.DescriptionProperty), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            });

            textEditingPanel.Children.Add(label);
            textEditingPanel.Children.Add(editor);
            plotter.Children.Add(textEditingPanel);
        }
Пример #15
0
        ///<summary>
        ///构建数据库模型
        ///</summary>
        protected override void BuildDataSet()
        {
            this.DataSet = new DataSet();
            DataTable comType = new DataTable(tableName);

            //构建表结构
            DataSourceHelper.AddColumn(new DefineField(comType, "ABNORMALREASONID", "原因代码", FieldSize.Size20)
            {
                AllowCopy = false, AllowEmpty = false, DataType = LibDataType.Text
            });
            DataSourceHelper.AddColumn(new DefineField(comType, "ABNORMALREASONNAME", "原因名称", FieldSize.Size50)
            {
                AllowEmpty = false, DataType = LibDataType.NText
            });
            DataSourceHelper.AddColumn(new DefineField(comType, "ABNORMALREASONTYPEID", "原因类别", FieldSize.Size20)
            {
                AllowEmpty     = false,
                DataType       = LibDataType.Text,
                RelativeSource = new RelativeSourceCollection()
                {
                    new RelativeSource("com.AbnormalReasonType")
                    {
                        RelFields = new RelFieldCollection()
                        {
                            new RelField("ABNORMALREASONTYPENAME", LibDataType.NText, FieldSize.Size50, "原因类别名称")
                        }
                    }
                }
            });
            DataSourceHelper.AddFixColumn(comType, this.BillType);                         //系统自动创建的内容
            comType.PrimaryKey = new DataColumn[] { comType.Columns["ABNORMALREASONID"] }; //定义表的主键
            this.DataSet.Tables.Add(comType);
        }
Пример #16
0
        internal MassMailEditInfo GetMassMailDetailForEdit(long massmailID)
        {
            List <KeyValuePair <string, object> > Param = new List <KeyValuePair <string, object> >();

            Param.Add(new KeyValuePair <string, object>("@MassMailID", massmailID));

            SQLHandler objHandler = new SQLHandler();

            try
            {
                DataSet ds = objHandler.ExecuteAsDataSet("[dbo].[usp_SCAdmin_GetMailDetailByMassMailID]", Param);

                if (ds != null && ds.Tables.Count > 0)
                {
                    MassMailEditInfo objMail = DataSourceHelper.FillObject <MassMailEditInfo>(ds.Tables[0].CreateDataReader());
                    List <MassMailFilterTypeInfo> lstAdditionalUsers = new List <MassMailFilterTypeInfo>();
                    lstAdditionalUsers = DataSourceHelper.FillCollection <MassMailFilterTypeInfo>(ds.Tables[1]);

                    objMail.AdditionalUsers = lstAdditionalUsers;
                    return(objMail);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                return(null);
                //base.ProcessExcetion(ex);
            }
        }
Пример #17
0
        internal MassMailSendInfo GetMailAndUserToSendMail(string SecheduleDate)
        {
            const string sp = "[dbo].[Admin_MassMail_GetMailForSend]";
            List <KeyValuePair <string, object> > Param = new List <KeyValuePair <string, object> >();

            Param.Add(new KeyValuePair <string, object>("@ScheduleDate", SecheduleDate));
            SQLHandler objHandler = new SQLHandler();

            try
            {
                DataSet ds = objHandler.ExecuteAsDataSet(sp, Param);
                if (ds != null && ds.Tables.Count > 0)
                {
                    MassMailSendInfo objMail  = DataSourceHelper.FillObject <MassMailSendInfo>(ds.Tables[0].CreateDataReader());
                    List <UserInfo>  lstUsers = new List <UserInfo>();
                    lstUsers            = DataSourceHelper.FillCollection <UserInfo>(ds.Tables[1]);
                    objMail.MailToUsers = lstUsers;
                    return(objMail);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #18
0
        private static DataTable GetDataSource(Report report, DataSource dataSource)
        {
            var parameters = new ParameterInfo
            {
                Parameters           = report.Parameters,
                DataSourceParameters = dataSource.Parameters
            };

            var result = DataSourceHelper.GetDataTable(report.Tenant, dataSource.Query, parameters);

            if (!dataSource.ReturnsJson)
            {
                return(result);
            }

            if (result.Rows?.Count == 0)
            {
                return(result);
            }

            var token = result.Rows[0][0];

            if (token == null)
            {
                return(result);
            }

            string json = token.ToString();

            result = JsonConvert.DeserializeObject <DataTable>(json);
            return(result);
        }
Пример #19
0
        protected override void BuildDataSet()
        {
            this.DataSet = new DataSet();
            DataTable masterTable = new DataTable(masterTableName);

            DataSourceHelper.AddColumn(new DefineField(masterTable, "PROGID", "功能代码", FieldSize.Size50)
            {
                AllowEmpty     = false,
                ControlType    = LibControlType.IdName,
                RelativeSource = new RelativeSourceCollection()
                {
                    new RelativeSource("axp.FuncList")
                    {
                        RelFields = new RelFieldCollection()
                        {
                            new RelField("PROGNAME", LibDataType.NText, FieldSize.Size50, "功能名称")
                        }
                    }
                }
            });
            DataSourceHelper.AddColumn(new DefineField(masterTable, "BUSINESSTASKID", "任务代码", FieldSize.Size50)
            {
                AllowCopy = false, AllowEmpty = false
            });
            DataSourceHelper.AddColumn(new DefineField(masterTable, "BUSINESSTASKNAME", "任务名称", FieldSize.Size50)
            {
                ControlType = LibControlType.NText
            });
            masterTable.PrimaryKey = new DataColumn[] { masterTable.Columns["PROGID"], masterTable.Columns["BUSINESSTASKID"] };
            this.DataSet.Tables.Add(masterTable);
        }
Пример #20
0
    public static IDictionary <string, object> ComposeDropDownFieldDescriptor(string name, string caption, string lookupPrvName, object lookupContext, string textFld, string valFld, IList <IDictionary <string, object> > conditions)
    {
        var fieldDescriptor = new Dictionary <string, object>();

        fieldDescriptor["name"]       = name;
        fieldDescriptor["caption"]    = caption;
        fieldDescriptor["dataType"]   = "string";
        fieldDescriptor["conditions"] = conditions != null
                        ? conditions
                        : new List <IDictionary <string, object> > {
            new Dictionary <string, object> {
                { "text", "=" }, { "value", "=" }
            },
            new Dictionary <string, object> {
                { "text", "<>" }, { "value", "!=" }
            }
        };
        var rendererData = new Dictionary <string, object>();

        rendererData["name"]   = "dropdownlist";
        rendererData["values"] = DataSourceHelper.GetProviderDataSource(lookupPrvName, lookupContext).Cast <object>().Select(r =>
                                                                                                                             new Dictionary <string, object> {
            { "value", DataBinder.Eval(r, valFld) },
            { "text", DataBinder.Eval(r, textFld) }
        }).ToArray();

        fieldDescriptor["renderer"] = rendererData;
        return(fieldDescriptor);
    }
Пример #21
0
        public ReverbCommand(uint bufferOffset, ReverbParameter parameter, Memory <ReverbState> state, bool isEnabled, ulong workBuffer, int nodeId, bool isLongSizePreDelaySupported, bool newEffectChannelMappingSupported)
        {
            Enabled         = true;
            IsEffectEnabled = isEnabled;
            NodeId          = nodeId;
            _parameter      = parameter;
            State           = state;
            WorkBuffer      = workBuffer;

            InputBufferIndices  = new ushort[Constants.VoiceChannelCountMax];
            OutputBufferIndices = new ushort[Constants.VoiceChannelCountMax];

            for (int i = 0; i < Parameter.ChannelCount; i++)
            {
                InputBufferIndices[i]  = (ushort)(bufferOffset + Parameter.Input[i]);
                OutputBufferIndices[i] = (ushort)(bufferOffset + Parameter.Output[i]);
            }

            IsLongSizePreDelaySupported = isLongSizePreDelaySupported;

            // NOTE: We do the opposite as Nintendo here for now to restore previous behaviour
            // TODO: Update reverb processing and remove this to use RemapLegacyChannelEffectMappingToChannelResourceMapping.
            DataSourceHelper.RemapChannelResourceMappingToLegacy(newEffectChannelMappingSupported, InputBufferIndices);
            DataSourceHelper.RemapChannelResourceMappingToLegacy(newEffectChannelMappingSupported, OutputBufferIndices);
        }
        /// <summary>
        /// Execute As Object
        /// </summary>
        /// <typeparam name="T">Given type of object.</typeparam>
        /// <param name="storedProcedureName">Accept Key Value Collection For Parameters</param>
        /// <returns> Type of the object implementing</returns>
        public T ExecuteAsObject <T>(string storedProcedureName)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(ConnectionString))
            {
                NpgsqlCommand command = new NpgsqlCommand();
                command.Connection  = conn;
                command.CommandText = storedProcedureName;
                command.CommandType = CommandType.StoredProcedure;

                conn.Open();
                NpgsqlDataReader reader  = command.ExecuteReader();
                ArrayList        arrColl = DataSourceHelper.FillCollection(reader, typeof(T));
                conn.Close();

                if (reader != null)
                {
                    reader.Close();
                }

                if (arrColl != null && arrColl.Count > 0)
                {
                    return((T)arrColl[0]);
                }
                else
                {
                    return(default(T));
                }
            }
        }
Пример #23
0
        public List <T> ExecuteAsListText <T>(string sqlCommand)
        {
            SqlConnection SQLConn = new SqlConnection(this._connectionString);

            try
            {
                SqlDataReader SQLReader;
                SqlCommand    SQLCmd = new SqlCommand();
                SQLCmd.Connection  = SQLConn;
                SQLCmd.CommandText = sqlCommand;
                SQLCmd.CommandType = CommandType.Text;

                SQLConn.Open();
                SQLReader = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection); //datareader automatically closes the SQL connection
                List <T> mList = new List <T>();
                mList = DataSourceHelper.FillCollection <T>(SQLReader);
                if (SQLReader != null)
                {
                    SQLReader.Close();
                }
                SQLConn.Close();
                return(mList);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                SQLConn.Close();
            }
        }
        public CatalogPricingRuleInfo GetCatalogPricingRule(Int32 catalogPriceRuleID, Int32 storeID, Int32 portalID, string userName, string culture)
        {
            PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider();
            DataSet ds = new DataSet();

            ds = priceRuleSqlProvider.GetCatalogPricingRule(catalogPriceRuleID, storeID, portalID, userName, culture);
            DataTable dtCatalogPricingRule        = ds.Tables[0];
            DataTable dtCatalogPriceRuleCondition = ds.Tables[1];
            DataTable dtCatalogConditionDetails   = ds.Tables[2];
            DataTable dtCatalogPriceRuleRoles     = ds.Tables[3];
            List <CatalogPriceRule> lstCatalogPriceRule;

            lstCatalogPriceRule = DataSourceHelper.FillCollection <CatalogPriceRule>(dtCatalogPricingRule);

            List <CatalogPriceRuleCondition> lstCatalogPriceRuleCondition;

            lstCatalogPriceRuleCondition = DataSourceHelper.FillCollection <CatalogPriceRuleCondition>(dtCatalogPriceRuleCondition);

            List <CatalogPriceRuleRole> lstCatalogPriceRuleRole;

            lstCatalogPriceRuleRole = DataSourceHelper.FillCollection <CatalogPriceRuleRole>(dtCatalogPriceRuleRoles);

            List <CatalogConditionDetail> lstCatalogConditionDetail;

            lstCatalogConditionDetail = DataSourceHelper.FillCollection <CatalogConditionDetail>(dtCatalogConditionDetails);

            CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo();
            CatalogPriceRule       catalogPriceRule       = lstCatalogPriceRule[0];

            catalogPricingRuleInfo.CatalogPriceRule = catalogPriceRule;
            List <CatalogPriceRuleCondition> lstCPRC = new List <CatalogPriceRuleCondition>();

            foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in lstCatalogPriceRuleCondition)
            {
                List <CatalogConditionDetail> lstCCD = new List <CatalogConditionDetail>();
                foreach (CatalogConditionDetail catalogConditionDetail in lstCatalogConditionDetail)
                {
                    if (catalogPriceRuleCondition.CatalogPriceRuleConditionID == catalogConditionDetail.CatalogPriceRuleConditionID)
                    {
                        lstCCD.Add(catalogConditionDetail);
                    }
                }
                catalogPriceRuleCondition.CatalogConditionDetail = lstCCD;
                lstCPRC.Add(catalogPriceRuleCondition);
            }
            catalogPricingRuleInfo.CatalogPriceRuleConditions = lstCPRC;

            List <CatalogPriceRuleRole> lstCPRR = new List <CatalogPriceRuleRole>();

            foreach (CatalogPriceRuleRole catalogPriceRuleRole in lstCatalogPriceRuleRole)
            {
                if (catalogPriceRuleRole.CatalogPriceRuleID == catalogPriceRule.CatalogPriceRuleID)
                {
                    lstCPRR.Add(catalogPriceRuleRole);
                }
            }
            catalogPricingRuleInfo.CatalogPriceRuleRoles = lstCPRR;

            return(catalogPricingRuleInfo);
        }
Пример #25
0
        protected override void BuildDataSet()
        {
            this.DataSet = new DataSet();
            DataTable masterTable = new DataTable(masterTableName);

            DataSourceHelper.AddColumn(new DefineField(masterTable, "EXECTASKDATAID", "执行标识号", FieldSize.Size50));
            DataSourceHelper.AddColumn(new DefineField(masterTable, "CREATETIME", "创建时间")
            {
                DataType = LibDataType.Int64, ControlType = LibControlType.DateTime
            });
            DataSourceHelper.AddColumn(new DefineField(masterTable, "PROGID", "功能代码", FieldSize.Size50)
            {
                AllowEmpty     = false,
                ControlType    = LibControlType.IdName,
                RelativeSource = new RelativeSourceCollection()
                {
                    new RelativeSource("axp.FuncList")
                    {
                        RelFields = new RelFieldCollection()
                        {
                            new RelField("PROGNAME", LibDataType.NText, FieldSize.Size50, "功能名称")
                        }
                    }
                }
            });
            DataSourceHelper.AddColumn(new DefineField(masterTable, "RESULTDATA", "结果数据")
            {
                DataType = LibDataType.Binary, ControlType = LibControlType.NText
            });
            masterTable.PrimaryKey = new DataColumn[] { masterTable.Columns["EXECTASKDATAID"] };
            this.DataSet.Tables.Add(masterTable);
        }
Пример #26
0
        public async Task <IList <AdvanceFilterInfo> > GetAdvanceFilters(int SiteID)
        {
            NL_Provider provider = new NL_Provider();
            DataSet     ds       = await provider.GetAdvanceFilters(SiteID);

            List <AdvanceFilterInfo> finalList = new List <AdvanceFilterInfo>();

            for (int i = 0; i < ds.Tables.Count; i++)
            {
                IList <AdvanceFilterTempInfo> infos = DataSourceHelper.FillCollection <AdvanceFilterTempInfo>(ds.Tables[i]);

                AdvanceFilterInfo info = new AdvanceFilterInfo
                {
                    AppName      = infos[0].AppName,
                    CategoryName = infos[0].CategoryName,
                    InputType    = infos[0].InputType
                };

                List <string> lstKeyword = infos.Select(x => x.KeyWord).Distinct().ToList();
                info.FilterList = lstKeyword;

                finalList.Add(info);
            }
            return(finalList);
        }
Пример #27
0
        public static CatalogPricingRuleInfo GetCatalogPricingRule(Int32 catalogPriceRuleID, AspxCommonInfo aspxCommonObj)
        {
            DataSet ds = new DataSet();

            ds = AspxCatalogPriceRuleProvider.GetCatalogPricingRule(catalogPriceRuleID, aspxCommonObj);
            DataTable dtCatalogPricingRule        = ds.Tables[0];
            DataTable dtCatalogPriceRuleCondition = ds.Tables[1];
            DataTable dtCatalogConditionDetails   = ds.Tables[2];
            DataTable dtCatalogPriceRuleRoles     = ds.Tables[3];
            List <CatalogPriceRule> lstCatalogPriceRule;

            lstCatalogPriceRule = DataSourceHelper.FillCollection <CatalogPriceRule>(dtCatalogPricingRule);

            List <CatalogPriceRuleCondition> lstCatalogPriceRuleCondition;

            lstCatalogPriceRuleCondition = DataSourceHelper.FillCollection <CatalogPriceRuleCondition>(dtCatalogPriceRuleCondition);

            List <CatalogPriceRuleRole> lstCatalogPriceRuleRole;

            lstCatalogPriceRuleRole = DataSourceHelper.FillCollection <CatalogPriceRuleRole>(dtCatalogPriceRuleRoles);

            List <CatalogConditionDetail> lstCatalogConditionDetail;

            lstCatalogConditionDetail = DataSourceHelper.FillCollection <CatalogConditionDetail>(dtCatalogConditionDetails);

            CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo();
            CatalogPriceRule       catalogPriceRule       = lstCatalogPriceRule[0];

            catalogPricingRuleInfo.CatalogPriceRule = catalogPriceRule;
            List <CatalogPriceRuleCondition> lstCPRC = new List <CatalogPriceRuleCondition>();

            foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in lstCatalogPriceRuleCondition)
            {
                List <CatalogConditionDetail> lstCCD = new List <CatalogConditionDetail>();
                foreach (CatalogConditionDetail catalogConditionDetail in lstCatalogConditionDetail)
                {
                    if (catalogPriceRuleCondition.CatalogPriceRuleConditionID == catalogConditionDetail.CatalogPriceRuleConditionID)
                    {
                        lstCCD.Add(catalogConditionDetail);
                    }
                }
                catalogPriceRuleCondition.CatalogConditionDetail = lstCCD;
                lstCPRC.Add(catalogPriceRuleCondition);
            }
            catalogPricingRuleInfo.CatalogPriceRuleConditions = lstCPRC;

            List <CatalogPriceRuleRole> lstCPRR = new List <CatalogPriceRuleRole>();

            foreach (CatalogPriceRuleRole catalogPriceRuleRole in lstCatalogPriceRuleRole)
            {
                if (catalogPriceRuleRole.CatalogPriceRuleID == catalogPriceRule.CatalogPriceRuleID)
                {
                    lstCPRR.Add(catalogPriceRuleRole);
                }
            }
            catalogPricingRuleInfo.CatalogPriceRuleRoles = lstCPRR;

            return(catalogPricingRuleInfo);
        }
        protected override object SaveViewState()
        {
            Pair p = new Pair();

            p.First  = base.SaveViewState();
            p.Second = DataSourceHelper.SaveViewState(_parameters);
            return(p);
        }
Пример #29
0
        public ActionResult Index()
        {
            GetButtonPermissions();
            var enabledItems = DataSourceHelper.GetIsTrue();

            ViewBag.EnableItems = enabledItems;
            return(PartialView());
        }
Пример #30
0
 public void Dispose()
 {
     if (this._dataSourceHelper != null)
     {
         this._dataSourceHelper = null;
         GC.Collect();
     }
 }