Esempio n. 1
0
        /// <summary>
        /// Creates a new project under the authenticated account. Makes a POST and a GET request to the Projects resource.
        /// </summary>
        /// <param name="options">The options for the new Project to be created</param>
        public Project CreateProject(ProjectOptions options)
        {
            var request = Request("projects", RestSharp.Method.POST);

            request.AddBody(options);            

            return Execute<Project>(request);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <summary>
        /// Updates a project on the authenticated account. Makes a PUT and a GET request to the Projects resource.
        /// </summary>
        /// <param name="projectId">The ID for the project to update</param>
        /// <param name="options">The options to be updated</param>
        public Project UpdateProject(long projectId, ProjectOptions options)
        {
            var request = Request("projects/" + projectId, RestSharp.Method.PUT);

            request.AddBody(options);

            return Execute<Project>(request);
        }
Esempio n. 4
0
 /// <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);
 }