public override List <ulong> ParseAddressIds(MySqlConnection connection, ulong supplierId, string archFileName, string currentFileName) { var list = new List <ulong>(); string SQL = AddressIdQuery.SqlGetClientAddressId(true, true); string FirmClientCode, DeliveryCode; try { var dsWaybill = new DataSet(); dsWaybill.ReadXml(currentFileName); DataTable dtCounteragent = dsWaybill.Tables["Контрагент"]; FirmClientCode = dtCounteragent.Select("Роль = 'Плательщик'")[0]["Ид"].ToString(); DeliveryCode = dtCounteragent.Select("Роль = 'Получатель'")[0]["Ид"].ToString(); } catch (Exception ex) { throw new Exception("Не получилось сформировать SupplierClientId(FirmClientCode) и SupplierDeliveryId(FirmClientCode2) из документа.", ex); } DataSet ds = MySqlHelper.ExecuteDataset( connection, SQL, new MySqlParameter("?SupplierId", supplierId), new MySqlParameter("?SupplierClientId", FirmClientCode), new MySqlParameter("?SupplierDeliveryId", DeliveryCode)); foreach (DataRow drApteka in ds.Tables[0].Rows) { list.Add(Convert.ToUInt64(drApteka["AddressId"])); } if (list.Count == 0) { throw new Exception("Не удалось найти клиентов с SupplierClientId(FirmClientCode) = " + FirmClientCode + " и SupplierDeliveryId(FirmClientCode2) = " + DeliveryCode + "."); } return(list); }
public override List <ulong> ParseAddressIds(MySqlConnection Connection, ulong FirmCode, string ArchFileName, string CurrentFileName) { var list = new List <ulong>(); var SQL = AddressIdQuery.SqlGetClientAddressId(true, true); string FirmClientCode, DeliveryCode; try { string[] parts = Path.GetFileNameWithoutExtension(CurrentFileName).Split('_'); FirmClientCode = parts[0]; DeliveryCode = parts[1]; } catch (Exception ex) { throw new Exception("Не получилось сформировать SupplierClientId(FirmClientCode) и SupplierDeliveryId(FirmClientCode2) из документа.", ex); } var ds = MySqlHelper.ExecuteDataset( Connection, SQL, new MySqlParameter("?SupplierId", FirmCode), new MySqlParameter("?SupplierClientId", FirmClientCode), new MySqlParameter("?SupplierDeliveryId", DeliveryCode)); foreach (DataRow drApteka in ds.Tables[0].Rows) { list.Add(Convert.ToUInt64(drApteka["AddressId"])); } if (list.Count == 0) { throw new Exception("Не удалось найти клиентов с SupplierClientId(FirmClientCode) = " + FirmClientCode + " и SupplierDeliveryId(FirmClientCode2) = " + DeliveryCode + "."); } return(list); }