public RarTurnoverData() { Subdevision = new RarSubdevision(); Manufacturer = new RarCompany(); Buyer = new RarCompany(); License = new RarLicense(); }
private void SetupTurnoverData(XElement turnoverdata, RarFormF6 formF6) { RarSubdevision subdevision = new RarSubdevision(); subdevision.Name = (string)turnoverdata.Attribute("Наим"); subdevision.KPP = (string)turnoverdata.Attribute("КППЮЛ"); //subdevision.SalePresented = (bool)turnoverdata.Attribute("НаличиеПоставки"); //subdevision.ReturnPresented = (bool)turnoverdata.Attribute("НаличиеВозврата"); subdevision.Adress = SetupAdress(turnoverdata.Element("АдрОрг")); formF6.OurCompany.SubdevisionList.Add(subdevision); foreach (XNode nodeAlcoCode in turnoverdata.Elements("Оборот")) { XElement elAlcoCode = (XElement)nodeAlcoCode; foreach (XNode nodeManufacturer in elAlcoCode.Elements("СведПроизвИмпорт")) { XElement elManufacturer = (XElement)nodeManufacturer; string manufacturID = (string)elManufacturer.Attribute("ИдПроизвИмп"); RarCompany manufacturer = formF6.ManufacturerList.Where(p => p.ID == manufacturID).First(); foreach (XNode nodeBuyer in elManufacturer.Elements("Получатель")) { XElement elBuyer = (XElement)nodeBuyer; string buyerID = (string)elBuyer.Attribute("ИдПолучателя"); RarCompany buyer = formF6.BuyerList.Where(p => p.ID == buyerID).First(); buyer.IsUsed = true; string licenseID = (string)elBuyer.Attribute("ИдЛицензии"); RarLicense license = buyer.LicenseList.Where(s => s.ID == licenseID).FirstOrDefault(); foreach (XNode nodeDocument in elBuyer.Elements("Поставка")) { XElement elDocument = (XElement)nodeDocument; RarTurnoverData data = new RarTurnoverData(); data.Subdevision = subdevision; data.AlcoCode = (string)elAlcoCode.Attribute("П000000000003"); data.Manufacturer = manufacturer; data.Buyer = buyer; data.License = license; //data.NotificationDate= DateTime.Parse(el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000015").Value); //data.NotificationNumber = (string)el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000016"); //data.NotificationTurnover = (double)el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000017"); data.DocumentDate = DateTime.Parse(elDocument.Attribute("П000000000018").Value); data.DocumentNumber = (string)elDocument.Attribute("П000000000019"); //data.CustomsDeclarationNumber = (string)el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000020"); data.Turnover = (double)elDocument.Attribute("П000000000021"); formF6.TurnoverDataList.Add(data); } } } } }
public RarSubdevision(RarSubdevision subdevision) { Name = subdevision.Name; KPP = subdevision.KPP; Adress = subdevision.Adress; }