public RevenueApprovalStatus?MoveWorkflowAll(DateTime month, string propertyCode, RevenueApprovalStatus state, int direction) { try { // Stored procedure for bulk update is a lot faster var user = ClaimProvider.GetFriendlyName(_context); var nextState = direction >= 0 ? NextState(state) : PrevState(state); DateTime startDate = new DateTime(month.Year, month.Month, 1); DateTime endDate = new DateTime(month.Year, month.Month, DateTime.DaysInMonth(month.Year, month.Month)); SqlParameter[] sqlParams = new SqlParameter[5]; sqlParams[0] = new SqlParameter("@StartDate", SqlDbType.DateTime); sqlParams[0].Value = startDate; sqlParams[1] = new SqlParameter("@EndDate", SqlDbType.DateTime); sqlParams[1].Value = endDate; sqlParams[2] = new SqlParameter("@PropertyCode", SqlDbType.NVarChar); sqlParams[2].Value = propertyCode; sqlParams[3] = new SqlParameter("@State", SqlDbType.Int); sqlParams[3].Value = direction >= 0 ? state : nextState; sqlParams[4] = new SqlParameter("@User", SqlDbType.NVarChar); sqlParams[4].Value = user; var result = _context.Database.SqlQuery <SqlResult>("UpdateAllReservationWorkflowStates @StartDate, @EndDate, @PropertyCode, @State, @User", sqlParams).FirstOrDefault(); return(result.Count > 0 ? nextState : null); } catch { throw; } }
private void RetrackWorkflowSignature(Reservation reservation, RevenueApprovalStatus state) { var userName = ClaimProvider.GetFriendlyName(_context); switch (state) { case RevenueApprovalStatus.Reviewed: reservation.ReviewedBy = null; reservation.ReviewedDate = null; break; case RevenueApprovalStatus.Approved: reservation.ApprovedBy = null; reservation.ApprovedDate = null; break; } }
private void SetWorkflowSignature(Reservation reservation, RevenueApprovalStatus state) { var userName = ClaimProvider.GetFriendlyName(_context); switch (state) { case RevenueApprovalStatus.Reviewed: reservation.ReviewedBy = userName; reservation.ReviewedDate = DateTime.Now.ToUniversalTime(); break; case RevenueApprovalStatus.Approved: reservation.ApprovedBy = userName; reservation.ApprovedDate = DateTime.Now.ToUniversalTime(); break; } }
private void RetrackWorkflowSignature(Expense entity, RevenueApprovalStatus state) { var userName = ClaimProvider.GetFriendlyName(_context); switch (state) { case RevenueApprovalStatus.Reviewed: entity.ReviewedBy = null; entity.ReviewedDate = null; break; case RevenueApprovalStatus.Approved: entity.ApprovedBy = null; entity.ApprovedDate = null; break; } }
private void SetWorkflowSignature(ref OtherRevenue entity, RevenueApprovalStatus state) { var userName = ClaimProvider.GetFriendlyName(_context); switch (state) { case RevenueApprovalStatus.Reviewed: entity.ReviewedBy = userName; entity.ReviewedDate = DateTime.Now.ToUniversalTime(); break; case RevenueApprovalStatus.Approved: entity.ApprovedBy = userName; entity.ApprovedDate = DateTime.Now.ToUniversalTime(); break; } }