Ejemplo n.º 1
0
 public TimesheetCollection FetchORCreateByUsernamePeriodID(String Username, Int32 PeriodAccountID)
 {
     TimesheetCollection col = FetchByUsernamePeriodID(Username, PeriodAccountID);
     var user = new UserController().ByUsername(Username);
     if (col.Count == 0 && user != null)
         Insert(Username, PeriodAccountID, user.Rategroup);
     return FetchByUsernamePeriodID(Username, PeriodAccountID);
 }
Ejemplo n.º 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);
        }