public IList <PRMSupplierEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <PRMSupplierEntity> pRMSupplierEntityList = new List <PRMSupplierEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = PRMSupplierEntity.FLD_NAME_SupplierID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                pRMSupplierEntityList = FCCPRMSupplier.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(pRMSupplierEntityList ?? new List <PRMSupplierEntity>());
        }
Пример #2
0
        private void SavePRMSupplierEntity()
        {
            if (IsValid)
            {
                try
                {
                    PRMSupplierEntity pRMSupplierEntity = BuildPRMSupplierEntity();

                    Int64 result = -1;

                    if (pRMSupplierEntity.IsNew)
                    {
                        result = FCCPRMSupplier.GetFacadeCreate().Add(pRMSupplierEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierEntity.FLD_NAME_SupplierID, pRMSupplierEntity.SupplierID.ToString(), SQLMatchType.Equal);
                        result = FCCPRMSupplier.GetFacadeCreate().Update(pRMSupplierEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        String NavUrl = UrlHelper.BuildSecureUrl("~/PRM/PRMSupplierEditor.aspx", string.Empty, UrlConstants.OVERVIEW_SUPPLIER_ID, result.ToString()).ToString();

                        Response.Redirect(NavUrl);

                        _SupplierID        = 0;
                        _PRMSupplierEntity = new PRMSupplierEntity();
                        PrepareInitialView();
                        BindPRMSupplierList();

                        if (pRMSupplierEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (pRMSupplierEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Vendor Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Vendor Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Пример #3
0
        private void SavePRMSupplierEntity()
        {
            if (IsValid)
            {
                try
                {
                    PRMSupplierEntity pRMSupplierEntity = BuildPRMSupplierEntity();

                    Int64 result = -1;

                    if (pRMSupplierEntity.IsNew)
                    {
                        result = FCCPRMSupplier.GetFacadeCreate().Add(pRMSupplierEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierEntity.FLD_NAME_SupplierID, pRMSupplierEntity.SupplierID.ToString(), SQLMatchType.Equal);
                        result = FCCPRMSupplier.GetFacadeCreate().Update(pRMSupplierEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _SupplierID        = 0;
                        _PRMSupplierEntity = new PRMSupplierEntity();
                        PrepareInitialView();
                        BindPRMSupplierList();

                        if (pRMSupplierEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Information has been updated successfully.", false);
                        }
                        PrepareEditView();
                    }
                    else
                    {
                        if (pRMSupplierEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Vendor Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Vendor Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Пример #4
0
        protected void lvPRMSupplier_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 SupplierID;

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

            if (SupplierID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _SupplierID = SupplierID;

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierEntity.FLD_NAME_SupplierID, SupplierID.ToString(), SQLMatchType.Equal);

                        PRMSupplierEntity pRMSupplierEntity = new PRMSupplierEntity();


                        result = FCCPRMSupplier.GetFacadeCreate().Delete(pRMSupplierEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _SupplierID        = 0;
                            _PRMSupplierEntity = new PRMSupplierEntity();
                            PrepareInitialView();
                            BindPRMSupplierList();

                            MiscUtil.ShowMessage(lblMessage, "Vendor has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Vendor.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <PRMSupplierEntity> GetData()
        {
            IList <PRMSupplierEntity> pRMSupplierEntityList = new List <PRMSupplierEntity>();

            try
            {
                pRMSupplierEntityList = FCCPRMSupplier.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(pRMSupplierEntityList ?? new List <PRMSupplierEntity>());
        }
Пример #6
0
        protected void lvPRMSupplier_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 SupplierID;

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

            if (SupplierID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierEntity.FLD_NAME_SupplierID, SupplierID.ToString(), SQLMatchType.Equal);

                        PRMSupplierEntity pRMSupplierEntity = new PRMSupplierEntity();


                        result = FCCPRMSupplier.GetFacadeCreate().Delete(pRMSupplierEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                        }
                        else
                        {
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
        protected void lvACCPrePayableStatementDetail_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                ACCPostPayableStatementDetailEntity ent = (ACCPostPayableStatementDetailEntity)dataItem.DataItem;

                Label        lblProjectNameLV                            = (Label)e.Item.FindControl("lblProjectNameLV");
                Label        lblVendorCategoryNameLV                     = (Label)e.Item.FindControl("lblVendorCategoryNameLV");
                Label        lblVendorCategoryIDLV                       = (Label)e.Item.FindControl("lblVendorCategoryIDLV");
                Label        lblVendorIDLV                               = (Label)e.Item.FindControl("lblVendorIDLV");
                Label        lblVendorNameLV                             = (Label)e.Item.FindControl("lblVendorNameLV");
                Label        lblProjectIDLV                              = (Label)e.Item.FindControl("lblProjectIDLV");
                DropDownList ddlACCPayableApprovalStatusIDLV             = (DropDownList)e.Item.FindControl("ddlACCPayableApprovalStatusIDLV");
                DropDownList ddlACCPayablePaymentStatusIDLV              = (DropDownList)e.Item.FindControl("ddlACCPayablePaymentStatusIDLV");
                DropDownList ddlPayableClassificationIDLV                = (DropDownList)e.Item.FindControl("ddlPayableClassificationIDLV");
                DropDownList ddlAccountPaybleStatementDetailCategoryIDLV = (DropDownList)e.Item.FindControl("ddlAccountPaybleStatementDetailCategoryIDLV");
                CheckBox     chkPartyReconcileLV                         = (CheckBox)e.Item.FindControl("chkPartyReconcileLV");

                if (lblProjectIDLV != null)
                {
                    BDProjectEntity _bDProjectEntity = FCCBDProject.GetFacadeCreate().GetByID(Int64.Parse(lblProjectIDLV.Text));

                    if (_bDProjectEntity != null)
                    {
                        lblProjectNameLV.Text = _bDProjectEntity.ProjectName + " (" + _bDProjectEntity.ProjectCode + ")";
                    }
                }

                MiscUtil.PopulateMDACCPayablePaymentStatus(ddlACCPayablePaymentStatusIDLV, false);
                MiscUtil.PopulateMDACCPayableApprovalStatus(ddlACCPayableApprovalStatusIDLV, false);
                MiscUtil.PopulateMDPayableClassification(ddlPayableClassificationIDLV, false);
                MiscUtil.PopulateMDAccountPaybleStatementDetailCategory(ddlAccountPaybleStatementDetailCategoryIDLV, false);
                _PostPayableStatementDetailID = ent.PostPayableStatementDetailID;

                if (ent.PartyReconcile == true)
                {
                    chkPartyReconcileLV.Checked = true;
                }
                else
                {
                    chkPartyReconcileLV.Checked = false;
                }

                Int64 vendorID;
                Int64.TryParse(lblVendorIDLV.Text.ToString(), out vendorID);

                switch (lblVendorCategoryIDLV.Text)
                {
                case MasterDataConstants.CM_Bill_VendorCategory.CONSULTANT:
                    CMConsultantEntity _cmConsultantEntity = FCCCMConsultant.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "CONSULTANT";
                    lblVendorNameLV.Text         = _cmConsultantEntity.Name;
                    break;

                case MasterDataConstants.CM_Bill_VendorCategory.CONTRACTOR:
                    CMContractorEntity _cMContractorEntity = FCCCMContractor.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "CONTRACTOR";
                    lblVendorNameLV.Text         = _cMContractorEntity.Name;
                    break;

                case MasterDataConstants.CM_Bill_VendorCategory.VENDOR:
                    PRMSupplierEntity _pRMSupplierEntity = FCCPRMSupplier.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "VENDOR";
                    lblVendorNameLV.Text         = _pRMSupplierEntity.SupplierName;
                    break;
                }

                if (ddlACCPayableApprovalStatusIDLV != null && ddlACCPayableApprovalStatusIDLV.Items.Count > 0)
                {
                    ddlACCPayableApprovalStatusIDLV.SelectedValue = ent.ACCPayableApprovalStatusID.ToString();
                }

                if (ddlACCPayablePaymentStatusIDLV != null && ddlACCPayablePaymentStatusIDLV.Items.Count > 0)
                {
                    ddlACCPayablePaymentStatusIDLV.SelectedValue = ent.ACCPayablePaymentStatusID.ToString();
                }

                if (ddlPayableClassificationIDLV != null && ddlPayableClassificationIDLV.Items.Count > 0)
                {
                    ddlPayableClassificationIDLV.SelectedValue = ent.PayableClassificationID.ToString();
                }

                if (ddlAccountPaybleStatementDetailCategoryIDLV != null && ddlAccountPaybleStatementDetailCategoryIDLV.Items.Count > 0)
                {
                    ddlAccountPaybleStatementDetailCategoryIDLV.SelectedValue = ent.AccountPaybleStatementDetailCategoryID.ToString();
                }

                ddlACCPayableApprovalStatusIDLV.Enabled = false;
            }
        }
        protected void btnMakePayment_Click(object sender, EventArgs e)
        {
            try
            {
                IList <ListViewDataItem> list = lvACCPrePayableStatementDetail.Items;

                if (list != null && list.Count > 0)
                {
                    Int32 tempDataItemIndex = 0;

                    foreach (ListViewDataItem lvdi in list)
                    {
                        DataKey currentDataKey = lvACCPrePayableStatementDetail.DataKeys[tempDataItemIndex++];
                        Int64   _postPayableStatementDetailID = (Int64)currentDataKey["PostPayableStatementDetailID"];
                        _PostPayableStatementDetailID = _postPayableStatementDetailID;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            if (_PostPayableStatementDetailID > 0)
            {
                ACCPostPayableStatementDetailEntity aCCPostPayableStatementDetailEntity = CurrentACCPostPayableStatementDetailEntity;

                if (aCCPostPayableStatementDetailEntity != null && aCCPostPayableStatementDetailEntity.PostPayableStatementDetailID > 0)
                {
                    txtAmount.Text = aCCPostPayableStatementDetailEntity.NetPayableConsideringBillAndSecurity.ToString();

                    PRMSupplierEntity pRMSupplierEntity = FCCPRMSupplier.GetFacadeCreate().GetByID(aCCPostPayableStatementDetailEntity.FromVendorID);

                    String compositeID = String.Empty;
                    Int64  accountID   = 0;
                    if (pRMSupplierEntity != null && pRMSupplierEntity.SupplierID > 0)
                    {
                        Int64 referenceID, resourceCategoryID = 0;
                        referenceID = pRMSupplierEntity.SupplierID;

                        switch (pRMSupplierEntity.SupplierTypeID)
                        {
                        case MasterDataConstants.MDSupplierType.LOCAL:
                        case MasterDataConstants.MDSupplierType.IMPORTER:
                        case MasterDataConstants.MDSupplierType.LOCAL_AND_IMPORTER:
                            resourceCategoryID = MasterDataConstants.ACMDAccountResourceCategory.VENDOR;
                            break;

                        case MasterDataConstants.MDSupplierType.CONTRACTOR:
                            resourceCategoryID = MasterDataConstants.ACMDAccountResourceCategory.CONTRACTOR;
                            break;

                        case MasterDataConstants.MDSupplierType.CONSULTANT:
                            resourceCategoryID = MasterDataConstants.ACMDAccountResourceCategory.CONSULTANT;
                            break;
                        }



                        if (referenceID > 0 && resourceCategoryID > 0)
                        {
                            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(ACAccountResourceAccountMapEntity.FLD_NAME_AccountResourceCategoryID, resourceCategoryID.ToString(), SQLMatchType.Equal);
                            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(ACAccountResourceAccountMapEntity.FLD_NAME_ReferenceID, referenceID.ToString(), SQLMatchType.Equal);
                            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                            IList <ACAccountResourceAccountMapEntity> lst = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                            if (lst != null && lst.Count > 0)
                            {
                                foreach (ACAccountResourceAccountMapEntity ent in lst)
                                {
                                    compositeID += ent.ReferenceID + ",";
                                    accountID    = ent.AccountID;
                                }

                                compositeID = compositeID.Substring(0, compositeID.Length - 1);
                            }
                        }
                    }

                    MiscUtil.PopulateACAccountByAccountGroupByReference(ddlACCAccountID, false, compositeID);

                    if (ddlACCAccountID != null && ddlACCAccountID.Items.Count > 0)
                    {
                        //ddlACCAccountID.SelectedValue = accountID.ToString();
                    }
                }
            }
            this.Panel1_ModalPopupExtender.Show();
        }