public IList <REQRequisitionItem_DetailedEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression, String filterExpression)
        {
            IList <REQRequisitionItem_DetailedEntity> rEQRequisitionItem_DetailedEntityList = new List <REQRequisitionItem_DetailedEntity>();

            try
            {
                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = REQRequisitionItem_DetailedEntity.FLD_NAME_RequisitionItemID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                Int32 currentPage = Convert.ToInt32(startRowIndex / pageSize) + 1;
                //startRowIndex = Convert.ToInt32(  startRowIndex / pageSize) + 1;

                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                rEQRequisitionItem_DetailedEntityList = FCCREQRequisitionItem_Detailed.GetFacadeCreate().GetIL(pageSize, currentPage, sortExpression, filterExpression);

                if (rEQRequisitionItem_DetailedEntityList != null && rEQRequisitionItem_DetailedEntityList.Count > 0)
                {
                    totalRowCount = rEQRequisitionItem_DetailedEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(rEQRequisitionItem_DetailedEntityList ?? new List <REQRequisitionItem_DetailedEntity>());
        }
Beispiel #2
0
        protected void lvREQRequisition_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem         = (ListViewDataItem)e.Item;
                REQRequisition_DetailedEntity ent = (REQRequisition_DetailedEntity)dataItem.DataItem;

                HyperLink hypRequisition     = (HyperLink)e.Item.FindControl("hypRequisition");
                Label     lblRequisitionItem = (Label)e.Item.FindControl("lblRequisitionItem");

                hypRequisition.NavigateUrl = UrlHelper.BuildSecureUrl("~/REQ/REQRequisitionItem.aspx", string.Empty, UrlConstants.OVERVIEW_PROJECT_ID, ent.ProjectID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionNo, ent.RequisitionNo.ToString()).ToString();

                String feReqItem = SqlExpressionBuilder.PrepareFilterExpression("REQRequisitionItem." + REQRequisitionItemEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), SQLMatchType.Equal);
                IList <REQRequisitionItem_DetailedEntity> lst = FCCREQRequisitionItem_Detailed.GetFacadeCreate().GetIL(100000, 1, String.Empty, feReqItem);

                if (lst != null && lst.Count > 0)
                {
                    foreach (REQRequisitionItem_DetailedEntity entREQRequisitionItem_DetailedEntity in lst)
                    {
                        lblRequisitionItem.Text += entREQRequisitionItem_DetailedEntity.MDItemItemName + ", ";
                    }

                    lblRequisitionItem.Text = lblRequisitionItem.Text.Substring(0, lblRequisitionItem.Text.Length - 2);
                }

                hypRequisition.Target = "_blank";
            }
        }
        private void SavePRMMaterialReceiveEntity()
        {
            if (IsValid)
            {
                try
                {
                    PRMMaterialReceiveEntity pRMMaterialReceiveEntity = BuildPRMMaterialReceiveEntity();

                    #region Requisition

                    String RequisitionNo = String.Empty;

                    if (txtRequisition.Text.IsNotNullOrEmpty())
                    {
                        RequisitionNo = "BL-" + txtRequisition.Text.ToString();
                    }

                    Int64 resultRequisition     = -1;
                    Int64 resultRequisitionItem = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionEntity.FLD_NAME_RequisitionNo, RequisitionNo, SQLMatchType.Equal);
                    IList <REQRequisitionEntity> lstRequisition = FCCREQRequisition.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                    REQRequisitionItemEntity rEQRequisitionItemEntity = null;

                    if (lstRequisition != null && lstRequisition.Count > 0)
                    {
                        rEQRequisitionItemEntity = BuildREQRequisitionItemEntity(lstRequisition[0].RequisitionID);
                        pRMMaterialReceiveEntity.RequisitionID = lstRequisition[0].RequisitionID;
                    }
                    else
                    {
                        REQRequisitionEntity rEQRequisitionEntity = BuildREQRequisitionEntity();
                        resultRequisition = FCCREQRequisition.GetFacadeCreate().Add(rEQRequisitionEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        pRMMaterialReceiveEntity.RequisitionID = resultRequisition;

                        if (resultRequisition > 0)
                        {
                            rEQRequisitionItemEntity = BuildREQRequisitionItemEntity(resultRequisition);
                        }
                    }

                    if (rEQRequisitionItemEntity != null)
                    {
                        resultRequisitionItem = FCCREQRequisitionItem.GetFacadeCreate().Add(rEQRequisitionItemEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }

                    #endregion

                    #region MRR

                    Int64 resultOne = -1;

                    if (pRMMaterialReceiveEntity.IsNew)
                    {
                        resultOne = FCCPRMMaterialReceive.GetFacadeCreate().Add(pRMMaterialReceiveEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMMaterialReceiveEntity.FLD_NAME_MaterialReceiveID, pRMMaterialReceiveEntity.MaterialReceiveID.ToString(), SQLMatchType.Equal);
                        resultOne = FCCPRMMaterialReceive.GetFacadeCreate().Update(pRMMaterialReceiveEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (resultOne > 0 && resultRequisitionItem > 0)
                    {
                        #region Material Receive Item Map

                        Int64 resultTwo = -1;

                        PRMMaterialReceiveItemMapEntity pRMMaterialReceiveItemMapEntity = BuildPRMMaterialReceiveItemMapEntity(resultOne, resultRequisitionItem);
                        resultTwo = FCCPRMMaterialReceiveItemMap.GetFacadeCreate().Add(pRMMaterialReceiveItemMapEntity, DatabaseOperationType.Add, TransactionRequired.No);

                        #endregion

                        try
                        {
                            #region Inventory

                            Int64 _employeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                            Int64 _projectID  = Int64.Parse(ddlProjectID.SelectedValue);

                            INVStoreEntity storeEntity = INVManager.GetDefaultStore(_projectID);
                            Int64          storeID     = storeEntity.StoreID;

                            INVStoreUnitEntity storeUnitEntity = INVManager.GetDefaultStoreUnit(storeID);
                            Int64 storeUnitID = storeUnitEntity.StoreUnitID;

                            String fe_requisitionItem = SqlExpressionBuilder.PrepareFilterExpression("REQRequisitionItem." + REQRequisitionItemEntity.FLD_NAME_RequisitionItemID, resultRequisitionItem.ToString(), SQLMatchType.Equal);
                            IList <REQRequisitionItem_DetailedEntity> lst = FCCREQRequisitionItem_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_requisitionItem);

                            Int64   _itemID   = 0;
                            Decimal _rate     = 0;
                            Int64   brandID   = MasterDataConstants.ItemDefaults.DEFAULT_BRAD;
                            Int64   regionID  = MasterDataConstants.ItemDefaults.DEFAULT_REGION;
                            Int64   countryID = MasterDataConstants.ItemDefaults.DEFAULT_COUNTRY;

                            if (lst != null && lst.Count > 0)
                            {
                                _itemID   = lst[0].ItemID;
                                brandID   = (Int64)lst[0].BrandID;
                                regionID  = (Int64)lst[0].RegionID;
                                countryID = (Int64)lst[0].CountryID;
                                _rate     = lst[0].Rate;
                            }

                            Boolean invResult = INVManager.AddItemsToStoreUnit(_itemID, brandID, regionID, countryID, "", Int64.Parse(txtReceiveQty.Text.ToString()), MiscUtil.GetLocalIP(), _employeeID, _rate, txtRequisition.Text, ddlWorkOrderID.SelectedItem.Text, resultOne.ToString(), "", Int64.Parse(ddlProjectID.SelectedValue), storeID, storeUnitID);

                            #endregion
                        }
                        catch (Exception ex)
                        {
                        }

                        _MaterialReceiveID = resultOne;
                        PrepareInitialViewSave();
                        btnAddNew.Visible = true;

                        if (pRMMaterialReceiveEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Material Receive Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Material Receive Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (pRMMaterialReceiveEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Material Receive Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Material Receive Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #4
0
        protected void lvAPMemberFeedback_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                APMemberFeedback_DetailedEntity ent = (APMemberFeedback_DetailedEntity)dataItem.DataItem;

                APApprovalProcessEntity aPApprovalProcessEntity = APRobot.GetApprovalProcessByID(ent.APApprovalProcessID);

                HyperLink lnkViewDetails        = (HyperLink)e.Item.FindControl("lnkViewDetails");
                HyperLink lnkShowApprovalStatus = (HyperLink)e.Item.FindControl("lnkShowApprovalStatus");
                Label     lblTitle      = (Label)e.Item.FindControl("lblTitle");
                Label     lblAPType     = (Label)e.Item.FindControl("lblAPType");
                Label     lblItemDetail = (Label)e.Item.FindControl("lblItemDetail");

                lblTitle.Text = aPApprovalProcessEntity.Title;

                if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.REQUISITION)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/REQ/REQRequisitionDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.REQUISITION_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    String feReqItem = SqlExpressionBuilder.PrepareFilterExpression("REQRequisitionItem." + REQRequisitionItemEntity.FLD_NAME_RequisitionID, aPApprovalProcessEntity.ReferenceID.ToString(), SQLMatchType.Equal);
                    IList <REQRequisitionItem_DetailedEntity> lst = FCCREQRequisitionItem_Detailed.GetFacadeCreate().GetIL(100000, 1, String.Empty, feReqItem);

                    lblAPType.Text = "Requisition";
                    if (lst != null && lst.Count > 0)
                    {
                        lblItemDetail.Text = "Items (";
                        foreach (REQRequisitionItem_DetailedEntity entREQRequisitionItem_DetailedEntity in lst)
                        {
                            lblItemDetail.Text += entREQRequisitionItem_DetailedEntity.MDItemItemName + ", ";
                        }
                        lblItemDetail.Text += ")";
                    }
                }
                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.WORK_ORDER)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/PRM/PRMWorkOrderViewWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_WORKORDER_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();
                    lblAPType.Text = "Work Order";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.BILL)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/CM/CMBillDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_CM_BILL_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();
                    lblAPType.Text = "Bill";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.PAYABLE_STATEMENT)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/ACC/ACCPostPayableStatementDetailWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_POST_PAYABLE_STATEMENT_DETAIL_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();
                    lblAPType.Text = "Payable Statement";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.TRF)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/INV/INVTransferItemDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_TRANSFER_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();
                    lblAPType.Text = "TRF";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.BANK_DEPOSIT)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/AC/ACBankAccountDepositDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_BANK_ACCOUNT_DEPOSIT_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    lblAPType.Text = "BANK DEPOSIT";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.BANK_PAYMENT)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/AC/ACBankAccountPaymentDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_BANK_ACCOUNT_PAYMENT_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    lblAPType.Text = "BANK PAYMENT";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.TEMPORARY_JOURNAL)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/AC/ACJournalDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_TEMPORARY_JOURNAL_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    lblAPType.Text = "JOURNAL ENTRY";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.BANK_ACCOUNT_TRANSFER)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/AC/ACBankAccountTransferDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_BANK_ACCOUNT_TRANSFER_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    lblAPType.Text = "BANK ACCOUNT TRANSFER";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.MRR)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/PRM/PRMMaterialReceiveDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_MATERIAL_RECEIVE_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    lblAPType.Text = "MATERIAL RECEIVE";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.AGREEMENT)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/CRM/CRMAgreementDetailsWithApproval.aspx",
                        string.Empty,
                        UrlConstants.OVERVIEW_AGREEMENT_ID,
                        aPApprovalProcessEntity.ReferenceID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                        ent.APMemberFeedbackID.ToString(),
                        APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                        ent.APApprovalProcessID.ToString()
                        ).ToString();

                    lblAPType.Text = "AGREEMENT";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.CONTACT_LIST)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl("~/BD/BDProcessAssignedResourceDetailsWithApproval.aspx",
                                                                          string.Empty,
                                                                          UrlConstants.OVERVIEW_PROCESS_ASSIGNED_RESOURCE_ID,
                                                                          aPApprovalProcessEntity.ReferenceID.ToString(),
                                                                          APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                                                                          ent.APMemberFeedbackID.ToString(),
                                                                          APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                                                                          ent.APApprovalProcessID.ToString()
                                                                          ).ToString();

                    lblAPType.Text = "CONTACT_LIST";
                }
                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.LOAN_APPLICATION)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl("~/HR/HREmployeeLoanApplicationDetailsWithApproval.aspx",
                                                                          string.Empty,
                                                                          UrlConstants.OVERVIEW_LOAN_APPLICATION_ID,
                                                                          aPApprovalProcessEntity.ReferenceID.ToString(),
                                                                          APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                                                                          ent.APMemberFeedbackID.ToString(),
                                                                          APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                                                                          ent.APApprovalProcessID.ToString()
                                                                          ).ToString();

                    lblAPType.Text = "LOAN_APPLICATION";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.LEAVE_APPLICATION)
                {
                    lnkViewDetails.NavigateUrl = UrlHelper.BuildSecureUrl("~/HR/HREmployeeLeaveApplicationWithApproval.aspx",
                                                                          string.Empty,
                                                                          UrlConstants.OVERVIEW_LEAVE_APPLICATION_ID,
                                                                          aPApprovalProcessEntity.ReferenceID.ToString(),
                                                                          APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID,
                                                                          ent.APMemberFeedbackID.ToString(),
                                                                          APMemberFeedbackEntity.FLD_NAME_APApprovalProcessID,
                                                                          ent.APApprovalProcessID.ToString()
                                                                          ).ToString();

                    lblAPType.Text = "LEAVE_APPLICATION";
                }

                else if (aPApprovalProcessEntity.APTypeID == MasterDataConstants.APType.CUSTOM)
                {
                    lnkViewDetails.NavigateUrl = "#";
                    lblAPType.Text             = "Custom";
                }

                lnkShowApprovalStatus.NavigateUrl = UrlHelper.BuildSecureUrl(
                    "~/AP/APView.aspx",
                    string.Empty,
                    APApprovalProcessEntity.FLD_NAME_APApprovalProcessID,
                    aPApprovalProcessEntity.APApprovalProcessID.ToString()
                    ).ToString();

                //lnkViewDetails.Target = "_blank";
                lnkShowApprovalStatus.Target = "_blank";
            }
        }
        protected void lvREQRequisition_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                REQRequisition_DetailedEntity ent = (REQRequisition_DetailedEntity)dataItem.DataItem;

                HyperLink hypRequisition            = (HyperLink)e.Item.FindControl("hypRequisition");
                HyperLink hypEdit                   = (HyperLink)e.Item.FindControl("lnkBtnEdit");
                HyperLink hypRequisitionReport      = (HyperLink)e.Item.FindControl("hypRequisitionReport");
                HyperLink hypCRMAdRequisitionReport = (HyperLink)e.Item.FindControl("hypCRMAdRequisitionReport");
                HyperLink hypRequisitionDetail      = (HyperLink)e.Item.FindControl("hypRequisitionDetail");
                HyperLink lnkShowApprovalStatus     = (HyperLink)e.Item.FindControl("lnkShowApprovalStatus");
                Label     lblRequisitionItem        = (Label)e.Item.FindControl("lblRequisitionItem");
                Label     lblWorkOrderCreated       = (Label)e.Item.FindControl("lblWorkOrderCreated");

                if (ent.RequisitionStatusID == MasterDataConstants.RequisitionStatus.MIGRATE_TO_TRF)
                {
                    String fe_TRF = SqlExpressionBuilder.PrepareFilterExpression(INVTransferEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), SQLMatchType.Equal);
                    IList <INVTransferEntity> iNVTransferEntityList = FCCINVTransfer.GetFacadeCreate().GetIL(null, null, String.Empty, fe_TRF, DatabaseOperationType.LoadWithFilterExpression);

                    if (iNVTransferEntityList != null && iNVTransferEntityList.Count > 0)
                    {
                        Panel pnlTRFNoLV = (Panel)e.Item.FindControl("pnlTRFNoLV");

                        foreach (INVTransferEntity invTransferEntity in iNVTransferEntityList)
                        {
                            HyperLink hypTRFNoLV = new HyperLink();
                            hypTRFNoLV.Text        = iNVTransferEntityList[0].TRFNo;
                            hypTRFNoLV.NavigateUrl = UrlHelper.BuildSecureUrl("~/INV/INVTransferItem.aspx", string.Empty, UrlConstants.OVERVIEW_TRANSFER_ID, invTransferEntity.TransferID.ToString()).ToString();
                            hypTRFNoLV.Target      = "_blank";
                            hypTRFNoLV.CssClass    = "CommonButtonLink";

                            pnlTRFNoLV.Controls.Add(hypTRFNoLV);
                            pnlTRFNoLV.Controls.Add(new LiteralControl("<br/>"));
                        }
                    }
                }

                Boolean IsAdvertisementRequisition = false;

                String feReqItem = SqlExpressionBuilder.PrepareFilterExpression("REQRequisitionItem." + REQRequisitionItemEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), SQLMatchType.Equal);
                IList <REQRequisitionItem_DetailedEntity> lst = FCCREQRequisitionItem_Detailed.GetFacadeCreate().GetIL(100000, 1, String.Empty, feReqItem);

                if (lst != null && lst.Count > 0)
                {
                    foreach (REQRequisitionItem_DetailedEntity entREQRequisitionItem_DetailedEntity in lst)
                    {
                        lblRequisitionItem.Text += entREQRequisitionItem_DetailedEntity.MDItemItemName + ", ";

                        if (entREQRequisitionItem_DetailedEntity.ItemCategoryID == MasterDataConstants.ItemDefaults.DEFAULT_ADVERTIESMENT_ITEM_CATEGORY)
                        {
                            IsAdvertisementRequisition = true;
                        }
                    }

                    lblRequisitionItem.Text = lblRequisitionItem.Text.Substring(0, lblRequisitionItem.Text.Length - 2);
                }

                IList <PRMWorkOrderNoByRequisition_CustomEntity> lstWONO = FCCPRMWorkOrderNoByRequisition_Custom.GetFacadeCreate().GetIL(Int64.Parse(ent.RequisitionID.ToString()));

                if (lstWONO != null && lstWONO.Count > 0)
                {
                    lblWorkOrderCreated.Text = lstWONO[0].WorkOrderNo.ToString();
                }

                String fe_req = SqlExpressionBuilder.PrepareFilterExpression("PRMWorkOrderItemMap." + PRMWorkOrderItemMapEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), SQLMatchType.Equal);
                IList <PRMWorkOrderItemMap_DetailedEntity> lstPRMWorkOrderItemMap = FCCPRMWorkOrderItemMap_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe_req);

                if (lstPRMWorkOrderItemMap != null && lstPRMWorkOrderItemMap.Count > 0)
                {
                    Panel pnlWorkOrderLV = (Panel)e.Item.FindControl("pnlWorkOrderLV");

                    List <PRMWorkOrderItemMap_DetailedEntity> distinct =
                        lstPRMWorkOrderItemMap
                        .GroupBy(car => car.WorkOrderID)
                        .Select(g => g.First())
                        .ToList();

                    foreach (PRMWorkOrderItemMap_DetailedEntity pRMWorkOrderItemMapEntity in distinct)
                    {
                        HyperLink hypWorkOrder = new HyperLink();
                        hypWorkOrder.Text        = pRMWorkOrderItemMapEntity.WorkOrderNo.ToString();
                        hypWorkOrder.NavigateUrl = UrlHelper.BuildSecureUrl("~/Reports/ReportViewer.aspx", string.Empty, "do", ReportConstants.WORK_ORDER_REPORT, UrlConstants.OVERVIEW_WORKORDER_ID, pRMWorkOrderItemMapEntity.WorkOrderID.ToString()).ToString();
                        hypWorkOrder.Target      = "_blank";
                        hypWorkOrder.CssClass    = "CommonButtonLink";

                        pnlWorkOrderLV.Controls.Add(hypWorkOrder);
                        pnlWorkOrderLV.Controls.Add(new LiteralControl("<br/>"));

                        String fe_mrr = SqlExpressionBuilder.PrepareFilterExpression(PRMMaterialReceiveEntity.FLD_NAME_WorkOrderID, pRMWorkOrderItemMapEntity.WorkOrderID.ToString(), SQLMatchType.Equal);
                        IList <PRMMaterialReceiveEntity> lstPRMMaterialReceive = FCCPRMMaterialReceive.GetFacadeCreate().GetIL(null, null, String.Empty, fe_mrr, DatabaseOperationType.LoadWithFilterExpression);

                        if (lstPRMMaterialReceive != null && lstPRMMaterialReceive.Count > 0)
                        {
                            Panel pnlMRRLV = (Panel)e.Item.FindControl("pnlMRRLV");

                            foreach (PRMMaterialReceiveEntity pRMMaterialReceiveEntity in lstPRMMaterialReceive)
                            {
                                HyperLink hypMaterialReceive = new HyperLink();
                                hypMaterialReceive.Text        = pRMMaterialReceiveEntity.MRRNo;
                                hypMaterialReceive.NavigateUrl = UrlHelper.BuildSecureUrl("~/Reports/ReportViewer.aspx", string.Empty, "do", "MaterialReceiveReport", UrlConstants.OVERVIEW_MATERIAL_RECEIVE_ID, pRMMaterialReceiveEntity.MaterialReceiveID.ToString()).ToString();
                                hypMaterialReceive.Target      = "_blank";
                                hypMaterialReceive.CssClass    = "CommonButtonLink";

                                pnlMRRLV.Controls.Add(hypMaterialReceive);
                                pnlMRRLV.Controls.Add(new LiteralControl("<br/>"));
                            }
                        }
                    }
                }

                if (ent.RequisitionStatusID == MasterDataConstants.RequisitionStatus.APPROVED ||
                    ent.RequisitionStatusID == MasterDataConstants.RequisitionStatus.MIGRATE_TO_TRF)
                {
                    hypEdit.Visible = false;
                }

                String NavigationUrl = String.Empty;

                NavigationUrl = UrlHelper.BuildSecureUrl("~/Reports/ReportViewer.aspx", string.Empty, "do", "RequisitionReport", UrlConstants.REQUISITION_ID, ent.RequisitionID.ToString()).ToString();

                if (IsAdvertisementRequisition)
                {
                    NavigationUrl = UrlHelper.BuildSecureUrl("~/Reports/ReportViewer.aspx", string.Empty, "do", ReportConstants.CRM_AD_REQUISITION_REPORT, UrlConstants.REQUISITION_ID, ent.RequisitionID.ToString()).ToString();
                }

                hypRequisitionReport.NavigateUrl = NavigationUrl;
                hypRequisitionReport.Target      = "_blank";


                hypEdit.NavigateUrl = UrlHelper.BuildSecureUrl("~/REQ/REQRequisition.aspx", string.Empty, "do", "Edit", UrlConstants.REQUISITION_ID, ent.RequisitionID.ToString()).ToString();
                if (this.OverviewProjectID > 0)
                {
                    hypRequisition.NavigateUrl = UrlHelper.BuildSecureUrl("~/BD/BDProjectRequisitionItem.aspx", string.Empty, UrlConstants.OVERVIEW_PROJECT_ID, this.OverviewProjectID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionNo, ent.RequisitionNo.ToString()).ToString();
                }
                else
                {
                    hypRequisition.NavigateUrl       = UrlHelper.BuildSecureUrl("~/REQ/REQRequisitionItem.aspx", string.Empty, UrlConstants.OVERVIEW_PROJECT_ID, this.OverviewProjectID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionNo, ent.RequisitionNo.ToString()).ToString();
                    hypRequisitionDetail.NavigateUrl = UrlHelper.BuildSecureUrl("~/Site/REQRequisitionItemView.aspx", string.Empty, UrlConstants.OVERVIEW_PROJECT_ID, this.OverviewProjectID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionID, ent.RequisitionID.ToString(), REQRequisitionEntity.FLD_NAME_RequisitionNo, ent.RequisitionNo.ToString()).ToString();
                }

                APApprovalProcessEntity aPApprovalProcessEntity = APRobot.GetApprovalProcessByTypeAndReference(MasterDataConstants.APType.REQUISITION, ent.RequisitionID);
                if (aPApprovalProcessEntity.APApprovalProcessID > 0)
                {
                    lnkShowApprovalStatus.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/AP/APView.aspx",
                        string.Empty,
                        APApprovalProcessEntity.FLD_NAME_APApprovalProcessID,
                        aPApprovalProcessEntity.APApprovalProcessID.ToString()
                        ).ToString();

                    lnkShowApprovalStatus.Target = "_blank";
                }
                else
                {
                    lnkShowApprovalStatus.NavigateUrl = String.Empty;
                    lnkShowApprovalStatus.Enabled     = false;
                }

                hypEdit.Target = "_blank";
                hypRequisitionReport.Target = "_blank";
                hypRequisitionDetail.Target = "_blank";
            }
        }