public void MoveToTimesheet(Int32 ExpenseEntryID, Int32 NewBillingPeriodAccountID, Int32 OldTimesheetID)
        {
            TimesheetController timesheetcontroller = new TimesheetController();
            Timesheet oldtimesheet = timesheetcontroller.FetchByID(OldTimesheetID)[0];
            String username = oldtimesheet.Username;

            if (!timesheetcontroller.TimesheetExists(username, NewBillingPeriodAccountID))
            {
                timesheetcontroller.Insert(username, NewBillingPeriodAccountID, oldtimesheet.Rategroupid);
            }

            TimesheetCollection col = new BillingPeriodAccountController().FetchByID(NewBillingPeriodAccountID)[0].Timesheets();
            foreach (Timesheet timesheet in col)
            {
                if (timesheet.Username.Equals(username))
                {
                    ExpenseEntry item = this.FetchByID(ExpenseEntryID)[0];
                    this.Update(item.Id, timesheet.Id, item.Expensedate, item.Cost, item.Expensedesc);
                    return;
                }
            }


            return;
        }
Example #2
0
        protected void lnkBtnStartUserTimesheet_OnClick(object sender, EventArgs e)
        {
            if (PeriodId <= 0)
                return;

            var accountId = int.Parse(drpDwnAccounts.SelectedValue);

            var billingPeriodController = new TFS.Intranet.Data.Billing.BillingPeriodAccountController();

            var periodaccountid = billingPeriodController.GetIdByPeriodIdAndAccountId(PeriodId, accountId);

            var username = drpDwnActiveUsers.SelectedValue;
            var user = new UserController().ByUsername(username);
            var timesheetId = new TFS.Intranet.Data.Billing.TimesheetController().Insert(username, periodaccountid, user.Rategroup);
            var period = TFS.Intranet.Data.Billing.BillingPeriod.FetchByID(PeriodId);

            var url = "/Billing/timecard.aspx?username={0}&id={1}&month={2}&year={3}";
            url = string.Format(url, username, timesheetId, period.Month, period.Year);

            Response.Redirect(url);
        }
Example #3
0
        protected void lnkBtnStartUserTimesheet_OnClick(object sender, EventArgs e)
        {
            if (PeriodId <= 0)
            {
                return;
            }

            var accountId = int.Parse(drpDwnAccounts.SelectedValue);

            var billingPeriodController = new TFS.Intranet.Data.Billing.BillingPeriodAccountController();

            var periodaccountid = billingPeriodController.GetIdByPeriodIdAndAccountId(PeriodId, accountId);

            var username    = drpDwnActiveUsers.SelectedValue;
            var user        = new UserController().ByUsername(username);
            var timesheetId = new TFS.Intranet.Data.Billing.TimesheetController().Insert(username, periodaccountid, user.Rategroup);
            var period      = TFS.Intranet.Data.Billing.BillingPeriod.FetchByID(PeriodId);

            var url = "/Billing/timecard.aspx?username={0}&id={1}&month={2}&year={3}";

            url = string.Format(url, username, timesheetId, period.Month, period.Year);

            Response.Redirect(url);
        }