public TeamDetail GetTeamDetailByTeamResponse(IStat stat, TeamResponse team, IList <StatResponse> matchStats) { var teamDetail = new TeamDetail { TeamInfo = team }; var teamTotalAge = 0; var teamStats = new StatResponse(); var players = matchStats.Where(p => p.TeamId == team.Id).Select(p => p.Player).ToList(); foreach (var player in players) { var playerStat = stat.GetPlayerStatByMatchIdAndTeamId(player.Id, team.Id, matchStats); if (playerStat == null) { continue; } teamStats = stat.AddPlayerStatToTeamStats(teamStats, playerStat); teamDetail.PlayerStats.Add(new PlayerMatchStat { Player = player, Stat = playerStat }); teamTotalAge = teamTotalAge + player.BirthDate.GetAge(); } teamDetail.AgeRatio = ConvertFunctions.GetTeamAgeRatio(players.Count, teamTotalAge); teamDetail.TeamStats = teamStats; return(teamDetail); }
public ILBuilder(ILGenerator il) { this.il = il; this.arguments = new ArgumentFunctions(this); this.compare = new CompareFunctions(this); this.convert = new ConvertFunctions(this); this.math = new MathFunctions(this); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var buildingObject = await _context.BuildingObject .SingleOrDefaultAsync(m => m.Id == id); if (buildingObject == null) { return(NotFound()); } var path = "wwwroot/images/objects/"; List <string> images = new List <string>(); List <string> directories = new List <string>(Directory.EnumerateDirectories(path)); var adresses = new List <string>(); var mapAddress = ""; if (!string.IsNullOrEmpty(buildingObject.Address)) { if (buildingObject.Address.Contains(';')) { adresses = buildingObject.Address.Split(';').ToList(); mapAddress = adresses[0]; // Отображение на карте первого адреса } else { adresses.Add(buildingObject.Address); mapAddress = buildingObject.Address; } foreach (var adr in adresses) { foreach (var directory in directories) { var dirName = directory.Split('/').Last(); if (ConvertFunctions.ClearAddressString(dirName) == ConvertFunctions.ClearAddressString(adr)) { var tempFilesList = new List <string>(Directory.GetFiles(directory)); foreach (var file in tempFilesList) { images.Add(file.Replace("wwwroot/", "")); } } } } } ViewBag.Images = images; ViewBag.Address = mapAddress; return(View(buildingObject)); }
public static RECEIPT _SA_Read(RECEIPT ReceiptRecord) // method will read all fields and store the data in a RECEIPT record { RECEIPT Rec = new RECEIPT(); if (Functions.GoodData(ReceiptRecord)) { ReceiptsJournal._SA_Open(ReceiptRecord); } Rec.paidBy = ReceiptsJournal.repo.PaidBy.SelectedItemText; if (ReceiptsJournal.repo.DepositToInfo.Exists()) { Rec.DepositAccount.acctNumber = ReceiptsJournal.repo.DepositTo.SelectedItemText; } if (ReceiptsJournal.repo.ChequeNumberInfo.Exists()) { { Rec.chequeNumber = ReceiptsJournal.repo.ChequeNumber.TextValue; } } Rec.Customer.name = ReceiptsJournal.repo.CustomerName.SelectedItemText; Rec.transDate = ReceiptsJournal.repo.ReceiptDate.TextValue; if (ReceiptsJournal.repo.ReceiptNumberInfo.Exists()) { Rec.transNumber = ReceiptsJournal.repo.ReceiptNumber.TextValue; } if (ReceiptsJournal.repo.PadNumberInfo.Exists()) { Rec.padNumber = ReceiptsJournal.repo.PadNumber.TextValue; } Rec.GridRows.Clear(); List <List <string> > lsContents = ReceiptsJournal.repo.TransContainer.GetContents(); // a blank row is added at the end of the list if (Functions.GoodData(lsContents)) { bool bDepositLineFound = false; for (int x = 0; x < lsContents.Count; x++) { RECEIPT_ROW RR = new RECEIPT_ROW(); string sRefNum = ConvertFunctions.BlankStringToNULL(lsContents[x][1]); if (Functions.GoodData(sRefNum)) // to avoid adding a blank row { if (sRefNum == "Deposits") { bDepositLineFound = true; } else { if (bDepositLineFound) // deposit row { RR.DepositReceipt.depositRefNum = sRefNum; } else // invoice row { RR.Invoice.transNumber = sRefNum; } RR.discountTaken = ConvertFunctions.BlankStringToNULL(lsContents[x][5]); RR.Amount = ConvertFunctions.BlankStringToNULL(lsContents[x][6]); } Rec.GridRows.Add(RR); } } } Rec.depositRefNum = ReceiptsJournal.repo.DepositReferenceNo.TextValue; Rec.depositAmount = ReceiptsJournal.repo.DepositAmount.TextValue; if (ReceiptsJournal.repo.ExchangeRateInfo.Exists()) { Rec.exchangeRate = ReceiptsJournal.repo.ExchangeRate.TextValue; } Rec.comment = ReceiptsJournal.repo.Comment.TextValue; return(Rec); }
public static PAYMENT_REMIT _SA_ReadPayment_Remit(PAYMENT_REMIT PaymentToRead) // method will read all fields and store the data in a PAYMENT_REMIT record { PAYMENT_REMIT P = new PAYMENT_REMIT(); if (Functions.GoodData(PaymentToRead)) { PaymentsJournal._SA_Open(PaymentToRead); } P.Vendor.name = PaymentsJournal.repo.VendorName.TextValue; if (PaymentsJournal.repo.PaidFromInfo.Exists()) { P.paidFrom.acctNumber = PaymentsJournal.repo.PaidFrom.SelectedItemText; } P.chequeNumber = PaymentsJournal.repo.ChequeNo.TextValue; P.TransDate = PaymentsJournal.repo.PaymentDate.TextValue; P.comment = PaymentsJournal.repo.Comment.TextValue; P.reference = PaymentsJournal.repo.Reference.TextValue; PaymentsJournal.repo.FrequencyButton.Click(); P.remitFrequency = SelectRemittingFrequency.repo.Frequency.SelectedItemText; SelectRemittingFrequency.repo.Cancel.Click(); List <List <string> > lsContents = PaymentsJournal.repo.TransContainer.GetContents(); if (lsContents.Count > 0) { int x; for (x = 0; x < lsContents.Count; x++) { PAY_REMIT_ROW PR = new PAY_REMIT_ROW(); PR.remitName = ConvertFunctions.BlankStringToNULL(lsContents[x][0]); //if (PR.remitName == "") //{ // PR.remitName = null; //} PR.amountOwing = ConvertFunctions.BlankStringToNULL(lsContents[x][1]); //if (PR.amountOwing == "") //{ // PR.amountOwing = null; //} PR.adjustAccount = ConvertFunctions.BlankStringToNULL(lsContents[x][2]); //if (PR.adjustAccount == "") //{ // PR.adjustAccount = null; //} PR.adjustment = ConvertFunctions.BlankStringToNULL(lsContents[x][3]); //if (PR.adjustment == "") //{ // PR.adjustment = null; //} PR.amount = ConvertFunctions.BlankStringToNULL(lsContents[x][4]); //if (PR.amount == "") //{ // PR.amount = null; //} P.GridRows.Add(PR); } } return(P); }
public static PURCHASE _SA_Read(PURCHASE TransRecord, bool bOneTime) // method will read all fields and store the data in a PURCHASE record { PURCHASE Purch; // load it in adjustment mode first if (Functions.GoodData(TransRecord)) // load the transaction if specified { PurchasesJournal._SA_Open(TransRecord, true, bOneTime); } // set focus from the settings window back to the journal window //PurchasesJournal.Instance.Window.SetActive(); // create the correct object based on the transaction type string transType = PurchasesJournal.repo.TransTypeDropDown.SelectedItemText; if (transType.ToLower().Contains("invoice")) { Purch = new PURCHASE_INVOICE(); } else if (transType.ToLower().Contains("order")) { Purch = new PURCHASE_ORDER(); } else if (transType.ToLower().Contains("quote")) { Purch = new PURCHASE_QUOTE(); } else { Purch = new PURCHASE_INVOICE(); //Functions.Verify(false, true, "Valid value from transaction list"); } if (Purch.GetType() != typeof(PURCHASE_QUOTE)) // i.e. order or invoice { // Set Paid by and ChequeNumbers ((PURCHASE_COMMON_ORDER_INVOICE)Purch).paymentMethod = PurchasesJournal.repo.PaidBy.SelectedItemText; if (PurchasesJournal.repo.PaidFromInfo.Exists()) { { ((PURCHASE_COMMON_ORDER_INVOICE)Purch).PaidFromAccount.acctNumber = PurchasesJournal.repo.PaidFrom.SelectedItemText; } } if (PurchasesJournal.repo.ChequeNumberInfo.Exists()) { { ((PURCHASE_COMMON_ORDER_INVOICE)Purch).chequeNumber = PurchasesJournal.repo.ChequeNumber.TextValue; } } } if (Purch.GetType() == typeof(PURCHASE_INVOICE)) // set style for invoice, transaction number, & Quote Number if present { { Purch.transNumber = PurchasesJournal.repo.InvoiceNumber.TextValue; if (PurchasesJournal.repo.OrderQuoteNoInfo.Exists()) // doesn't exists for one time { ((PURCHASE_INVOICE)Purch).quoteOrderTransNumber = PurchasesJournal.repo.OrderQuoteNoText.TextValue; } } } else // set transaction number and shipping date for order/quote { Purch.transNumber = PurchasesJournal.repo.OrderQuoteNoText.TextValue; Purch.shipDate = PurchasesJournal.repo.ShipDate.TextValue; } Purch.Vendor.name = PurchasesJournal.repo.VendorNameText.TextValue; Purch.transDate = PurchasesJournal.repo.InvoiceDate.TextValue; if (PurchasesJournal.repo.ExchangeRateInfo.Exists()) { Purch.exchangeRate = PurchasesJournal.repo.ExchangeRate.TextValue; } if (PurchasesJournal.repo.StoreItemsAtInfo.Exists()) { if (PurchasesJournal.repo.StoreItemsAt.Enabled) { Purch.shipToLocation = PurchasesJournal.repo.StoreItemsAt.SelectedItemText; } } // prepare the container PURCH_TABLE PT = new PURCH_TABLE(); // InitializeTable(PT); //int iNumOfCols = PurchasesJournal.repo.TransContainer.ColumnCount; //List<string[]> containerLine = ConvertFunctions.DataGridItemsToListOfString(PurchasesJournal.Instance.TransContainer.Items, iNumOfCols); List <List <string> > Contents = PurchasesJournal.repo.TransContainer.GetContents(); List <ROW> lR = new List <ROW>() { }; //for (int x = 0; x < containerLine.Count; x++) foreach (List <string> currRow in Contents) { // it's a blank row if the item number, quantity received, quantity ordered, description, and amount fields are all blank if ((currRow[PT.iItem] == "") && (currRow[PT.iQuantity] == "") && (currRow[PT.iOrder] == "") && (currRow[PT.iDescription] == "") && (currRow[PT.iAmount] == "")) { // do not add } else { ROW R = new ROW(); // assign recordset R.Item.invOrServNumber = ConvertFunctions.CommaToText(currRow[PT.iItem]); R.quantityReceived = ConvertFunctions.CommaToText(currRow[PT.iQuantity]); R.quantityOrdered = ConvertFunctions.CommaToText(currRow[PT.iOrder]); R.quantityBackordered = ConvertFunctions.CommaToText(currRow[PT.iBackOrder]); R.unit = ConvertFunctions.CommaToText(currRow[PT.iUnit]); //R.Item.invOrServDescription = StrTran(containerLine[5+ iItmColID], "," ,"\comma") // wrong record field R.description = ConvertFunctions.CommaToText(currRow[PT.iDescription]); R.price = ConvertFunctions.CommaToText(currRow[PT.iPrice]); R.TaxCode.code = ConvertFunctions.CommaToText(currRow[PT.iTax]); // blank when no tax R.amount = ConvertFunctions.CommaToText(currRow[PT.iAmount]); R.Account.acctNumber = ConvertFunctions.CommaToText(currRow[PT.iAccount]); // append to detail list lR.Add(R); } //// only remove if more than one line is present. NC - no longer needed so commented out //if(containerLine.Count >iNumOfCols) //{ // // remove line already recorded // for ( int i = 0; i < iNumOfCols; i++) // { // containerLine.RemoveAt(1); // } //} //else //{ // containerLine.RemoveAt(1); //} } // add rows to the record Purch.GridRows = lR; // read project allocation data if (Functions.GoodData(Purch.GridRows)) { //PurchasesJournal.Instance.VendorName.SetFocus(); // Set focus within the journal first, or else sometimes cannot select the account field. for (int x = 0; x < Purch.GridRows.Count; x++) { if (Functions.GoodData(Purch.GridRows[x].amount)) // proceed only if amount is available { PurchasesJournal.repo.TransContainer.SelectCell("Account", x); // select account field PurchasesJournal.repo.TransContainer.PressKeys("{Ctrl Shift}a"); if (ProjectAllocationDialog.repo.SelfInfo.Exists()) { Purch.GridRows[x].Projects = ProjectAllocationDialog._SA_GetProjectAllocationDetails(); // get dialog content ProjectAllocationDialog.repo.Cancel.Click(); } } } } if (PurchasesJournal.repo.PrepayRefNumberInfo.Exists()) { ((PURCHASE_ORDER)Purch).prepayRefNumber = PurchasesJournal.repo.PrepayRefNumber.TextValue; ((PURCHASE_ORDER)Purch).prepaymentAmount = PurchasesJournal.repo.PrepaymentAmount.TextValue; } Purch.freightAmount = PurchasesJournal.repo.FreightAmount.TextValue; Purch.FreightTaxCode.code = PurchasesJournal.repo.FreightCode.TextValue; if (PurchasesJournal.repo.FreightTaxTotalInfo.Exists()) // db has more than 2 taxes defined { Purch.freightTaxTotal = PurchasesJournal.repo.FreightTaxTotal.TextValue; } else // only two taxes and both shown { Purch.freightTax1 = PurchasesJournal.repo.FreightTax1.TextValue; // will not show if only one tax is shown if (PurchasesJournal.repo.FreightTax2Info.Exists()) { Purch.freightTax2 = PurchasesJournal.repo.FreightTax2.TextValue; } } if (PurchasesJournal.repo.TermsPercentInfo.Exists()) { Purch.termsPercent = PurchasesJournal.repo.TermsPercent.TextValue; Purch.termsDays = PurchasesJournal.repo.TermsDay.TextValue; Purch.termsNetDays = PurchasesJournal.repo.TermsNetDays.TextValue; } if (PurchasesJournal.repo.EarlyDiscountInfo.Exists()) { ((PURCHASE_INVOICE)Purch).earlyPaymentDiscountPercent = PurchasesJournal.repo.EarlyDiscount.TextValue; } if (Purch.GetType() == typeof(PURCHASE_INVOICE)) // set tracking { if (Functions.GoodData(Purch.shippedBy) || Functions.GoodData(Purch.trackingNumber)) { PurchasesJournal.repo.Self.PressKeys("{Ctrl}k"); Purch.shippedBy = TrackShipments.repo.Shipper.SelectedItemText; Purch.trackingNumber = TrackShipments.repo.TrackingNumber.TextValue; TrackShipments.repo.OK.Click(); } } return(Purch); }
public static List <string> DataFile_updateListOfStrings(string extension, PROJECT ProjectRecord, int iBudgetLine) { List <string> listContents = new List <string>(); switch (extension.ToUpper()) { case EXTENSION_HEADER: listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.action))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.name))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.startDate))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.revenue))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.expense))); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.inactiveCheckBox)); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.endDate))); switch (ProjectRecord.status) { case PROJECT_STATUS.PROJECT_PENDING: listContents.Add("Pending"); break; case PROJECT_STATUS.PROJECT_IN_PROGRESS: listContents.Add("In Progress"); break; case PROJECT_STATUS.PROJECT_CANCELLED: listContents.Add("Cancelled"); break; case PROJECT_STATUS.PROJECT_COMPLETED: listContents.Add("Completed"); break; default: Functions.Verify(false, true, "Valid value for project status"); break; } listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.nameEdit))); break; case EXTENSION_BUDGET: listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.name))); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.budgetCheckBox)); break; case EXTENSION_BUDGET_TABLE: listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.name))); listContents.Add(Convert.ToString(iBudgetLine)); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.Budgets[iBudgetLine].revenue))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.Budgets[iBudgetLine].expense))); break; case EXTENSION_ADDITIONAL_INFO: listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.name))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.additional1))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.additional2))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.additional3))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.additional4))); listContents.Add(ConvertFunctions.CommaToText(ConvertFunctions.NullToBlankString(ProjectRecord.additional5))); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.addCheckBox1)); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.addCheckBox2)); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.addCheckBox3)); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.addCheckBox4)); listContents.Add(ConvertFunctions.BoolToString(ProjectRecord.addCheckBox5)); break; default: { break; } } return(listContents); }
public static PROJECT DataFile_setDataStructure(string extension, string dataLine, PROJECT Proj) { PROJECT ProjectRecord = Proj; switch (extension.ToUpper()) { case EXTENSION_HEADER: ProjectRecord.action = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1)); ProjectRecord.name = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 2)); ProjectRecord.startDate = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 3)); ProjectRecord.revenue = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 4)); ProjectRecord.expense = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 5)); ProjectRecord.inactiveCheckBox = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 6)); ProjectRecord.endDate = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 7)); switch (Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 8))) { case "Pending": ProjectRecord.status = PROJECT_STATUS.PROJECT_PENDING; break; case "In Progress": ProjectRecord.status = PROJECT_STATUS.PROJECT_IN_PROGRESS; break; case "Cancelled": ProjectRecord.status = PROJECT_STATUS.PROJECT_CANCELLED; break; case "Completed": ProjectRecord.status = PROJECT_STATUS.PROJECT_COMPLETED; break; default: { Functions.Verify(false, true, "Valid value for project status"); break; } } ProjectRecord.nameEdit = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 9)); break; case EXTENSION_BUDGET: if (ProjectRecord.name == Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1))) { ProjectRecord.budgetCheckBox = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 2)); } break; case EXTENSION_BUDGET_TABLE: if (ProjectRecord.name == Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1))) { PROJECT_BUDGET PB = new PROJECT_BUDGET(); PB.revenue = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 3)); PB.expense = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 4)); if (Functions.GoodData(ProjectRecord.Budgets)) { ProjectRecord.Budgets.Add(PB); } else { ProjectRecord.Budgets = new List <PROJECT_BUDGET> { PB }; } } break; case EXTENSION_ADDITIONAL_INFO: if (ProjectRecord.name == Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 1))) { ProjectRecord.additional1 = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 2)); ProjectRecord.additional2 = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 3)); ProjectRecord.additional3 = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 4)); ProjectRecord.additional4 = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 5)); ProjectRecord.additional5 = Functions.PrepStringsFromDataFiles(Functions.GetField(dataLine, ",", 6)); ProjectRecord.addCheckBox1 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 7)); ProjectRecord.addCheckBox2 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 8)); ProjectRecord.addCheckBox3 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 9)); ProjectRecord.addCheckBox4 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 10)); ProjectRecord.addCheckBox5 = ConvertFunctions.StringToBool(Functions.GetField(dataLine, ",", 11)); } break; default: { Functions.Verify(false, true, "Valid value of extension sent to function"); break; } } return(ProjectRecord); }