public RarTurnoverData() { Subdevision = new RarSubdevision(); Manufacturer = new RarCompany(); Buyer = new RarCompany(); License = new RarLicense(); }
private static 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.ManufacturersList.Where(p => p.ID == manufacturID).First(); foreach (XNode nodeBuyer in elManufacturer.Elements("Получатель")) { XElement elBuyer = (XElement)nodeBuyer; string buyerID = (string)elBuyer.Attribute("ИдПолучателя"); RarCompany buyer = formF6.BuyersList.Where(p => p.ID == buyerID).First(); buyer.IsUsed = true; string licenseID = (string)elBuyer.Attribute("ИдЛицензии"); RarLicense license = buyer.LicensesList.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); } } } } }
private static void SetupOrganization(XElement organization, RarOurCompany OurCompany) { OurCompany.Director.Name = (string)organization.Element("ОтветЛицо").Element("Руководитель").Element("Фамилия"); OurCompany.Director.Surname = (string)organization.Element("ОтветЛицо").Element("Руководитель").Element("Имя"); OurCompany.Director.Middlename = (string)organization.Element("ОтветЛицо").Element("Руководитель").Element("Отчество"); OurCompany.Accountant.Name = (string)organization.Element("ОтветЛицо").Element("Главбух").Element("Фамилия"); OurCompany.Accountant.Surname = (string)organization.Element("ОтветЛицо").Element("Главбух").Element("Имя"); OurCompany.Accountant.Middlename = (string)organization.Element("ОтветЛицо").Element("Главбух").Element("Отчество"); OurCompany.Name = (string)organization.Element("Реквизиты").Attribute("Наим"); OurCompany.Phone = (string)organization.Element("Реквизиты").Attribute("ТелОрг"); OurCompany.Email = (string)organization.Element("Реквизиты").Attribute("EmailОтпр"); OurCompany.Adress = SetupAdress(organization.Element("Реквизиты").Element("АдрОрг")); XElement company = organization.Element("Реквизиты").Element("ЮЛ"); if (company != null) { OurCompany.INN = (string)company.Attribute("ИННЮЛ"); // GetIntAttribute(company, "ИННЮЛ"); OurCompany.KPP = (string)company.Attribute("КППЮЛ"); //GetIntAttribute(company, "КППЮЛ"); } else { XElement individual = organization.Element("Реквизиты").Element("ФЛ"); if (individual != null) { OurCompany.INN = (string)individual.Attribute("ИННФЛ"); //GetIntAttribute(individual,"ИННФЛ"); } } XElement lactivity = organization.Element("Деятельность").Element("Лицензируемая"); if (lactivity != null) { foreach (XNode node in lactivity.Elements("Лицензия")) { RarLicense license = new RarLicense(); XElement el = (XElement)node; //license.ID = ""; license.SeriesNumber = (string)el.Attribute("СерНомЛиц"); license.DateFrom = DateTime.Parse(el.Attribute("ДатаНачЛиц").Value); license.DateTo = DateTime.Parse(el.Attribute("ДатаОконЛиц").Value); license.BusinesType = (string)el.Attribute("ВидДеят"); OurCompany.LicensesList.Add(license); } } else { OurCompany.UnLisenseActivity = (string)organization.Element("Деятельность").Element("Нелицензируемая").Attribute("ВидДеят"); } }
private static void SetupLisences(RarCompany rc, XElement lisenses) { foreach (XNode node in lisenses.Elements("Лицензия")) { RarLicense license = new RarLicense(); XElement el = (XElement)node; license.ID = (string)el.Attribute("ИдЛицензии"); license.SeriesNumber = (string)el.Attribute("П000000000011"); license.DateFrom = DateTime.Parse(el.Attribute("П000000000012").Value); license.DateTo = DateTime.Parse(el.Attribute("П000000000013").Value); license.Issuer = (string)el.Attribute("П000000000014"); rc.LicensesList.Add(license); } }