public ProductExports(MySQLDriver driver) { this._SQL = driver; _units = new Units(_SQL); _products = new Products(_SQL); _months = new Months(); _deadlines = new Deadlines(_SQL); }
private Material parseLine(String line) { String IDString = MySQLDriver.parseCollumn(line, "ID", true); String NameString = MySQLDriver.parseCollumn(line, "NAME"); String PriceString = MySQLDriver.parseCollumn(line, "PRICE", true).Replace('.', ','); String AmountString = MySQLDriver.parseCollumn(line, "AMOUNT", true).Replace('.', ','); String IDCompanyString = MySQLDriver.parseCollumn(line, "ID_COMPANY", true); String InvoiceNumberString = MySQLDriver.parseCollumn(line, "INVOICE_NUMBER", true); String IDUnitString = MySQLDriver.parseCollumn(line, "ID_UNIT", true); String MonthString = MySQLDriver.parseCollumn(line, "MONTH", true); String YearString = MySQLDriver.parseCollumn(line, "YEAR", true); String CurrencyString = MySQLDriver.parseCollumn(line, "CURRENCY", true); String ShippingDateString = MySQLDriver.parseCollumn(line, "SHIPPINGDATE", true); String CourseDateString = MySQLDriver.parseCollumn(line, "COURSEDATE", true); String CourseString = MySQLDriver.parseCollumn(line, "COURSE", true).Replace('.', ','); String MaterialTypeIdString = MySQLDriver.parseCollumn(line, "ID_MATERIALTYPE", true); String ShippingString = MySQLDriver.parseCollumn(line, "SHIPPINGPRICE", true).Replace('.',','); String DeadlineString = MySQLDriver.parseCollumn(line, "ID_DEADLINE", true); int matTypeId = int.Parse(MaterialTypeIdString); MaterialType materialTypeItem = new MaterialType(0, ""); if (matTypeId != 0) { materialTypeItem = _materialTypes.GetRecord(matTypeId); } Month actmonth = new Months().getMonth(int.Parse(MonthString)); Deadline dead = _deadlines.GetRecord(int.Parse(DeadlineString)); if (dead == null) { dead = Deadlines.Default; } try { return new Material(int.Parse(IDString), NameString, float.Parse(PriceString), float.Parse(AmountString), _companies.GetRecord(int.Parse(IDCompanyString)), int.Parse(InvoiceNumberString), _units.GetRecord(int.Parse(IDUnitString)), materialTypeItem, actmonth, int.Parse(YearString), _currencies.getCurrency(int.Parse(CurrencyString)), DateTimeUtils.SQLDateToDateTime(ShippingDateString), DateTimeUtils.SQLDateToDateTime(CourseDateString), float.Parse(CourseString), float.Parse(ShippingString), dead); } catch (Exception) { _SQL.getConnector().setError(); return Default; } }