/// <summary> /// Creates a new project under the authenticated account. Makes both a POST and a GET request to the Projects resource. /// </summary> /// <param name="name">The project name</param> /// <param name="clientId">The client to whom the project belongs</param> /// <param name="active">The status of the project</param> /// <param name="billBy">The invoicing method for the project</param> /// <param name="code">The project code</param> /// <param name="notes">Notes about the project</param> /// <param name="budgetBy">The budgeting method for the project</param> /// <param name="budget">The budget of the project</param> public Project CreateProject(string name, long clientId, bool active = true, BillingMethod billBy = BillingMethod.None, string code = null, string notes = null, BudgetMethod budgetBy = BudgetMethod.None, decimal?budget = null) { var options = GetCreateProjectOptions(name, clientId, active, billBy, code, notes, budgetBy, budget); return(CreateProject(options)); }
/// <summary> /// Creates a new project under the authenticated account. Makes both a POST and a GET request to the Projects resource. /// </summary> /// <param name="name">The project name</param> /// <param name="clientId">The client to whom the project belongs</param> /// <param name="active">The status of the project</param> /// <param name="billBy">The invoicing method for the project</param> /// <param name="code">The project code</param> /// <param name="notes">Notes about the project</param> /// <param name="budgetBy">The budgeting method for the project</param> /// <param name="budget">The budget of the project</param> public Project CreateProject(string name, long clientId, bool active = true, BillingMethod billBy = BillingMethod.None, string code = null, string notes = null, BudgetMethod budgetBy = BudgetMethod.None, decimal? budget = null) { if (name == null) throw new ArgumentNullException("name"); var options = new ProjectOptions() { ClientId = clientId, Name = name, Code = code, Active = active, BillBy = billBy, Notes = notes, BudgetBy = budgetBy, Budget = budget }; return CreateProject(options); }
private ProjectOptions CreateProjectOptions(string name, long clientId, bool active = true, BillingMethod billBy = BillingMethod.None, string code = null, string notes = null, BudgetMethod budgetBy = BudgetMethod.None, decimal?budget = null) { if (name == null) { throw new ArgumentNullException(nameof(name)); } return(new ProjectOptions() { ClientId = clientId, Name = name, Code = code, Active = active, BillBy = billBy, Notes = notes, BudgetBy = budgetBy, Budget = budget }); }
private void AddBillingMethod(BillingMethod billingMethod) { String paymentMethod; UserControl billingMethodUC; if (billingMethod.PaymentMethodId == 1) { paymentMethod = "Credit Card"; billingMethodUC = new CreditCardUserControl( billingMethod, m_Customer.Addresses); } else { paymentMethod = "Net Term"; billingMethodUC = new NetTermUserControl(billingMethod); } TabPage tabPage = new TabPage(paymentMethod); tabPage.Controls.Add(billingMethodUC); m_BillingMethodTabControl.TabPages.Add(tabPage); }
private void AddBillingMethodXml(BillingMethod billingMethod, XmlWriter writer) { writer.WriteStartElement("billingMethod"); writer.WriteAttributeString("billingMethodId", billingMethod.BillingMethodId.ToString()); writer.WriteAttributeString("paymentMethodId", billingMethod.PaymentMethodId.ToString()); if (billingMethod.PaymentMethodId == 1) { writer.WriteAttributeString("creditCardNumber", billingMethod.CreditCardNumber); writer.WriteAttributeString("creditCardExpiration", billingMethod.CreditCardExpiration.Value.ToShortDateString()); writer.WriteAttributeString("creditCardBillingAddressId", billingMethod.CreditCardBillingAddressId.ToString()); } else { writer.WriteAttributeString("netTermDays", billingMethod.NetTermDays.Value.ToString()); } writer.WriteAttributeString("isActive", billingMethod.IsActive.ToString()); writer.WriteEndElement(); }
/// <summary> /// Creates a new project under the authenticated account. Makes both a POST and a GET request to the Projects resource. /// </summary> /// <param name="name">The project name</param> /// <param name="clientId">The client to whom the project belongs</param> /// <param name="active">The status of the project</param> /// <param name="billBy">The invoicing method for the project</param> /// <param name="code">The project code</param> /// <param name="notes">Notes about the project</param> /// <param name="budgetBy">The budgeting method for the project</param> /// <param name="budget">The budget of the project</param> public async Task <Project> CreateProjectAsync(string name, long clientId, bool active = true, BillingMethod billBy = BillingMethod.None, string code = null, string notes = null, BudgetMethod budgetBy = BudgetMethod.None, decimal?budget = null, CancellationToken cancellationToken = default(CancellationToken)) { return(await CreateProjectAsync(CreateProjectOptions(name, clientId, active, billBy, code, notes, budgetBy, budget), cancellationToken)); }
public Transaction CreateTransaction(Order order, TransactionType transactionType, BillingMethod billingMethod, double price, Transaction transactionReference = null) { throw new NotImplementedException(); }
private static ProjectOptions GetCreateProjectOptions(string name, long clientId, bool active, BillingMethod billBy, string code, string notes, BudgetMethod budgetBy, decimal?budget) { if (name == null) { throw new ArgumentNullException(nameof(name)); } var options = new ProjectOptions { ClientId = clientId, Name = name, Code = code, Active = active, BillBy = billBy, Notes = notes, BudgetBy = budgetBy, Budget = budget }; return(options); }
/// <summary> /// Update a project on the authenticated account. Makes a PUT and a GET request to the Projects resource. /// </summary> /// <param name="projectId">The ID of the project to update</param> /// <param name="name">The project name</param> /// <param name="clientId">The client to whom the project belongs</param> /// <param name="active">The status of the project</param> /// <param name="billBy">The invoicing method for the project</param> /// <param name="code">The project code</param> /// <param name="notes">Notes about the project</param> /// <param name="budgetBy">The budgeting method for the project</param> /// <param name="budget">The budget of the project</param> /// <param name="notifyWhenOverBudget">Whether to send a notification when project is over budget</param> /// <param name="overBudgetNotificationPercentage">Percentage at which to send over-budget notification</param> /// <param name="showBudgetToAll">Whether budget is visible to all users</param> /// <param name="estimateBy">The project estimating method</param> /// <param name="estimate">The project estimate</param> /// <param name="hourlyRate">The project hourly rate</param> /// <param name="costBudget">The project cost budget</param> /// <param name="costBudgetIncludeExpenses">Whether the cost budget includes expenses</param> public Project UpdateProject(long projectId, long clientId, string name = null, bool? billable = null, BillingMethod? billBy = null, string code = null, string notes = null, BudgetMethod? budgetBy = null, decimal? budget = null, bool? notifyWhenOverBudget = null, decimal? overBudgetNotificationPercentage = null, bool? showBudgetToAll = null, EstimateMethod? estimateBy = null, decimal? estimate = null, decimal? hourlyRate = null, decimal? costBudget = null, bool? costBudgetIncludeExpenses = null) { var options = new ProjectOptions() { ClientId = clientId, Name = name, Code = code, Notes = notes, BillBy = billBy, Billable = billable, BudgetBy = budgetBy, Budget = budget, NotifyWhenOverBudget = notifyWhenOverBudget, OverBudgetNotificationPercentage = overBudgetNotificationPercentage, ShowBudgetToAll = showBudgetToAll, EstimateBy = estimateBy, Estimate = estimate, HourlyRate = hourlyRate, CostBudget = costBudget, CostBudgetIncludeExpenses = costBudgetIncludeExpenses }; return UpdateProject(projectId, options); }
public CreditCardUserControl(BillingMethod billingMethod, Address[] addresses) { InitializeComponent(); m_BillingMethod = billingMethod; m_Addresses = addresses; }
public NetTermUserControl(BillingMethod billingMethod) { InitializeComponent(); m_BillingMethod = billingMethod; }
private BillingMethodList GetBillingMethodList(Int32 customerId) { BillingMethodList billingMethodList = new BillingMethodList(); DbCommand command = m_CustomerDb.GetStoredProcCommand("usp_BillingMethod_List"); m_CustomerDb.AddInParameter(command, "CustomerId", DbType.Int32); m_CustomerDb.SetParameterValue(command, "CustomerId", customerId); using (IDataReader reader = m_CustomerDb.ExecuteReader(command)) { BillingMethod billingMethod; Int32 billingMethodIdOrdinal = reader.GetOrdinal("BillingMethodId"); Int32 paymentMethodIdOrdinal = reader.GetOrdinal("PaymentMethodId"); Int32 netTermDaysOrdinal = reader.GetOrdinal("NetTermDays"); Int32 creditCardBillingAddressIdOrdinal = reader.GetOrdinal("CreditCardBillingAddressId"); Int32 creditCardExpirationOrdinal = reader.GetOrdinal("CreditCardExpiration"); Int32 creditCardNumberOrdinal = reader.GetOrdinal("CreditCardNumber"); while (reader.Read()) { if (!reader.IsDBNull(billingMethodIdOrdinal) && !reader.IsDBNull(paymentMethodIdOrdinal)) { billingMethod = new BillingMethod(); billingMethod.CustomerId = customerId; billingMethod.BillingMethodId = reader.GetInt32(billingMethodIdOrdinal); billingMethod.PaymentMethodId = reader.GetInt32(paymentMethodIdOrdinal); if (!reader.IsDBNull(netTermDaysOrdinal)) { billingMethod.NetTermDays = reader.GetInt32(netTermDaysOrdinal); } else { billingMethod.NetTermDays = null; } if (!reader.IsDBNull(creditCardBillingAddressIdOrdinal)) { billingMethod.CreditCardBillingAddressId = reader.GetInt32(creditCardBillingAddressIdOrdinal); } else { billingMethod.CreditCardBillingAddressId = null; } if (!reader.IsDBNull(creditCardExpirationOrdinal)) { billingMethod.CreditCardExpiration = reader.GetDateTime(creditCardExpirationOrdinal); } else { billingMethod.CreditCardExpiration = null; } if (!reader.IsDBNull(creditCardNumberOrdinal)) { billingMethod.CreditCardNumber = reader.GetString(creditCardNumberOrdinal); } else { billingMethod.CreditCardNumber = null; } billingMethod.IsActive = true; billingMethodList.Add(billingMethod); } } } return(billingMethodList); }