protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
        {
            LinkButton LBtnRequestId  = (e.Row.FindControl("LBtnRequestId") as LinkButton);
            LinkButton LBtnVoucherId  = (e.Row.FindControl("LBtnVoucherId") as LinkButton);
            Label      LblProcessDate = (e.Row.FindControl("LblProcessDate") as Label);

            if (e.Row.RowType == DataControlRowType.DataRow && ((AVRequest)e.Row.DataItem).Status == "Approved")
            {
                AVRequest avR = (AVRequest)e.Row.DataItem;
                LBtnRequestId.Visible = false;
                LBtnVoucherId.Visible = true;
                LBtnVoucherId.Text    = "AV" + InventoryLogic.GetAdjustmentVoucherApproveID(avR.AVRID).ToString("0000");
            }
            if (e.Row.RowType == DataControlRowType.DataRow && ((AVRequest)e.Row.DataItem).DateProcessed != null)
            {
                AVRequest avR           = (AVRequest)e.Row.DataItem;
                DateTime  processedDate = (DateTime)((AVRequest)e.Row.DataItem).DateProcessed;
                LblProcessDate.Text = processedDate.ToString("d");
            }
        }
        protected void RequestOrProcessedView(AVRequest aVRequest)
        {
            DateTime dateReq = (DateTime)aVRequest.DateRequested;

            LblDateReq.Text = dateReq.ToString("d");
            LblReqBy.Text   = aVRequest.RequestedBy;
            LblStatus.Text  = aVRequest.Status;
            switch (aVRequest.Status)
            {
            case ("Approved"):
            {
                LblPageTitle.Text      = "Inventory Adjustment Voucher";
                LblRequestIDLabel.Text = "Inventory Adjustment Voucher ID: ";
                LblRequestID.Text      = "AV" + InventoryLogic.GetAdjustmentVoucherApproveID(aVRequest.AVRID).ToString("0000");
                LblHandledBy.Text      = aVRequest.HandledBy;
                LblRemarks.Text        = aVRequest.Remarks;
                LblRmk.Visible         = true;
                LblRemarks.Visible     = true;
                DateTime dateProcessed = (DateTime)aVRequest.DateProcessed;
                LblDateProcessed.Text = dateProcessed.ToString("d");
                break;
            }

            case ("Rejected"):
            {
                LblPageTitle.Text      = "Inventory Adjustment Voucher Request";
                LblRequestIDLabel.Text = "Inventory Adjustment Voucher Request ID: ";
                LblRequestID.Text      = "AVR" + aVRequest.AVRID.ToString("0000");
                LblHandledBy.Text      = aVRequest.HandledBy;
                LblRemarks.Text        = aVRequest.Remarks;
                LblRmk.Visible         = true;
                LblRemarks.Visible     = true;
                DateTime dateProcessed = (DateTime)aVRequest.DateProcessed;
                LblDateProcessed.Text = dateProcessed.ToString("d");
                break;
            }

            case ("Cancelled"):
            {
                LblPageTitle.Text             = "Inventory Adjustment Voucher Request";
                LblRequestIDLabel.Text        = "Inventory Adjustment Voucher Request ID: ";
                LblRequestID.Text             = "AVR" + aVRequest.AVRID.ToString("0000");
                LblHandledByLabel.Visible     = false;
                LblHandledBy.Visible          = false;
                LblDateProcessedLabel.Visible = false;
                LblDateProcessed.Visible      = false;
                BtnCancelReq.Visible          = false;
                break;
            }

            default:
            {
                LblPageTitle.Text             = "Inventory Adjustment Voucher Request";
                LblRequestIDLabel.Text        = "Inventory Adjustment Voucher Request ID: ";
                LblRequestID.Text             = "AVR" + aVRequest.AVRID.ToString("0000");
                LblHandledByLabel.Visible     = false;
                LblHandledBy.Visible          = false;
                LblDateProcessedLabel.Visible = false;
                LblDateProcessed.Visible      = false;
                LblRmk.Visible       = false;
                LblRemarks.Visible   = false;
                BtnCancelReq.Visible = true;
                break;
            }
            }
        }
예제 #3
0
//-------------------Changing the view according the the adjustment voucher request.----------------------------------//
        protected void statusView(AVRequest aVRequest)
        {
            DateTime dateReq = (DateTime)aVRequest.DateRequested;

            LblDateReqD.Text = dateReq.ToString("d");
            LblReqByD.Text   = aVRequest.RequestedBy;
            LblStatusD.Text  = aVRequest.Status;
            switch (aVRequest.Status)
            {
            case ("Approved"):
            {
                LblReqID.Text      = "Inventory Adjustment Voucher ID: ";
                LblRequestID.Text  = InventoryLogic.GetAdjustmentVoucherApproveID(aVRequest.AVRID).ToString();
                LblHandledByD.Text = aVRequest.HandledBy;
                DateTime dateProcessed = (DateTime)aVRequest.DateProcessed;
                LblDateProcessedD.Text = dateProcessed.ToString("d");
                Btnapprove.Visible     = false;
                Btnreject.Visible      = false;
                TxtRemarks.Visible     = false;
                LblRemarks.Visible     = false;
                LblMsg.Visible         = false;
                break;
            }

            case ("Rejected"):
            {
                LblReqID.Text      = "Inventory Adjustment Voucher Request ID: ";
                LblRequestID.Text  = aVRequest.AVRID.ToString();
                LblHandledByD.Text = aVRequest.HandledBy;
                DateTime dateProcessed = (DateTime)aVRequest.DateProcessed;
                LblDateProcessedD.Text = dateProcessed.ToString("d");
                Btnapprove.Visible     = false;
                Btnreject.Visible      = false;
                LblMsg.Visible         = false;
                TxtRemarks.Visible     = false;
                LblRemarks.Visible     = false;
                break;
            }

            case ("Cancelled"):
            {
                LblReqID.Text      = "Inventory Adjustment Voucher Request ID: ";
                LblRequestID.Text  = aVRequest.AVRID.ToString();
                LblHandledByD.Text = aVRequest.HandledBy;
                DateTime dateProcessed = (DateTime)aVRequest.DateProcessed;
                LblDateProcessedD.Text = dateProcessed.ToString("d");
                Btnapprove.Visible     = false;
                Btnreject.Visible      = false;
                LblMsg.Visible         = false;
                TxtRemarks.Visible     = false;
                LblRemarks.Visible     = false;
                break;
            }

            //------------------------------------If it is the case of pending there are two cases.
            //-------------Pending request need to handle by the user and request that hasn't to be handle by the user logged in
            case ("Pending"):
            {
                //---------checking weather the request is under the category of "For Approval.
                //----------------------------------------------If it is "Approve" or "Reject" button is visible----------------//
                if (((User.IsInRole("Supervisor") && (aVRequest.HandledBy == "Supervisor")) | ((User.IsInRole("Manager") && (aVRequest.HandledBy == "Manager")))))
                {
                    LblReqID.Text             = "Inventory Adjustment Voucher Request ID: ";
                    LblRequestID.Text         = aVRequest.AVRID.ToString();
                    LblHandledBy.Visible      = false;
                    LblHandledByD.Visible     = false;
                    LblDateProcessed.Visible  = false;
                    LblDateProcessedD.Visible = false;
                    Btnapprove.Visible        = true;
                    Btnreject.Visible         = true;
                    LblMsg.Visible            = false;

                    break;
                }
                else
                {
                    LblReqID.Text     = "Inventory Adjustment Voucher Request ID: ";
                    LblRequestID.Text = aVRequest.AVRID.ToString();

                    LblHandledBy.Visible      = false;
                    LblHandledByD.Visible     = false;
                    LblDateProcessed.Visible  = false;
                    LblDateProcessedD.Visible = false;
                    Btnapprove.Visible        = false;
                    Btnreject.Visible         = false;
                    TxtRemarks.Visible        = false;
                    LblRemarks.Visible        = false;
                    LblMsg.Visible            = false;
                    break;
                }
            }

            default:
            {
                LblReqID.Text             = "Inventory Adjustment Voucher Request ID: ";
                LblRequestID.Text         = aVRequest.AVRID.ToString();
                LblHandledBy.Visible      = false;
                LblHandledByD.Visible     = false;
                LblDateProcessed.Visible  = false;
                LblDateProcessedD.Visible = false;
                Btnapprove.Visible        = false;
                Btnreject.Visible         = false;
                TxtRemarks.Visible        = false;
                LblMsg.Visible            = false;
                break;
            }
            }
        }