protected void btnSearchExpenses_Click(object sender, EventArgs e)
        {
            ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL();

            rptExpenseReport.DataSource = expenseReportDAL.GetExpenseReportsByConsultant((Guid)Membership.GetUser().ProviderUserKey, ddlSearchFilter.SelectedValue);
            rptExpenseReport.DataBind();
        }
 protected void btnSearchExpenses_Click(object sender, EventArgs e)
 {
     emp = (Employee)Session["emp"];
     ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL();
     rptExpenseReport.DataSource = expenseReportDAL.GetReportsByDepartment(emp.Dept.DepartmentId, ddlSearchFilter.SelectedValue);
     rptExpenseReport.DataBind();
 }
 public void ExpenseReportDAL_SupervisorActionOnExpenseReport_Reject_ActionSuccess()
 {
     using (TransactionScope testTransaction = new TransactionScope())
     {
         ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL();
         ExpenseReport expenseReport = new ExpenseReport();
         ExpenseItem item = new ExpenseItem();
         expenseReport.CreateDate = DateTime.Now;
         expenseReport.CreatedBy.UserId = new Guid("18b783f1-cb97-4e03-bb54-d3c41637b69c");
         expenseReport.CreatedBy.Dept.DepartmentId = 1;
         expenseReport.Status = ReportStatus.Submitted;
         item.ExpenseDate = DateTime.Now;
         item.Location = "London";
         item.Description = "AirTicket";
         item.Amount = 2000;
         item.Currency = "AUD";
         item.AudAmount = item.Amount;
         expenseReport.ExpenseItems.Add(item);
         string status = "RejectedBySupervisor";
         Guid approvedBy = new Guid("832e2e47-e82c-40be-9c39-8587274468fe");
         expenseReportDAL.ProcessExpense(expenseReport);
         Assert.IsTrue(CheckDatabaseForExpenseId(expenseReport.ExpenseId), "Expense Id was not found in database");
         expenseReportDAL.SupervisorActionOnExpenseReport(expenseReport.ExpenseId, approvedBy, status);
         testTransaction.Dispose();
      }
 }
        public void ExpenseReportDAL_ProcessExpense_InsertSuccess()
        {
            ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL();

            ExpenseReport expenseReport = new ExpenseReport();
            ExpenseItem item = new ExpenseItem();

            expenseReport.CreateDate = DateTime.Now;
            expenseReport.CreatedBy.UserId = new Guid("78560DD3-F95E-4011-B40D-A7B56ED17F24");
            expenseReport.CreatedBy.Dept.DepartmentId = 2;
            expenseReport.Status = ReportStatus.Submitted;

            item.ExpenseDate = DateTime.Now;
            item.Location = "Sydney";
            item.Description = "AirTicket";
            item.Amount = 2000;
            item.Currency = "AUD";
            item.AudAmount = item.Amount;

            expenseReport.ExpenseItems.Add(item);

            using (TransactionScope testTransaction = new TransactionScope())
            {
                expenseReportDAL.ProcessExpense(expenseReport);
                Assert.IsTrue(CheckDatabaseForExpenseId(expenseReport.ExpenseId), "Expense Id was not found in database");
                testTransaction.Dispose();
            }
        }
 public void ExpenseReportDAL_GetReportBySupervisor_StatusIsSubmitted_IsTrue()
 {
     using (TransactionScope testTransaction = new TransactionScope())
     {
         ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL();
         ExpenseReport expenseReport = new ExpenseReport();
         ExpenseItem item = new ExpenseItem();
         List<ExpenseReport> reports = new List<ExpenseReport>();
         int deptId = 1;
         string status = ReportStatus.Submitted.ToString();
         expenseReport.CreateDate = DateTime.Now;
         expenseReport.CreatedBy.UserId = new Guid("18b783f1-cb97-4e03-bb54-d3c41637b69c");
         expenseReport.ExpenseToDept.DepartmentId = 1;
         expenseReport.CreatedBy.Dept.DepartmentId = 1;
         expenseReport.Status = ReportStatus.Submitted;
         item.ExpenseDate = DateTime.Now;
         item.Location = "Sydney";
         item.Description = "AirTicket";
         item.Amount = 5000;
         item.Currency = "AUD";
         item.AudAmount = item.Amount;
         expenseReport.ExpenseItems.Add(item);
         expenseReportDAL.ProcessExpense(expenseReport);
         Assert.IsTrue(CheckDatabaseForExpenseId(expenseReport.ExpenseId), "Expense Id was not found in database");
         reports = expenseReportDAL.GetReportsByDepartment(deptId, status);
         Assert.IsTrue(reports.Count > 0, "No data in expense report");
         testTransaction.Dispose();
     }
 }
 public void ExpenseReportDAL_GetReportBySupervisor_StatusIsApprovedByAccounts_IsTrue()
 {
     using (TransactionScope testTransaction = new TransactionScope())
     {
         ExpenseReportDAL expenseReportDAL = new ExpenseReportDAL();
         ExpenseReport expenseReport = new ExpenseReport();
         ExpenseItem item = new ExpenseItem();
         List<ExpenseReport> reports = new List<ExpenseReport>();
         int deptId = 1;
         string status = ReportStatus.ApprovedByAccounts.ToString();
         expenseReport.CreateDate = DateTime.Now;
         expenseReport.CreatedBy.UserId = new Guid("78560dd3-f95e-4011-b40d-a7b56ed17f24");
         expenseReport.ExpenseToDept.DepartmentId = 1;
         expenseReport.CreatedBy.Dept.DepartmentId = 1;
         expenseReport.Status = ReportStatus.ApprovedByAccounts;
         item.ExpenseDate = DateTime.Now;
         item.Location = "Sydney";
         item.Description = "AirTicket";
         item.Amount = 5000;
         item.Currency = "AUD";
         item.AudAmount = item.Amount;
         expenseReport.ExpenseItems.Add(item);
         expenseReportDAL.ProcessExpense(expenseReport);
         reports = expenseReportDAL.GetReportsByDepartment(deptId, status);
         Assert.IsTrue(reports.Count > 0, "No data in expense report");
         testTransaction.Dispose();
     }
 }
 public ExpenseReportBuilder()
 {
     expenseReport = new ExpenseReport();
     expDAL = new ExpenseReportDAL();
 }