Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //instantiate a new instance of account service
                accountService = new AccountantService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());
                //instantiate a new instance of district service
                districtService = new DistrictService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

                if (!IsPostBack)
                {
                    //if query string is not null then process else return to home page
                    if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
                    {
                        //get user from account service using query string id
                        var user = accountService.getUserById(new Guid(Request.QueryString["Id"]));

                        //data bind ui with user details
                        txtUser.Text     = user.Name;
                        txtDistrict.Text = districtService.GetDistrictById(user.DistrictId).Name;
                    }
                    else
                    {
                        Response.Redirect("~/Accountant/Welcome.aspx", false);
                    }
                }
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx", true);
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //instantiate a new instance of accountant Service
                accountantService = new AccountantService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());

                if (!String.IsNullOrEmpty(Request.QueryString["Name"]))
                {
                    //get report type from query string
                    ReportType reportType = (ReportType)Enum.Parse(typeof(ReportType), Request.QueryString["Name"].ToString());
                    var        report     = new List <ReportRow>();

                    //get report rows from accountant service
                    //format average to 2 place decimal
                    if (reportType == ReportType.AverageCostByEngineer)
                    {
                        report = accountantService.printAverageCostByEngineer().ToList();
                        foreach (var reportrow in report)
                        {
                            reportrow.Hours = decimal.Round(reportrow.Hours, 2, MidpointRounding.AwayFromZero);
                            reportrow.Costs = decimal.Round(reportrow.Costs, 2, MidpointRounding.AwayFromZero);
                        }
                    }
                    //if report is monthly cost by district redirect to monthly report page
                    else if (reportType == ReportType.MonthlyCostByDistrict)
                    {
                        Response.Redirect("~/Accountant/MonthlyReport.aspx", false);
                    }
                    else if (reportType == ReportType.TotalCostByDistrict)
                    {
                        report = accountantService.printTotalCostByDistrict().ToList();
                    }
                    else if (reportType == ReportType.TotalCostByEngineer)
                    {
                        report = accountantService.printTotalCostByEngineer().ToList();
                    }

                    //Data bind report row with UI

                    ReportListView.DataSource = report;
                    ReportListView.DataBind();
                }
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx", true);
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //instantiate a new instance of accountant service
                accountantService = new AccountantService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, User.Identity.GetUserId());

                //get a list of engineers using accountant service
                //data bind the engineers details with ui
                EngineerListView.DataSource = accountantService.getAllSiteEngineer();
                EngineerListView.DataBind();

                //get a list of manager using accountant service
                //data bind the manager details with ui
                ManagerListView.DataSource = accountantService.getAllManger();
                ManagerListView.DataBind();
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx");
            }
        }
 public AccountantController(IAccountantService accountantService)
 {
     _accountantService = accountantService ?? throw new ArgumentNullException(nameof(accountantService));
 }
 public NormalEmployeeFacade(ISalesmanService salesmanService, IAccountantService accountantService)
 {
     _salesmanService   = salesmanService;
     _accountantService = accountantService;
 }
Пример #6
0
 public GetBalanceCommandHandler(IServiceProvider serviceProvider)
 {
     _userService          = serviceProvider.GetRequiredService <IUserService>();
     _sourceAdapterFactory = serviceProvider.GetRequiredService <ISourceAdapterFactory>();
     _accountantService    = serviceProvider.GetRequiredService <IAccountantService>();
 }
Пример #7
0
 public AccountantController(IAccountantService accountant)
 {
     this.accountant = accountant;
 }
Пример #8
0
 public HomeController(ILogger <HomeController> logger, IAccountantService accountantService)
 {
     _accountantService = accountantService;
     _logger            = logger;
 }