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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = ACAccountResourceAccountMapEntity.FLD_NAME_ResourceAccountMapID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                if (pageSize == 2147483647)
                {
                    if (filterExpression.IsNullOrEmpty())
                    {
                        aCAccountResourceAccountMapEntityList = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(null, null, sortExpression, String.Empty, DatabaseOperationType.LoadWithSortExpression);
                    }
                    else
                    {
                        aCAccountResourceAccountMapEntityList = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(null, null, sortExpression, filterExpression, DatabaseOperationType.LoadWithFilterAndSortExpression);
                    }
                }
                else
                {
                    if (filterExpression.IsNullOrEmpty())
                    {
                        aCAccountResourceAccountMapEntityList = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, String.Empty, DatabaseOperationType.LoadPagedWithSortExpression);
                    }
                    else
                    {
                        aCAccountResourceAccountMapEntityList = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, filterExpression, DatabaseOperationType.LoadPagedWithFilterAndSortExpression);
                    }
                }

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

            return(aCAccountResourceAccountMapEntityList ?? new List <ACAccountResourceAccountMapEntity>());
        }
        protected void lvACAccountResourceAccountMap_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ResourceAccountMapID;

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

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ACAccountResourceAccountMapEntity.FLD_NAME_ResourceAccountMapID, ResourceAccountMapID.ToString(), SQLMatchType.Equal);

                        ACAccountResourceAccountMapEntity aCAccountResourceAccountMapEntity = new ACAccountResourceAccountMapEntity();


                        result = FCCACAccountResourceAccountMap.GetFacadeCreate().Delete(aCAccountResourceAccountMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ResourceAccountMapID = 0;
                            _ACAccountResourceAccountMapEntity = new ACAccountResourceAccountMapEntity();
                            PrepareInitialView();
                            BindACAccountResourceAccountMapList();

                            MiscUtil.ShowMessage(lblMessage, "A CAccount Resource Account Map has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete A CAccount Resource Account Map.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <ACAccountResourceAccountMapEntity> GetData()
        {
            IList <ACAccountResourceAccountMapEntity> aCAccountResourceAccountMapEntityList = new List <ACAccountResourceAccountMapEntity>();

            try
            {
                aCAccountResourceAccountMapEntityList = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(aCAccountResourceAccountMapEntityList ?? new List <ACAccountResourceAccountMapEntity>());
        }
        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();
        }