BudgetService

Namespace: Google.AdWords
We found 10 examples in language CSharp for this search. You will see 22 fragments of code.

Other methods


        [HttpGet]
        public IEnumerable<BudgetEntry> Get(bool thisMonth = false)
        {
            if (thisMonth)
            {
                return this.budgetService.GetAll().Where(be => be.BudgetDate.Date.Year == DateTime.Now.Year && be.BudgetDate.Date.Month == DateTime.Now.Month);
            }
            else
            {
                return this.budgetService.GetAll().OrderBy(b => b.BudgetDate);
            }
        }

        [HttpPost]
        public BudgetEntry Post(BudgetEntry budgetEntry)
        {
            if (budgetEntry.Id == 0)
            {
                this.budgetService.Add(budgetEntry);
            }
            else
            {
                this.budgetService.Update(budgetEntry);
            }

            return budgetEntry;
        }

        [HttpDelete]
        public BudgetEntry Delete(int id)
        {
            return this.budgetService.Remove(id);
        }


        public ActionResult Index(int budgetId = 0, int budgetItemId = 0)
        {
            var username = User.Identity.Name;
            var vm = BudgetService.MapBudgetIndexViewModel(username);

            vm.SelectedBudgetId = budgetId;
            vm.SelectedBudgetItemId = budgetItemId;
            
            return View(vm);
        }

        private ActionResult AddBudgetReturnEditBudgetView(EditBudgetViewModel vm, bool isDone = false)
        {
            var username = User.Identity.Name;
            var budget = BudgetService.AddBudget(vm, username);

            ModelState.Clear();
            vm.Id = budget.Id;

            if (isDone)
                return RedirectToAction("Index", new {budgetId = budget.Id});

            return PartialView("EditBudget", vm);
        }

        public ActionResult AddBudgetItem()
        {
            var username = User.Identity.Name;
            var vm = BudgetService.MapEditBudgetItemViewModelForAdd(username);

            ViewBag.Title = "Add Budget Item";

            return PartialView("EditBudgetItem", vm);
        }

        public ActionResult AddBudgetItemTransaction(int id)
        {
            var username = User.Identity.Name;

            var vm = BudgetService.MapEditBudgetItemTransactionViewModelForAdd(username, id);

            if (vm == null)
                return View("Error");

            ViewBag.Title = "Add Budget Item Transaction";

            return PartialView("EditBudgetItemTransaction", vm);
        }

        public ActionResult LoadBudgetDetails(int id)
        {
            var vm = BudgetService.MapBudgetDetailsViewModel(id);

            return PartialView("BudgetDetails", vm);
        }

        public ActionResult LoadBudgetItemTransactions(int id)
        {
            var vm = BudgetService.MapBudgetItemTransactionViewModel(id);

            return PartialView("BudgetItemTransactions", vm);
        }


        [Fact]
        public void BudgetIsCreatedSuccessfully()
        {

            budgetService.CreateBudget(budgetRequest);

            Budget budget = budgetService.GetCurrentBudget();
            Assert.NotNull(budget);
            Assert.Equal(budgetRequest.Amount, budget.Amount);
          
        }

        public ActionResult DeleteBudget(string BudgetId)
        {
            var bud = budgetService.GetById(Convert.ToInt32(BudgetId));
            bud.IsActive = false;
            bud.InActiveDate = DateTime.Now;
            budgetService.Update(bud);
            return RedirectToAction("Index");
        }

        public ActionResult Edit(int id)
        {
            var budget = budgetService.GetById(id);
            var budgetModel = Mapper.Map<Budget, BudgetViewModel>(budget);
            var acc = accChartService.GetById(budget.AccID);
            budgetModel.AccName = string.Format("{0} - {1}", acc.AccCode, acc.AccName);
            budgetModel.OfficeLevel = 1;// officeService.GetById(budget.OfficeID).OfficeLevel;
            return View(budgetModel);
        }


        [HttpGet("summary")]
        [ProducesResponseType(StatusCodes.Status401Unauthorized)]
        public ActionResult<BudgetSummary> GetBudgetSummary()
        {
            string loggedUser = User.FindFirstValue("userId");
            if (loggedUser == null)
            {
                return Unauthorized();
            }

            BudgetSummary budget = budgetService.GetBudgetSummary();
            return budget;

        }

        [HttpGet]
        [ProducesResponseType(StatusCodes.Status401Unauthorized)]
        public ActionResult<Budget> GetCurrentBudget()
        {
            string loggedUser = User.FindFirstValue("userId");
            if (loggedUser == null)
            {
                return Unauthorized();
            }

            Budget budget = budgetService.GetCurrentBudget();
            return budget;

        }


        [Fact]
        public void GetBudgetSummaryByIdIsSuccessful()
        {
            Budget budget = budgetService.CreateBudget(budgetRequest);

            var result = controller.GetBudgetSummaryById(budget.BudgetId);
            BudgetSummary resultValue = (BudgetSummary) result.Value;

            Assert.Equal(budget.BudgetId, resultValue.BudgetId);
            Assert.Equal(budget.Amount, resultValue.Amount);
           
        }


    // GET: api/<AccountController>
    [HttpGet]
    public IEnumerable<Account> Get() => budgetService.GetAllAccounts();

    // GET api/<AccountController>/5
    [HttpGet("{id}")]
    public Account? Get(int id) => budgetService.GetAccountById(id);

    [HttpGet("{id}/Categories")]
    public IEnumerable<Category> GetCategories(int id) => budgetService.GetCategoriesForAccount(id);


        public void OnGet() {
            CalculatedBudged = budgetService.CalcBudget();
        }


        [HttpPost]
        public ActionResult Add(BudgetAddViewModel model)
        {
            this.budgetService.Created += (sender, e) => { ViewBag.Message = "added successfully"; };
            this.budgetService.Updated += (sender, e) => { ViewBag.Message = "updated successfully"; };
            this.budgetService.Create(model);

            return View(model);
        }

        [HttpPost]
        public ActionResult Query(BudgetQueryViewModel model)
        {
            model.Amount =
                this.budgetService.TotalBudget(new Period(DateTime.Parse(model.StartDate), DateTime.Parse(model.EndDate)));

            return View(model);
        }


namespace Plutus
{
    public class Services
    {
        public FileManager FileManager { get; set; }
        public BudgetService BudgetService { get; set; }
        public CartService CartService { get; set; }
        public GoalService GoalService { get; set; }
        public HistoryService HistoryService { get; set; }
        public PaymentService PaymentService { get; set; }
        public ShoppingService ShoppingService { get; set; }
        public StatisticsService StatisticsService { get; set; }
        public VerificationService VerificationService { get; set; }
        public CurrentInfoHolder CurrentInfoHolder { get; set; }

        public Services(string path)
        {
            FileManager = new FileManager(path);
            BudgetService = new BudgetService(FileManager);
            CartService = new CartService(FileManager);
            GoalService = new GoalService(FileManager);
            HistoryService = new HistoryService(FileManager);
            PaymentService = new PaymentService(FileManager);
            ShoppingService = new ShoppingService();
            StatisticsService = new StatisticsService(FileManager);
            VerificationService = new VerificationService();
            CurrentInfoHolder = new CurrentInfoHolder();
        }
    }
}

Google.Api.Ads.AdWords.v201809.BudgetService : ICommunicationObject, IDisposable, AdsClient, IBudgetService, BudgetServiceInterface

Constructors :

public BudgetService()
public BudgetService(String endpointConfigurationName = )
public BudgetService(String endpointConfigurationName = , String remoteAddress = )
public BudgetService(String endpointConfigurationName = , EndpointAddress remoteAddress = )
public BudgetService(Binding binding = , EndpointAddress remoteAddress = )

Methods :

public BudgetPage get(Selector selector = )
public Task<BudgetPage> getAsync(Selector selector = )
public BudgetReturnValue mutate(BudgetOperation[] operations = )
public Task<BudgetReturnValue> mutateAsync(BudgetOperation[] operations = )
public BudgetPage query(String query1 = )
public Task<BudgetPage> queryAsync(String query = )
public RequestHeader get_RequestHeader()
public Void set_RequestHeader(RequestHeader value = )
public ResponseHeader get_ResponseHeader()
public Void set_ResponseHeader(ResponseHeader value = )
public Int32 get_Timeout()
public Void set_Timeout(Int32 value = )
public String get_Url()
public Void set_Url(String value = )
public Boolean get_EnableDecompression()
public Void set_EnableDecompression(Boolean value = )
public IWebProxy get_Proxy()
public Void set_Proxy(IWebProxy value = )
public String get_UserAgent()
public Void set_UserAgent(String value = )
public AdsUser get_User()
public Void set_User(AdsUser value = )
public ServiceSignature get_Signature()
public Void set_Signature(ServiceSignature value = )
public Void Dispose()
public ChannelFactory<IBudgetService> get_ChannelFactory()
public ClientCredentials get_ClientCredentials()
public CommunicationState get_State()
public IClientChannel get_InnerChannel()
public ServiceEndpoint get_Endpoint()
public Void Open()
public Void Abort()
public Void Close()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods