本文整理汇总了C#中ObjectList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectList.Add方法的具体用法?C# ObjectList.Add怎么用?C# ObjectList.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectList
的用法示例。
在下文中一共展示了ObjectList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSelectAccountServices
public ObjectList<AccountService> GetSelectAccountServices()
{
ObjectList<AccountService> list = new ObjectList<AccountService>();
foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvAccountServices.Rows)
{
if ((row.Cells.get_Item(0).get_Value() != null) && ((bool) row.Cells.get_Item(0).get_Value()))
{
list.Add((AccountService) row.get_DataBoundItem());
}
}
return list;
}
示例2: GetDataFor
/// <summary>
/// Return an IEnumerable providing data for use with the
/// supplied parameter.
/// </summary>
/// <param name="parameter">A ParameterInfo representing one
/// argument to a parameterized test</param>
/// <returns>
/// An IEnumerable providing the required data
/// </returns>
public IEnumerable GetDataFor(ParameterInfo parameter)
{
ObjectList data = new ObjectList();
foreach (Attribute attr in parameter.GetCustomAttributes(typeof(DataAttribute), false))
{
IParameterDataSource source = attr as IParameterDataSource;
if (source != null)
foreach (object item in source.GetData(parameter))
data.Add(item);
}
return data;
}
示例3: doMatch
/// <summary>
/// Check that all items are unique.
/// </summary>
/// <param name="actual"></param>
/// <returns></returns>
protected override bool doMatch(IEnumerable actual)
{
ObjectList list = new ObjectList();
foreach (object o1 in actual)
{
foreach (object o2 in list)
if (ItemsEqual(o1, o2))
return false;
list.Add(o1);
}
return true;
}
示例4: Property
/// <summary>
/// Produces a collection containing all the values of a property
/// </summary>
/// <param name="name">The collection of property values</param>
/// <returns></returns>
public ICollection Property( string name )
{
ObjectList propList = new ObjectList();
foreach( object item in original )
{
PropertyInfo property = item.GetType().GetProperty( name,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
if ( property == null )
throw new ArgumentException( string.Format(
"{0} does not have a {1} property", item, name ) );
propList.Add( property.GetValue( item, null ) );
}
return propList;
}
示例5: GetSelectedAreas
public ObjectList<Area> GetSelectedAreas()
{
ObjectList<Area> list = new ObjectList<Area>();
foreach (System.Windows.Forms.TreeNode node in base.SelectedNodes)
{
if (node.Parent == null)
{
list.AddRange(((AreaGroup) node.get_Tag()).GetAreas());
}
else
{
list.Add((Area) node.get_Tag());
}
}
return list;
}
示例6: btnAddShedule_Click
private void btnAddShedule_Click(object sender, System.EventArgs e)
{
bool flag = false;
ObjectList<UjfApartmentHouseDefect> list = new ObjectList<UjfApartmentHouseDefect>();
foreach (System.Windows.Forms.DataGridViewRow row in this.dgvDefects.SelectedRows)
{
list.Add((UjfApartmentHouseDefect) row.get_DataBoundItem());
}
if ((list != null) && (list.get_Count() > 0))
{
foreach (UjfApartmentHouseDefect defect in list)
{
UjfApartmentHouseDefectShedule shedule = new UjfApartmentHouseDefectShedule {
ApartmentHouseDefectId = defect.Id,
InspectionId = this.m_inspectionId,
SheduleYear = (int) this.nudSheduleYear.Value
};
if (Mappers.UjfApartmentHouseDefectSheduleMapper.FindByApartmentHouseDefectIdAndSheduleYear(shedule.ApartmentHouseDefectId, shedule.SheduleYear, shedule.Id).get_Count() > 0)
{
flag = true;
}
else
{
shedule.SaveChanges();
}
}
}
else
{
System.Windows.Forms.MessageBox.Show("Для составления плана-графика добавьте хотя бы один дефект к текущему осмотру!");
}
if (flag)
{
System.Windows.Forms.MessageBox.Show("Некоторые планы-графики не были добавлены, так как уже присутствуют в списке!");
}
base.Close();
}
示例7: GetByStatus
public static ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress> GetByStatus(ExchangeStatus status, Area filterArea)
{
System.Collections.Generic.List<long> addresses = new System.Collections.Generic.List<long>();
ObjectList<ExchangeRequest> exchangeRequestsGroup = ExchangeRequest.GetExchangeRequestsGroup(ExchangeRequestType.Address, status);
ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress> list3 = new ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>();
foreach (ExchangeRequest request in exchangeRequestsGroup)
{
AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress address = Serializer.FromXml<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>(request.XmlIn);
address.DateIn = request.DateIn;
address.ExchangeRequestId = request.Id;
address.LocalAddressId = request.AddressId;
if (address.LocalAddressId != LocalAddress.Null.Id)
{
addresses.Add(address.LocalAddressId);
}
address.Address = string.Concat((string[]) new string[] { ((address.LastChangeDate != Constants.NullDate) ? ((string) address.LastChangeDate.ToShortDateString()) : ((string) address.DateIn.ToShortDateString())), ";", address.StreetSocr, " ", address.Street, ";", address.HouseSocr, " ", address.House, ";", address.FlatSocr, " ", address.Flat });
list3.Add(address);
}
ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress> list4 = new ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>();
if ((filterArea == null) || (filterArea == Area.Null))
{
return list3.ApplySort("Address");
}
Area lhs = new Area {
StatusTemporary = 1
};
lhs.SaveChanges();
lhs.SaveAddresses(addresses);
System.Collections.Generic.IList<long> filteredApartmentLocalAddresses = Area.GetFilteredApartmentLocalAddresses(lhs, filterArea);
for (int i = 0; i < list3.get_Count(); i = (int) (i + 1))
{
long num2 = (list3.get_Item(i).RemoteAddressId == 0L) ? list3.get_Item(i).LocalAddressId : list3.get_Item(i).RemoteAddressId;
if (filteredApartmentLocalAddresses.Contains(num2))
{
list4.Add(list3.get_Item(i));
}
}
return list4.ApplySort("Address");
}
示例8: AddIntervalPeriods
public static ObjectList<CalcPeriod> AddIntervalPeriods(System.DateTime fromDate, System.DateTime toDate)
{
ObjectList<CalcPeriod> list = new ObjectList<CalcPeriod>();
for (System.DateTime time = fromDate; time <= toDate; time = time.AddMonths(1))
{
CalcPeriod period = new CalcPeriod {
FromDate = time
};
try
{
period.SaveChanges();
}
catch (System.Exception)
{
continue;
}
list.Add(period);
}
return list;
}
示例9: Main
static void Main(string[] args)
{
Console.WriteLine ("Constructing example data ...");
Foo foo1 = new Foo ();
foo1.bar = "foobar";
foo1.answer = "42";
Foo foo2 = new Foo ();
foo2.bar = "barfoo";
foo2.answer = "none";
ListItem listItem = new ListItem ();
listItem.foo1 = foo1;
listItem.foo2 = foo2;
ObjectList objectList = new ObjectList ();
objectList.Add ("item1", listItem);
objectList.Add ("item2", listItem);
String realJson = "{ \"item1\":{\"foo1\":{\"bar\":\"foobar\",\"answer\":\"42\"},\"foo2\":{\"bar\":\"barfoo\",\"answer\":\"none\"}},";
realJson = realJson + "\"item2\":{\"foo1\":{\"bar\":\"foobar\",\"answer\":\"42\"},\"foo2\":{\"bar\":\"barfoo\",\"answer\":\"none\"}} }";
Console.WriteLine ("Serializing data ...");
Console.WriteLine (String.Format("Expected JSON: `{0}`", realJson));
JsonSerializer serializer = new JsonSerializer ();
String json1 = serializer.Serialize (objectList);
Console.WriteLine (String.Format ("RestSharp JSON: `{0}`", json1));
Console.WriteLine ("Deserializing data ...");
// Does not work.
try {
Console.WriteLine("Attempting to deserialize RestSharp JSON ...");
JsonDeserializer deserializer = new JsonDeserializer();
RestResponse response = new RestResponse();
response.Content = json1;
var decoded = deserializer.Deserialize<ObjectList>(response);
Console.WriteLine("Success ...");
} catch (Exception ex) {
Console.WriteLine ("Deserialization failed:");
Console.WriteLine (ex.Message);
Console.WriteLine (ex.StackTrace);
}
// Does not work.
try {
Console.WriteLine("Attempting to deserialize expected JSON with RestSharp ...");
JsonDeserializer deserializer = new JsonDeserializer();
RestResponse response = new RestResponse();
response.Content = realJson;
var decoded = deserializer.Deserialize<ObjectList>(response);
Console.WriteLine("Success ...");
} catch (Exception ex) {
Console.WriteLine ("Deserialization failed:");
Console.WriteLine (ex.Message);
Console.WriteLine (ex.StackTrace);
}
// Does not work.
try {
Console.WriteLine("Attempting to deserialize RestSharp JSON with JSON.NET ...");
ObjectList list = Newtonsoft.Json.JsonConvert.DeserializeObject<ObjectList>(json1);
Console.WriteLine("Success ...");
} catch (Exception ex) {
Console.WriteLine ("Deserialization failed:");
Console.WriteLine (ex.Message);
Console.WriteLine (ex.StackTrace);
}
// Works.
try {
Console.WriteLine("Attempting to deserialize expected JSON with JSON.NET ...");
ObjectList list = Newtonsoft.Json.JsonConvert.DeserializeObject<ObjectList>(realJson);
Console.WriteLine("Success ...");
} catch (Exception ex) {
Console.WriteLine ("Deserialization failed:");
Console.WriteLine (ex.Message);
Console.WriteLine (ex.StackTrace);
}
}
示例10: GetSelectedAccounts
private ObjectList<Account> GetSelectedAccounts()
{
ObjectList<Account> list = new ObjectList<Account>();
this.dgvDebtors.EndEdit();
foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvDebtors.Rows)
{
if ((row.Cells.get_Item("selected").get_Value() != null) && ((bool) row.Cells.get_Item("selected").get_Value()))
{
Account @null = Account.Null;
try
{
@null = Account.FindById((long) ((long) row.Cells.get_Item("accountId").get_Value()));
}
catch (System.Exception exception)
{
if (exception.GetType() == typeof(ObjectNotFoundException))
{
continue;
}
}
list.Add(@null);
}
}
return list;
}
示例11: DebtActionsAddChangeForm_Load
private void DebtActionsAddChangeForm_Load(object sender, System.EventArgs e)
{
this.set_Font(Manager.WindowFont);
this.m_DebtAction.BeginEdit();
this.sfdStatus.Faset = FasetsEnum.ActStatuses;
this.sfdStatus.RefreshValues();
ObjectList<DebtActionStatus> list = new ObjectList<DebtActionStatus>();
list = ObjectWithId.FindAll<DebtActionStatus>();
list.Add(DebtActionStatus.DebtActionStatusIsNull());
this.sfdStatusType.set_DataSource(list);
this.bsDebtAction.set_DataSource(this.m_DebtAction);
if (this.m_DebtAction.IsNew)
{
this.set_Text("Добавление иска");
this.btnOk.set_Text("Добавить");
this.bsDebtDocuments.set_DataSource(DebtDocument.GetDocumentNoAction(this.m_DebtAction.DebtAffairId));
}
else
{
this.set_Text("Изменение иска");
this.btnOk.set_Text("Изменить");
this.bsDebtDocuments.set_DataSource(ObjectWithId.FindById<DebtDocument>(this.m_DebtAction.DebtDocumentId));
this.bsDebtAccounts.set_DataSource(DebtAccount.FindByDebtDocumentId(this.m_DebtAction.DebtDocumentId));
this.dgvDebtAccounts.set_Enabled(false);
if (this.m_DebtAction.FromDate == System.DateTime.MinValue)
{
this.dpDebtActiop.DateBeginClear();
}
else
{
this.dpDebtActiop.DateBegin = this.m_DebtAction.FromDate;
}
if (this.m_DebtAction.ToDate == System.DateTime.MinValue)
{
this.dpDebtActiop.DateEndClear();
}
else
{
this.dpDebtActiop.DateEnd = this.m_DebtAction.ToDate;
}
if (this.m_DebtAction.StatusTypeId != 0)
{
DebtActionStatus status = ObjectWithId.FindById<DebtActionStatus>((long) this.m_DebtAction.StatusTypeId);
this.sfdStatusType.set_SelectedItem(this.sfdStatusType.Items.get_Item(this.sfdStatusType.FindString(status.Name)));
}
this.sfdStatus.SetSelectedFasetItem(this.m_DebtAction.StatusId);
this.tbNameAction.set_Text(this.m_DebtAction.NameAction);
}
}
示例12: GetFixtures
private IList GetFixtures(Assembly assembly, IList names)
{
ObjectList fixtures = new ObjectList();
IList testTypes = GetCandidateFixtureTypes(assembly, names);
foreach (Type testType in testTypes)
{
if (TestFixtureBuilder.CanBuildFrom(testType))
fixtures.Add(TestFixtureBuilder.BuildFrom(testType));
}
return fixtures;
}
示例13: btChangeDate_Click
private void btChangeDate_Click(object sender, System.EventArgs e)
{
bool flag = this.cbSaveDuplicateIndications.get_Checked();
if ((this.bsApartmentCounterIndicationInputView.get_DataSource() != null) && (this.bsApartmentCounterIndicationInputView.get_Count() != 0))
{
ObjectList<ApartmentCounterIndicationInputView> list = (ObjectList<ApartmentCounterIndicationInputView>) this.bsApartmentCounterIndicationInputView.get_DataSource();
ObjectList<ApartmentCounterIndicationInputView> list2 = new ObjectList<ApartmentCounterIndicationInputView>();
foreach (ApartmentCounterIndicationInputView view in list)
{
if (((view.Val != view.NewVal) || flag) || view.IsSaveDuplicateIndication)
{
view.NewValDate = this.dtpDateIndications.Value;
}
list2.Add(view);
}
this.bsApartmentCounterIndicationInputView.set_DataSource(list2);
}
}
示例14: OrgDocumentsCacheRefresh
public static void OrgDocumentsCacheRefresh()
{
ObjectList<OrgDocument> list = new ObjectList<OrgDocument>();
foreach (OrgDocument document in orgDocumentsCache)
{
try
{
OrgDocument document2 = Mappers.OrgDocumentMapper.FindById(document.Id);
if (document2 != null)
{
list.Add(document2);
}
}
catch (ObjectNotFoundException)
{
}
}
orgDocumentsCache = list;
}
示例15: BankAccountCacheRefresh
public static void BankAccountCacheRefresh()
{
ObjectList<BankAccount> list = new ObjectList<BankAccount>();
foreach (BankAccount account in bankAccountCache)
{
try
{
BankAccount account2 = Mappers.BankAccountMapper.FindById(account.Id);
if (account2 != null)
{
list.Add(account2);
}
}
catch (ObjectNotFoundException)
{
}
}
bankAccountCache = list;
}