当前位置: 首页>>代码示例>>C#>>正文


C# IDataSource.GetView方法代码示例

本文整理汇总了C#中IDataSource.GetView方法的典型用法代码示例。如果您正苦于以下问题:C# IDataSource.GetView方法的具体用法?C# IDataSource.GetView怎么用?C# IDataSource.GetView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataSource的用法示例。


在下文中一共展示了IDataSource.GetView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeInsertes

        private void MakeInsertes(IDataSource ds, JArray data)
        {
            string id = this.ModelInstance.GetIDProperty();

            foreach (JToken token in data)
            {
                this.record = token;
                var jObject = (JObject)token;
                values = new SortedList(this.ModelInstance.Fields.Count);
                keys = new SortedList();
                oldValues = new SortedList();

                foreach (ModelField field in this.ModelInstance.Fields)
                {
                    var jProperty = jObject.Property(field.Mapping.IsNotEmpty() ? field.Mapping : field.Name) ?? jObject.Property(field.Name);
                    values[field.Name] = jProperty != null && jProperty.Value.Type != JTokenType.Null && jProperty.Value.Type != JTokenType.Undefined ? (jProperty.Value.Type == JTokenType.String ? (string)jProperty.Value : this.ChopQuotes(jProperty.Value.ToString(Newtonsoft.Json.Formatting.None))) : null;
                }

                BeforeRecordInsertedEventArgs eBeforeRecordInserted = new BeforeRecordInsertedEventArgs(record, keys, values);
                this.OnBeforeRecordInserted(eBeforeRecordInserted);

                if (eBeforeRecordInserted.CancelAll)
                {
                    break;
                }

                if (eBeforeRecordInserted.Cancel)
                {
                    continue;
                }

                if (ds != null)
                {
                    ds.GetView("").Insert(values, InsertCallback);
                }
                else
                {
                    this.InsertCallback(0, null);
                }
            }
        }
开发者ID:emayk,项目名称:Ext.NET.Pro,代码行数:41,代码来源:Store.cs

示例2: MakeDeletes

        private void MakeDeletes(IDataSource ds, JArray data)
        {
            string id = this.ModelInstance.GetIDProperty();

            foreach (JToken token in data)
            {
                this.record = token;
                values = new SortedList(0);
                keys = new SortedList();
                oldValues = new SortedList(0);

                if (id.IsNotEmpty())
                {
                    string idStr = token.Value<string>(id);

                    int idInt;

                    if (int.TryParse(idStr, out idInt))
                    {
                        keys[id] = idInt;
                    }
                    else
                    {
                        keys[id] = idStr;
                    }
                }

                BeforeRecordDeletedEventArgs eBeforeRecordDeleted = new BeforeRecordDeletedEventArgs(record, keys);
                this.OnBeforeRecordDeleted(eBeforeRecordDeleted);

                if (eBeforeRecordDeleted.CancelAll)
                {
                    break;
                }

                if (eBeforeRecordDeleted.Cancel)
                {
                    continue;
                }

                if (ds != null)
                {
                    ds.GetView("").Delete(keys, oldValues, DeleteCallback);
                }
                else
                {
                    this.DeleteCallback(0, null);
                }
            }
        }
开发者ID:emayk,项目名称:Ext.NET.Pro,代码行数:50,代码来源:Store.cs

示例3: ConnectToDataSource

		void ConnectToDataSource ()
		{
			/* verify that the data source exists and is an IDataSource */
			object ctrl = null;
			if (Parent != null)
				ctrl = Parent.FindControl (DataSourceID);

			if (ctrl == null || !(ctrl is IDataSource)) {
				string format;

				if (ctrl == null)
				  	format = "DataSourceID of '{0}' must be the ID of a control of type IDataSource.  A control with ID '{1}' could not be found.";
				else
				  	format = "DataSourceID of '{0}' must be the ID of a control of type IDataSource.  '{1}' is not an IDataSource.";

				throw new HttpException (String.Format (format, ID, DataSourceID));
			}

			boundDataSource = (IDataSource)ctrl;
			boundDataSource.GetView (String.Empty).DataSourceViewChanged += new EventHandler(OnDataSourceViewChanged);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:21,代码来源:Repeater.cs

示例4: MakeUpdates

        private void MakeUpdates(IDataSource ds, XmlDocument xml)
        {
            XmlNodeList updatingRecords = xml.SelectNodes("records/Updated/record");
            
            string id = GetIdColumnName();

            foreach (XmlNode node in updatingRecords)
            {
                record = node;
                values = new SortedList(this.Reader.Reader.Fields.Count);
                keys = new SortedList();
                oldValues = new SortedList();

                foreach (RecordField field in this.Reader.Reader.Fields)
                {
                    XmlNode keyNode = node.SelectSingleNode(field.Name);
                    values[field.Name] = keyNode != null ? keyNode.InnerText : null;
                }

                confirmation = null;

                if (id.IsNotEmpty())
                {
                    XmlNode keyNode = node.SelectSingleNode(id);
                    string idStr = keyNode != null ? keyNode.InnerText : null;
                    
                    int idInt;

                    if (int.TryParse(idStr, out idInt))
                    {
                        keys[id] = idInt;
                    }
                    else
                    {
                        keys[id] = idStr;
                    }
                    
                    if (this.UseIdConfirmation && keys[id] != null)
                    {
                        confirmation = changingEventArgs.ConfirmationList[keys[id].ToString()];
                    }
                }

                BeforeRecordUpdatedEventArgs eBeforeRecordUpdated = new BeforeRecordUpdatedEventArgs(record, keys, values, oldValues, confirmation);
                this.OnBeforeRecordUpdated(eBeforeRecordUpdated);

                if (eBeforeRecordUpdated.CancelAll)
                {
                    break;
                }

                if (eBeforeRecordUpdated.Cancel)
                {
                    continue;
                }

                if (ds !=null)
                {
                    ds.GetView("").Update(keys, values, oldValues, this.UpdateCallback);
                }
                else
                {
                    this.UpdateCallback(0, null);
                }
                
            }
        }
开发者ID:pgodwin,项目名称:Ext.net,代码行数:67,代码来源:Store.cs

示例5: MakeInsertes

        private void MakeInsertes(IDataSource ds, XmlDocument xml)
        {
            XmlNodeList insertingRecords = xml.SelectNodes("records/Created/record");
            string id = GetIdColumnName();

            foreach (XmlNode node in insertingRecords)
            {
                record = node;
                values = new SortedList(this.Reader.Reader.Fields.Count);
                keys = new SortedList();
                oldValues = new SortedList();

                foreach (RecordField field in this.Reader.Reader.Fields)
                {
                    XmlNode keyNode = node.SelectSingleNode(field.Name);
                    values[field.Name] = keyNode != null ? keyNode.InnerText : null;
                }

                confirmation = null;

                if (id.IsNotEmpty())
                {
                    XmlNode keyNode = node.SelectSingleNode(id);
                    
                    if (this.UseIdConfirmation && keyNode != null && keyNode.InnerText.IsNotEmpty())
                    {
                        confirmation = changingEventArgs.ConfirmationList[keyNode.InnerText];
                    }
                }

                BeforeRecordInsertedEventArgs eBeforeRecordInserted = new BeforeRecordInsertedEventArgs(record, keys, values, confirmation);
                this.OnBeforeRecordInserted(eBeforeRecordInserted);

                if (eBeforeRecordInserted.CancelAll)
                {
                    break;
                }

                if (eBeforeRecordInserted.Cancel)
                {
                    continue;
                }
                
                if (ds != null)
                {
                    ds.GetView("").Insert(values, InsertCallback);
                }
                else
                {
                    this.InsertCallback(0, null);
                }
            }

            if (insertingRecords.Count > 0)
            {
                needRetrieve = true;
            }
        }
开发者ID:pgodwin,项目名称:Ext.net,代码行数:58,代码来源:Store.cs

示例6: MakeInsertes

        private void MakeInsertes(IDataSource ds, JArray data)
        {
            string id = this.ModelInstance.GetIDProperty();

            foreach (JToken token in data)
            {
                this.record = token;
                values = new SortedList(this.ModelInstance.Fields.Count);
                keys = new SortedList();
                oldValues = new SortedList();

                foreach (ModelField field in this.ModelInstance.Fields)
                {
                    values[field.Name] = token.Value<string>(field.Mapping.IsNotEmpty() ? field.Mapping : field.Name) ?? token.Value<string>(field.Name);
                }
                
                BeforeRecordInsertedEventArgs eBeforeRecordInserted = new BeforeRecordInsertedEventArgs(record, keys, values);
                this.OnBeforeRecordInserted(eBeforeRecordInserted);

                if (eBeforeRecordInserted.CancelAll)
                {
                    break;
                }

                if (eBeforeRecordInserted.Cancel)
                {
                    continue;
                }
                
                if (ds != null)
                {
                    ds.GetView("").Insert(values, InsertCallback);
                }
                else
                {
                    this.InsertCallback(0, null);
                }
            }
        }
开发者ID:hpj1106,项目名称:Ext.NET.Community,代码行数:39,代码来源:Store.cs


注:本文中的IDataSource.GetView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。