public static void ParseCredits() { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("credits.csv")) { using (var reader = new StreamReader(stream)) { string line; do { line = reader.ReadLine(); if (line != null) { if (line.Length > 0) { string[] entry = line.Split(','); CreditEntry c = new CreditEntry() { name = entry[0], normalizedName = RemoveDiacritics(entry[0]), alumni = (entry[1] == "1"), country_code = entry[2], region = (entry[3]), twitter = entry[4], }; s_Credits.Add(c); } } }while (line != null); } } }
private static void SetFormattedText(CreditEntry entry, Text textObject) { string formattedText = $"{entry.firstName} {entry.lastName} - {entry.job}"; textObject.text = formattedText; textObject.name = $"{entry.firstName}"; }
private void LoadGridJU(JournalUnitReportItem[] items, CreditEntry creditEntry) { gvJU.Columns[1].Visible = false; gvJU.Columns[2].Visible = false; gvJU.Columns[3].Visible = EndPeriod != StartPeriod.AddMonths(1); gvJU.DataSource = items; gvJU.DataBind(); SetTotalText(creditEntry.MerchandiseAmount); }
public void AccountRecordsDepositInTransactionLog() { var ledger = Substitute.For <ILedger>(); var money = new Money(3m); var account = new Account(ledger); account.Deposit(DateTime.Now, money); CreditEntry deposit = new CreditEntry(DateTime.Now, money); ledger.Received().Record(deposit); }
private string GenerateExcelJU(JournalUnitReportItem[] items, CreditEntry creditEntry, BillingCategory billingCategory, JournalUnitTypes juType) { //Contruct the excel object string fileName = Utility.GetRequiredAppSetting("JU_Template"); string templatePath = ExcelUtility.GetTemplatePath(fileName); using (var mgr = ExcelUtility.NewExcelManager()) { mgr.OpenWorkbook(templatePath); mgr.SetActiveWorksheet("Sheet1"); DateTime period = EndPeriod.AddMonths(-1); string billingCategoryName = Utility.EnumToString(billingCategory); //We start at first row, because for ExcelLite control, the header row is not included // [2021-09-27 jg] // source was previoulsy JU, now it is ENG (set in web.config) // journalDescription was previously "JU {0} {1:MM/yy} {2} {3}{4}" now set in web.config string source = Utility.GetRequiredAppSetting("JournalSource"); //ENG int journalUnitNumber = ReportSettings.GetJournalUnitNumber(period, billingCategory, juType); // JournalDescription example: [email protected]; JU {0} {1:MM/yy} {2} {3}{4} string journalDescription = string.Format( Utility.GetRequiredAppSetting("JournalDescription"), /*0*/ journalUnitNumber, /*1*/ period, /*2*/ ReportSettings.CompanyName, /*3*/ billingCategoryName, /*4*/ Utility.EnumToString(juType) ); //column A mgr.SetCellTextValue(2, 0, "H"); //column B mgr.SetCellTextValue(2, 1, "NEXT"); //column C mgr.SetCellTextValue(2, 2, DateTime.Now.ToString("MM/dd/yyyy")); //column D mgr.SetCellTextValue(2, 3, source); //column E mgr.SetCellTextValue(2, 4, period.ToString("yyyy/MM")); //column F mgr.SetCellTextValue(2, 5, journalDescription); //column G mgr.SetCellTextValue(2, 6, ReportSettings.FinancialManagerUserName); int iRow = 3; int iCol = 7; //DataView dv = dt.DefaultView; //dv.Sort = "ItemDescription ASC, ProjectGrant ASC"; foreach (JournalUnitReportItem item in items.Where(i => i.ItemDescription != $"zz{ReportSettings.FinancialManagerUserName}")) { //column A mgr.SetCellTextValue(iRow, 0, "L"); //column H mgr.SetCellTextValue(iRow, iCol, item.Account); //column I mgr.SetCellTextValue(iRow, iCol + 1, item.FundCode); //column J mgr.SetCellTextValue(iRow, iCol + 2, item.DeptID); //column K mgr.SetCellTextValue(iRow, iCol + 3, item.ProgramCode); //column L mgr.SetCellTextValue(iRow, iCol + 4, item.Class); //column M mgr.SetCellTextValue(iRow, iCol + 5, item.ProjectGrant); //column N mgr.SetCellNumberValue(iRow, iCol + 6, string.IsNullOrEmpty(item.MerchandiseAmount) ? 0 : Convert.ToDouble(item.MerchandiseAmount)); //column O mgr.SetCellTextValue(iRow, iCol + 7, item.DepartmentalReferenceNumber); //column P mgr.SetCellTextValue(iRow, iCol + 8, item.ItemDescription); iRow += 1; } //Add the last row - which is the summary unit mgr.SetCellTextValue(iRow, 0, "L"); mgr.SetCellTextValue(iRow, iCol, creditEntry.Account); mgr.SetCellTextValue(iRow, iCol + 1, creditEntry.FundCode); mgr.SetCellTextValue(iRow, iCol + 2, creditEntry.DeptID); mgr.SetCellTextValue(iRow, iCol + 3, creditEntry.ProgramCode); mgr.SetCellTextValue(iRow, iCol + 4, creditEntry.ClassName); mgr.SetCellTextValue(iRow, iCol + 5, creditEntry.ProjectGrant); mgr.SetCellNumberValue(iRow, iCol + 6, creditEntry.MerchandiseAmount); mgr.SetCellTextValue(iRow, iCol + 7, creditEntry.DepartmentalReferenceNumber); //should be davejd mgr.SetCellTextValue(iRow, iCol + 8, creditEntry.ItemDescription); // should be MM/YY LNF UsageCase Subsidy;SUB# string workPathDir = ExcelUtility.GetWorkPath(CurrentUser.ClientID); if (!Directory.Exists(workPathDir)) { Directory.CreateDirectory(workPathDir); } string workFilePath = Path.Combine(workPathDir, "JU" + Enum.GetName(typeof(JournalUnitTypes), juType) + "_" + billingCategoryName + "_" + period.ToString("yyyy-MM") + Path.GetExtension(fileName)); mgr.SaveAs(workFilePath); return(workFilePath); } }