Ejemplo n.º 1
0
        public IList <INVTransferEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <INVTransferEntity> iNVTransferEntityList = new List <INVTransferEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = INVTransferEntity.FLD_NAME_TransferID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                iNVTransferEntityList = FCCINVTransfer.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(iNVTransferEntityList ?? new List <INVTransferEntity>());
        }
Ejemplo n.º 2
0
        private void SaveINVTransferEntity()
        {
            if (ValidationInput())
            {
                if (IsValid)
                {
                    try
                    {
                        INVTransferEntity iNVTransferEntity = BuildINVTransferEntity();

                        Int64 result = -1;

                        if (iNVTransferEntity.IsNew)
                        {
                            result = FCCINVTransfer.GetFacadeCreate().Add(iNVTransferEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(INVTransferEntity.FLD_NAME_TransferID, iNVTransferEntity.TransferID.ToString(), SQLMatchType.Equal);
                            result = FCCINVTransfer.GetFacadeCreate().Update(iNVTransferEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        if (result > 0)
                        {
                            String NavigationUrl = UrlHelper.BuildSecureUrl("~/INV/INVTransferItem.aspx", string.Empty, UrlConstants.OVERVIEW_TRANSFER_ID, result.ToString()).ToString();
                            Response.Redirect(NavigationUrl);

                            _TransferID        = 0;
                            _INVTransferEntity = new INVTransferEntity();
                            PrepareInitialView();
                            BindINVTransferList();

                            if (iNVTransferEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "TRF Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "TRF Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (iNVTransferEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add TRF Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update TRF Information.", false);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void lvINVTransfer_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 TransferID;

            Int64.TryParse(e.CommandArgument.ToString(), out TransferID);

            if (TransferID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _TransferID = TransferID;
                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(INVTransferEntity.FLD_NAME_TransferID, TransferID.ToString(), SQLMatchType.Equal);

                        INVTransferEntity iNVTransferEntity = new INVTransferEntity();

                        result = FCCINVTransfer.GetFacadeCreate().Delete(iNVTransferEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _TransferID        = 0;
                            _INVTransferEntity = new INVTransferEntity();
                            PrepareInitialView();
                            BindINVTransferList();

                            MiscUtil.ShowMessage(lblMessage, "I NVTransfer has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete I NVTransfer.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public IList <INVTransferEntity> GetData()
        {
            IList <INVTransferEntity> iNVTransferEntityList = new List <INVTransferEntity>();

            try
            {
                iNVTransferEntityList = FCCINVTransfer.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(iNVTransferEntityList ?? new List <INVTransferEntity>());
        }
        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";
            }
        }