/// <summary> /// Constructor for a FundingOption /// </summary> /// <param name="name">Human readable name for this option</param> /// <param name="cost">How much is it worth</param> /// <param name="type">What type of tax/credit is it</param> public FundingOption(string name, decimal cost, FundingType type) : base(name) { Contract.Requires((type.HasFlag(FundingType.TaxCredit) || type.HasFlag(FundingType.TaxDeduction)) && cost > 0); Contract.Requires(!(type.HasFlag(FundingType.TaxCredit) || type.HasFlag(FundingType.TaxDeduction)) && cost < 0); this.Cost = cost; this.Type = type; }
public ActionResult <List <FundingType> > FundingType() { List <FundingType> Result = new List <FundingType>(); foreach (CU_S_CUSTOMER_TYPE_EXT_AUS item in DBContext.CU_S_CUSTOMER_TYPE_EXT_AUS) { FundingType model = EntityMapper.Map <FundingType, CU_S_CUSTOMER_TYPE_EXT_AUS>(DBContext, item); Result.Add(model); } return(Result); }
public ProjectBudgetsByCostTypeSummaryViewData(FundingType fundingType, List <ProjectBudgetByCostType> projectBudgetByCostTypes, List <CalendarYearString> calendarYears, List <CostType> costTypes, decimal?noFundingSourceIdentified, decimal?estimatedTotal, List <ProjectFundingSourceCostTypeAmount> projectFundingSourceCostTypeAmounts, string expectedFundingUpdateNote) { FundingType = fundingType; CostTypes = costTypes; ProjectBudgetByCostTypes = projectBudgetByCostTypes; CalendarYears = calendarYears; NoFundingSourceIdentified = noFundingSourceIdentified; EstimatedTotal = estimatedTotal; ProjectFundingSourceCostTypeAmounts = projectFundingSourceCostTypeAmounts; ExpectedFundingUpdateNote = expectedFundingUpdateNote; FieldDefinitionForProject = FieldDefinitionEnum.Project.ToType(); FieldDefinitionForFundingSource = FieldDefinitionEnum.FundingSource.ToType(); FieldDefinitionForCostType = FieldDefinitionEnum.CostType.ToType(); FieldDefinitionForSecuredFunding = FieldDefinitionEnum.SecuredFunding.ToType(); FieldDefinitionForTargetedFunding = FieldDefinitionEnum.TargetedFunding.ToType(); }
public static FundingTypeDTO ToDto(this FundingType fundingtype) { if (fundingtype == null) { return(null); } var fundingtypeDTO = new FundingTypeDTO { Id = fundingtype.Id, FundingTypeName = fundingtype.FundingTypeName, MinDeposit = fundingtype.MinDeposit, MaxDeposit = fundingtype.MaxDeposit, MonthlyQuote = fundingtype.MonthlyQuote, QuoteActive = fundingtype.QuoteActive, }; return(fundingtypeDTO); }
public static FundingType ToEntity(this FundingTypeDTO fundingtypeDTO) { if (fundingtypeDTO == null) { return(null); } var fundingtype = new FundingType { Id = fundingtypeDTO.Id, FundingTypeName = fundingtypeDTO.FundingTypeName, MinDeposit = fundingtypeDTO.MinDeposit, MaxDeposit = fundingtypeDTO.MaxDeposit, MonthlyQuote = fundingtypeDTO.MonthlyQuote, QuoteActive = fundingtypeDTO.QuoteActive, }; return(fundingtype); }
private void Init() { try { _Validator = new ValidationTools(); } catch (Exception ex) { MessageBoxEnhanced.Error(ex.Message); return; } // Title ComboBox cbTitle.ItemsSource = DataModel.Title.GetTitles(); // FundingType ComboBox cBFundingTyp.ItemsSource = FundingType.GetFundingTypes(); gbCompanySponsor.Visibility = System.Windows.Visibility.Collapsed; gbCompanySponsor.IsEnabled = false; }
public async Task <BitfinexApiResult <BitfinexOffer> > PlaceNewOfferAsync(string currency, double amount, double rate, int period, FundingType type) { if (string.IsNullOrEmpty(apiKey) || encryptor == null) { return(ThrowErrorMessage <BitfinexOffer>(BitfinexErrors.GetError(BitfinexErrorKey.NoApiCredentialsProvided))); } var parameters = new Dictionary <string, object>() { { "currency", currency }, { "amount", amount }, { "rate", rate }, { "period", period }, { "direction", JsonConvert.SerializeObject(type, new FundingTypeConverter(false)) } }; return(await ExecuteAuthenticatedRequestV1 <BitfinexOffer>(GetUrl(NewOfferEndpoint, OldApiVersion), PostMethod, parameters)); }
public BitfinexApiResult <BitfinexOffer> PlaceNewOffer(string currency, double amount, double rate, int period, FundingType type) => PlaceNewOfferAsync(currency, amount, rate, period, type).Result;
/// <summary> /// Wird aufgerufen wenn eine Personen-Art (Kinder, Sponsor...) ausgewählt wurde. /// </summary> /// <param name="sender">Die geschlossene ComboBox</param> private void cbPerson_DropDownClosed(object sender, EventArgs e) { //Reset GUI lCount.Content = ""; bSearch.IsEnabled = false; bPrint.IsEnabled = false; displayedDataPage.resetAll(); dGAnyStatistics.ItemsSource = null; //Clear Comboboxes before refilling cbOther.Items.Clear(); foreach (ComboBox cb in displayedDataComboBoxes) { cb.Items.Clear(); } //Clear WrapPanel DynamicContent if (wPDynamicContent.Count != 0) { removeWPDynamicContent(); } //Fill cbOther and update displayaedDataComboBoxes switch (cbPerson.Text) { case "Sponsoren": foreach (FundingType type in FundingType.GetFundingTypes()) { cbOther.Items.Add(type.Name); } displayedDataPage.setDisplayableData(displayableDataSponsor); break; case "Ausweisinhaber": foreach (string item in attributesPassHolder) { cbOther.Items.Add(item); } cbOther.Width = 210; displayedDataPage.setDisplayableData(displayableDataPassHolder); break; case "Kinder": foreach (string item in attributesChildren) { cbOther.Items.Add(item); } cbOther.Width = 210; displayedDataPage.setDisplayableData(displayableDataChildren); break; default: foreach (string item in attributesPartnersAll) { cbOther.Items.Add(item); } cbOther.Width = 210; displayedDataPage.setDisplayableData(displayableDataPartnersAll); break; } if (!String.IsNullOrEmpty(cbPerson.Text)) { cbOther.IsEnabled = true; } }
public ActionResult Import() { List <Project> projects = context.Projects.ToList(); if (projects.Count == 0) { string filePath = AppDomain.CurrentDomain.BaseDirectory + "\\kyfprojects.xls"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""); int projectCount = 0; try { conn.Open(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Updated KYF Projects$]", conn); OleDbDataReader rdr = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rdr); foreach (DataRow row in dt.Rows) { string name = row["Program Name"].ToString().Trim(); Program program = context.Programs.FirstOrDefault(p => p.Name == name); if (program == null) { program = new Program { Name = row["Program Name"].ToString().Trim(), Abbreviation = row["Program Abbreviation"].ToString().Trim() }; context.Programs.Add(program); } name = row["USDA Agency"].ToString().Trim(); Agency agency = context.Agencies.FirstOrDefault(a => a.Name == name); if (agency == null) { agency = new Agency { Name = row["USDA Agency"].ToString().Trim() }; context.Agencies.Add(agency); } name = row["USDA Mission Area"].ToString().Trim(); MissionArea missionArea = context.MissionAreas.FirstOrDefault(m => m.Name == name); if (missionArea == null) { missionArea = new MissionArea { Name = row["USDA Mission Area"].ToString().Trim() }; context.MissionAreas.Add(missionArea); } string description = row["Recipient Type"].ToString().Trim(); RecipientType recipientType = context.RecipientTypes.FirstOrDefault(r => r.Description == description); if (recipientType == null) { recipientType = new RecipientType { Description = row["Recipient Type"].ToString().Trim() }; context.RecipientTypes.Add(recipientType); } description = row["Funding Type"].ToString().Trim(); FundingType fundingType = context.FundingTypes.FirstOrDefault(f => f.Description == description); if (fundingType == null) { fundingType = new FundingType { Description = row["Funding Type"].ToString().Trim() }; context.FundingTypes.Add(fundingType); } Topic topicA = null; if (row["Topic_A"].ToString().Trim().Length > 0) { description = row["Topic_A"].ToString().Trim(); topicA = context.Topics.FirstOrDefault(t => t.Description == description); if (topicA == null) { topicA = new Topic { Description = row["Topic_A"].ToString().Trim() }; context.Topics.Add(topicA); } } Topic topicB = null; if (row["Topic_B"].ToString().Trim().Length > 0) { description = row["Topic_B"].ToString().Trim(); topicB = context.Topics.FirstOrDefault(t => t.Description == description); if (topicB == null) { topicB = new Topic { Description = row["Topic_B"].ToString().Trim() }; context.Topics.Add(topicB); } } Topic topicC = null; if (row["Topic_C"].ToString().Trim().Length > 0) { description = row["Topic_C"].ToString().Trim(); topicC = context.Topics.FirstOrDefault(t => t.Description == description); if (topicC == null) { topicC = new Topic { Description = row["Topic_C"].ToString().Trim() }; context.Topics.Add(topicC); } } context.SaveChanges(); Project project = new Project(); project.Title = row["Project Title"].ToString().Trim(); project.Program = program; project.Year = int.Parse(row["Year"].ToString().Trim()); project.State = row["State"].ToString().Trim(); project.Town = row["Town"].ToString().Trim(); project.Zip = row["Zip"].ToString().Trim(); project.Agency = agency; project.MissionArea = missionArea; project.Recipient = row["Recipient"].ToString().Trim(); project.RecipientType = recipientType; project.FundingAmount = (row["Funding Amount ($)"].ToString().Trim().Length > 0) ? decimal.Parse(row["Funding Amount ($)"].ToString().Trim()) : 0; project.FundingType = fundingType; project.Description = row["Description"].ToString().Trim(); project.MoreInfoURL = row["More Information"].ToString().Trim(); if (topicA != null) { project.TopicAID = topicA.TopicID; } if (topicB != null) { project.TopicBID = topicB.TopicID; } if (topicC != null) { project.TopicCID = topicC.TopicID; } context.Projects.Add(project); context.SaveChanges(); projectCount++; } ViewBag.Result = String.Format("{0} Projects imported successfully!", projectCount); } catch (Exception ex) { ViewBag.Result = String.Format("There was an error importing the projects.<br /><br />{0} projects imported.<br /><br />{1}", projectCount, ex.Message); } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } } } else { ViewBag.Result = "Projects already imported."; } return(View()); }
/// <inheritdoc /> public async Task <WebCallResult <BitfinexOffer> > NewOfferAsync(string asset, decimal quantity, decimal price, int period, FundingType direction, CancellationToken ct = default) { asset.ValidateNotNull(nameof(asset)); var parameters = new Dictionary <string, object> { { "currency", asset }, { "amount", quantity.ToString(CultureInfo.InvariantCulture) }, { "rate", price.ToString(CultureInfo.InvariantCulture) }, { "period", period }, { "direction", JsonConvert.SerializeObject(direction, new FundingTypeConverter(false)) }, }; return(await _baseClient.SendRequestAsync <BitfinexOffer>(_baseClient.GetUrl(NewOfferEndpoint, "1"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false)); }
public Funding(FundingType type, int amount, int durationInMonths) { this.FundingType = type; this.Amount = amount; this.DurationInMonths = durationInMonths <= 0 ? 1 : durationInMonths; }
private void cbPerson_DropDownClosed(object sender, EventArgs e) { //Clear Comboboxes before refilling cbOther.Items.Clear(); foreach (ComboBox cb in displayedDataComboBoxes) { cb.Items.Clear(); } //Clear WrapPanel DynamicContent if (wPDynamicContent.Count != 0) { removeWPDynamicContent(); } //Fill cbOther and update displayaedDataComboBoxes switch (cbPerson.Text) { case "Sponsoren": ComboBox cBSponsor = wPAddComboBox(); cBSponsor.Width = 130; foreach (FundingType type in FundingType.GetFundingTypes()) { cBSponsor.Items.Add(type.Name); } addItemsToComboBoxes(displayableDataSponsor, displayedDataComboBoxes); break; case "Ausweisinhaber": foreach (string item in cbOtherItemsPassHolder) { cbOther.Items.Add(item); } cbOther.Width = 210; addItemsToComboBoxes(displayableDataPassHolder, displayedDataComboBoxes); break; case "Kinder": foreach (string item in cbOtherItemsChildren) { cbOther.Items.Add(item); } cbOther.Width = 210; addItemsToComboBoxes(displayableDataChildren, displayedDataComboBoxes); break; default: foreach (string item in cbOtherItemsPartnersAll) { cbOther.Items.Add(item); } cbOther.Width = 210; addItemsToComboBoxes(displayableDataPartnersAll, displayedDataComboBoxes); break; } if (cbPerson.Text != "") { cbOther.IsEnabled = true; } }