private void bckWrkrProcessSpliting_DoWork(object sender, DoWorkEventArgs e) { int num3; int num4; ObjectList<Apartment> list = new ObjectList<Apartment>(); foreach (Apartment apartment in this.bsNewApartments) { list.Add(apartment); } ObjectList<Account> list2 = new ObjectList<Account>(); foreach (Account account in this.bsNewAccounts) { list2.Add(account); } int num = System.Convert.ToInt32(this.numApartmentCount.Value); decimal[] numArray = new decimal[num]; System.Collections.Generic.Dictionary<Apartment, ApartmentArea> dictionary = new System.Collections.Generic.Dictionary<Apartment, ApartmentArea>(num); string[] strArray = new string[num]; int index = 0; foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvAccounts.Rows) { numArray[index] = System.Convert.ToDecimal(row.Cells.get_Item("clmnShare").get_Value()); ApartmentArea area = new ApartmentArea { Total = System.Convert.ToDecimal(row.Cells.get_Item("clmnTotalSquare").get_Value()), Living = System.Convert.ToDecimal(row.Cells.get_Item("clmnLivingSquare").get_Value()), Heating = System.Convert.ToDecimal(row.Cells.get_Item("clmnHeatingSquare").get_Value()), Balcony = System.Convert.ToDecimal(row.Cells.get_Item("clmnBalconySquare").get_Value()) }; dictionary.Add(list.get_Item(index), area); strArray[index] = (row.Cells.get_Item("clmnFlatName").get_Value() == null) ? string.Empty : row.Cells.get_Item("clmnFlatName").get_Value().ToString(); index = (int) (index + 1); } System.Collections.Generic.List<ObjectList<ApartmentResident>> list3 = new System.Collections.Generic.List<ObjectList<ApartmentResident>>(num); for (index = 0; index < num; index = (int) (index + 1)) { list3.Add(new ObjectList<ApartmentResident>()); } foreach (System.Windows.Forms.DataGridViewRow row2 in (System.Collections.IEnumerable) this.dgvNewApartmentResidents.Rows) { if (int.TryParse(row2.Cells.get_Item("clmnNumberAprtment").get_Value().ToString(), ref num3)) { list3.get_Item((int) (num3 - 1)).Add(this.bsNewApartmentResidents.get_Item(this.dgvNewApartmentResidents.Rows.IndexOf(row2)) as ApartmentResident); } } System.Collections.Generic.List<ObjectList<ApartmentEquipment>> list4 = new System.Collections.Generic.List<ObjectList<ApartmentEquipment>>(num); for (index = 0; index < num; index = (int) (index + 1)) { list4.Add(new ObjectList<ApartmentEquipment>()); } foreach (System.Windows.Forms.DataGridViewRow row3 in (System.Collections.IEnumerable) this.dgvNewApartmentEquipment.Rows) { if (int.TryParse(row3.Cells.get_Item("clmnApartmentNumberEq").get_Value().ToString(), ref num3)) { list4.get_Item((int) (num3 - 1)).Add(this.bsNewApartmentEquipment.get_Item(this.dgvNewApartmentEquipment.Rows.IndexOf(row3)) as ApartmentEquipment); } else if (row3.Cells.get_Item("clmnApartmentNumberEq").get_Value().ToString() == "На все") { foreach (ObjectList<ApartmentEquipment> list5 in list4) { list5.Add((this.bsNewApartmentEquipment.get_Item(this.dgvNewApartmentEquipment.Rows.IndexOf(row3)) as ApartmentEquipment).Clone<ApartmentEquipment>()); } } } if ((this.cbCashlessAccounts.get_Enabled() && (this.cbCashlessAccounts.get_SelectedItem() != null)) && int.TryParse(this.cbCashlessAccounts.get_SelectedItem().ToString(), ref num4)) { num4 = (int) (num4 - 1); } else { num4 = -1; } try { object[] objArray = new object[] { this.m_OldAccount, this.dtpSplitDate.Value, list, list2, this.m_NewApartmentOwners, list3, list4, numArray, dictionary, strArray, (int) num4, this._apartmentOwnerLinks, this._apartmentResidentLinks, this._equipmentLinks, this.m_AccountHouseHolders }; base.Invoke(this.SplitApartment, objArray); e.set_Result(null); } catch (System.Exception exception) { e.set_Result(exception); } }
private static long[] ProcessDataPassporter(AIS.SN.Model.localhost.ExchangeRequestAddress[] addresses) { System.Collections.Generic.List<long> list = new System.Collections.Generic.List<long>(); AIS.SN.Model.localhost.ExchangeRequestAddress[] addressArray = addresses; for (int i = 0; i < addressArray.Length; i = (int) (i + 1)) { AIS.SN.Model.localhost.ExchangeRequestAddress address = addressArray[i]; long[] outs = address.Outs; for (int k = 0; k < outs.Length; k = (int) (k + 1)) { long num = outs[k]; list.Add(num); } AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress snAddress = GetAddresses(address); if (!IsRejected(snAddress)) { string str = Serializer.ToXml<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>(snAddress, (System.Text.Encoding) System.Text.Encoding.Unicode); new ExchangeRequest { QueryId = "", Type = -1, XmlIn = str, Status = ExchangeStatus.Received, DateIn = System.DateTime.Now, OperationDate = snAddress.LastChangeDate, OutId = snAddress.FlatCardId }.SaveChanges(); } } long[] numArray = new long[list.get_Count()]; for (int j = 0; j < list.get_Count(); j = (int) (j + 1)) { numArray[j] = list.get_Item(j); } return numArray; }
public void RemoveNodesByLocalAddress(ObjectList<LocalAddress> addressesSource, ObjectList<LocalAddress> la) { System.Collections.Generic.List<LocalAddress> list = new System.Collections.Generic.List<LocalAddress>(); foreach (LocalAddress address in la) { LocalAddress address2 = address; while (true) { LocalAddress parent = address2.GetParent(); if (parent == LocalAddress.Null) { break; } list.Add(parent); address2 = parent; } if (list.get_Count() == 0) { this.Load(addressesSource, false); return; } for (int i = (int) (list.get_Count() - 1); i >= 0; i = (int) (i - 1)) { this.GetNodeByAddress(list.get_Item(i)).OnBeforeExpand(); } AddressesNode nodeByAddress = this.GetNodeByAddress(address); if (nodeByAddress != null) { this.RemoveNode(nodeByAddress); } list.Clear(); } if (this.OnChangeSelectAddresses != null) { this.OnChangeSelectAddresses(); } }