private void ApproveSingleAdj(int AdjID) { using (AdjustmentVoucherManager avm = new AdjustmentVoucherManager()) { AdjustmentVoucherTransaction tran = avm.GetAdjustmentVoucherTransactionByID(AdjID); SA33.Team12.SSIS.DAL.AdjustmentVoucher voucher = new SA33.Team12.SSIS.DAL.AdjustmentVoucher(); voucher.CreatedBy = tran.CreatedBy; voucher.ApprovedByUser = Utilities.Membership.LoggedInuser; voucher.DateApproved = DateTime.Now; voucher.DateIssued = tran.DateIssued; voucher.VoucherNumber = tran.VoucherNumber; avm.DeleteAdjustmentVoucherTransaction(tran); foreach (StockLogTransaction logTran in tran.StockLogTransactions) { StockLog log = new StockLog(); log.AdjustmentVoucher = voucher; log.Balance = logTran.Balance; log.Quantity = logTran.Quantity; log.Reason = logTran.Reason; log.StationeryID = logTran.StationeryID; log.Type = logTran.Type; log.Price = logTran.Price; avm.CreateStockLog(log); avm.DeleteStockLogTransaction(logTran); } avm.CreateAdjustmentVoucher(voucher); // UtilityFunctions.SendEmail(voucher.AdjustmentVoucherID + " - Your adjustment voucher has been approved", "Dear " + voucher.CreatedByUser.FirstName + "<br />" + "Your request has been approved.", voucher.ApprovedByUser); } }
private void RejectSingleAdj(int AdjID) { using (AdjustmentVoucherManager avm = new AdjustmentVoucherManager()) { AdjustmentVoucherTransaction tran = avm.GetAdjustmentVoucherTransactionByID(AdjID); avm.DeleteAdjustmentVoucherTransaction(tran); foreach (StockLogTransaction logTran in tran.StockLogTransactions) { avm.DeleteStockLogTransaction(logTran); } //using (UserManager um = new UserManager()) //{ // User u = um.GetUserByID(tran.CreatedBy); // UtilityFunctions.SendEmail("Voucher Number " + tran.VoucherNumber + " has been Rejected", "Dear " // + u.UserName + "<br />" + "Your adjustment Voucher has been Rejected. Reason:" + "<br />" + txtReason.Text, u); //} } Response.Redirect("~/Stock/ApproveAdjustmentVoucher.aspx"); }