private ElectricityInfoEntity createElectricityCodeEntity(ElectricityFileInfo electricity) { return(new ElectricityInfoEntity { AmountAfterTax = electricity.Amount, BankAccount = electricity.BankAccount, BankAccountType = electricity.BankAccountType, Branch = electricity.BankBranch, Bank = electricity.BankCode, BillCreatingDate = electricity.BillCreatingDate, ConsumerAddress = electricity.ConsumerAddress, ConsumerName = electricity.ConsumerName, ConsumerNumber = electricity.ConsumerNumber, CustomerId = electricity.CustomerId, GeneralRowId = electricity.GeneralRowId, Invoice = electricity.Invoice, JournalEntryNumber = electricity.JournalEntryNumber, MonthOfLastInvoice = electricity.MonthOfLastInvoice, NumberOfCreditDays = electricity.NumberOfCreditDays, PaymentDate = electricity.PaymentDate, YearOfLastInvoice = electricity.YearOfLastInvoice, IsMatched = electricity.IsMatched, Contract = electricity.Contract, RowId = electricity.RowId, }); }
private ElectricityFileInfo createElectricityFileInfoRow(string line, int rowId, ref GeneralBillingSummary summary) { string[] values = line.Split(';'); ElectricityFileInfo info = new ElectricityFileInfo(); info.GeneralRowId = summary.RowId; info.RowId = rowId; info.CustomerId = summary.CustomerId; info.BillCreatingDate = DateTime.ParseExact(values[6], "yyMMdd", null); info.NumberOfCreditDays = Convert.ToInt32(values[7].Substring(1)); info.Amount = Convert.ToDecimal(values[8]) / 100; info.PaymentDate = DateTime.ParseExact(values[9], "yyMMdd", null); info.ConsumerAddress = values[11]; info.ConsumerName = values[10]; info.BankCode = Convert.ToInt32(values[13]); info.BankBranch = Convert.ToInt32(values[14]); info.BankAccount = Convert.ToInt32(values[15]); info.BankAccountType = Convert.ToInt32(values[16]); info.MonthOfLastInvoice = DateTime.ParseExact(values[17], "MMyy", null).Month; info.YearOfLastInvoice = DateTime.ParseExact(values[17], "MMyy", null).Year; info.ConsumerNumber = Convert.ToInt32(values[18]); info.Contract = Convert.ToInt32(values[19]); info.Invoice = Convert.ToInt64(values[20]); summary.DateOfValue = summary.DateOfValue.Year != 1 ? summary.DateOfValue : new DateTime(info.PaymentDate.Year, info.PaymentDate.Month, DateTime.DaysInMonth(info.PaymentDate.Year, info.PaymentDate.Month)); summary.TotalCredit += info.Amount < 0 ? -1 * info.Amount : 0; summary.TotalDebit += info.Amount >= 0 ? info.Amount : 0; return(info); }