private String MergeAllString()
        {
            String fe = String.Empty;

            String fe_account = String.Empty;

            if (ddlReferenceID != null && ddlReferenceID.Items.Count > 0)
            {
                String feResourceCategory = SqlExpressionBuilder.PrepareFilterExpression(ACAccountResourceAccountMapEntity.FLD_NAME_AccountResourceCategoryID, ddlAccountResourceCategoryID.SelectedValue, SQLMatchType.Equal);
                String feResource         = SqlExpressionBuilder.PrepareFilterExpression(ACAccountResourceAccountMapEntity.FLD_NAME_ReferenceID, ddlReferenceID.SelectedValue, SQLMatchType.Equal);
                fe_account = SqlExpressionBuilder.PrepareFilterExpression(feResourceCategory, SQLJoinType.AND, feResource);
                IList <ACAccountResourceAccountMapEntity> lst = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_account, DatabaseOperationType.LoadWithFilterExpression);

                if (lst != null && lst.Count > 0)
                {
                    fe = SqlExpressionBuilder.PrepareFilterExpression(ACBankStatement_CustomEntity.FLD_NAME_AccountID, lst[0].AccountID.ToString(), SQLMatchType.Equal);
                }
            }

            if (!String.IsNullOrWhiteSpace(txtTransactionFromDate.Text.Trim()))
            {
                if (!String.IsNullOrWhiteSpace(txtTransactionToDate.Text.Trim()))
                {
                    String fe1 = "TransactionDateTime between '" + MiscUtil.ParseToDateTime(txtTransactionFromDate.Text) + "' and '" + MiscUtil.ParseToDateTime(txtTransactionToDate.Text) + "'";
                    fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe1);
                }
            }

            return(fe);
        }
        public IList <ACAccountResourceAccountMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            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;

                aCAccountResourceAccountMapEntityList = FCCACAccountResourceAccountMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(aCAccountResourceAccountMapEntityList ?? new List <ACAccountResourceAccountMapEntity>());
        }
        private void SaveACAccountResourceAccountMapEntity()
        {
            if (IsValid)
            {
                try
                {
                    ACAccountResourceAccountMapEntity aCAccountResourceAccountMapEntity = BuildACAccountResourceAccountMapEntity();

                    Int64 result = -1;

                    if (aCAccountResourceAccountMapEntity.IsNew)
                    {
                        result = FCCACAccountResourceAccountMap.GetFacadeCreate().Add(aCAccountResourceAccountMapEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ACAccountResourceAccountMapEntity.FLD_NAME_ResourceAccountMapID, aCAccountResourceAccountMapEntity.ResourceAccountMapID.ToString(), SQLMatchType.Equal);
                        result = FCCACAccountResourceAccountMap.GetFacadeCreate().Update(aCAccountResourceAccountMapEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

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

                        if (aCAccountResourceAccountMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Account Resource Account Map Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Account Resource Account Map Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (aCAccountResourceAccountMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Account Resource Account Map Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Account Resource Account Map Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        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();
        }