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; }
public int Insert(string Username, int Periodaccountid, int Perdiemcount, bool IsDeleted, DateTime?CreatedOn, string CreatedBy, DateTime?ModifiedOn, string ModifiedBy, double Mileageclaimed, int Rategroupid) { Timesheet item = new Timesheet(); item.Username = Username; item.Periodaccountid = Periodaccountid; item.Perdiemcount = Perdiemcount; item.IsDeleted = IsDeleted; item.CreatedOn = CreatedOn; item.CreatedBy = CreatedBy; item.ModifiedOn = ModifiedOn; item.ModifiedBy = ModifiedBy; item.Mileageclaimed = Mileageclaimed; item.Rategroupid = Rategroupid; item.Save(UserName); return(item.Id); }
public void UpdateMileage(int Id, double MileageClaimed) { Timesheet item = FetchByID(Id)[0]; item.Mileageclaimed = MileageClaimed; item.MarkOld(); item.Save(UserName); }
public void UpdatePerDiemCount(int Id, int Perdiemcount) { Timesheet item = FetchByID(Id)[0]; item.Perdiemcount = Perdiemcount; item.MarkOld(); item.Save(UserName); }
public void UpdateRateGroup(int id, int rateGroupId) { Timesheet item = FetchByID(id)[0]; item.Rategroupid = rateGroupId; item.MarkOld(); item.Save(UserName); }
public bool Destroy(object Id) { return(Timesheet.Destroy(Id) == 1); }
public bool Delete(object Id) { return(Timesheet.Delete(Id) == 1); }