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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = PRMSupplierItemCategoryMapEntity.FLD_NAME_SupplierItemCategoryMapID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                pRMSupplierItemCategoryMapEntityList = FCCPRMSupplierItemCategoryMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(pRMSupplierItemCategoryMapEntityList ?? new List <PRMSupplierItemCategoryMapEntity>());
        }
        private void SavePRMSupplierItemCategoryMapEntity()
        {
            if (IsValid)
            {
                try
                {
                    IList <PRMSupplierItemCategoryMapEntity> newMappedItems = new List <PRMSupplierItemCategoryMapEntity>();

                    foreach (ListItem chbxItem in chbxItemCategory.Items)
                    {
                        if (chbxItem.Selected)
                        {
                            PRMSupplierItemCategoryMapEntity pRMItemCategoryMapEntity = new PRMSupplierItemCategoryMapEntity();
                            pRMItemCategoryMapEntity.SupplierItemCategoryID = Int64.Parse(chbxItem.Value.ToString());
                            pRMItemCategoryMapEntity.SupplierID             = this.OverviewSupplierID;
                            newMappedItems.Add(pRMItemCategoryMapEntity);
                        }
                    }

                    IList <PRMSupplierItemCategoryMapEntity> deleteList = _CurrentSupplierItemCategoryList.Except(newMappedItems, new CustomerComparer()).ToList();
                    IList <PRMSupplierItemCategoryMapEntity> addNewList = newMappedItems.Except(_CurrentSupplierItemCategoryList, new CustomerComparer()).ToList();

                    if (deleteList != null && deleteList.Count > 0)
                    {
                        foreach (PRMSupplierItemCategoryMapEntity ent in deleteList)
                        {
                            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemCategoryMapEntity.FLD_NAME_SupplierID, ent.SupplierID.ToString(), SQLMatchType.Equal);
                            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemCategoryMapEntity.FLD_NAME_SupplierItemCategoryID, ent.SupplierItemCategoryID.ToString(), SQLMatchType.Equal);
                            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                            FCCPRMSupplierItemCategoryMap.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No);
                        }
                    }

                    if (addNewList != null && addNewList.Count > 0)
                    {
                        foreach (PRMSupplierItemCategoryMapEntity ent in addNewList)
                        {
                            FCCPRMSupplierItemCategoryMap.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                    }

                    MiscUtil.ShowMessage(lblMessage, "Vendor Item Category Map Information has been added successfully.", false);
                    BindList();
                    //_CurrentSupplierItemCategoryList = new List<PRMSupplierItemCategoryMapEntity>();
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        public IList <PRMSupplierItemCategoryMapEntity> GetData()
        {
            IList <PRMSupplierItemCategoryMapEntity> pRMSupplierItemCategoryMapEntityList = new List <PRMSupplierItemCategoryMapEntity>();

            try
            {
                pRMSupplierItemCategoryMapEntityList = FCCPRMSupplierItemCategoryMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(pRMSupplierItemCategoryMapEntityList ?? new List <PRMSupplierItemCategoryMapEntity>());
        }
        private void BindPRMSupplierItemCategoryMapList()
        {
            IList <MDSupplierItemCategoryEntity> supplierItemCategoryList = FCCMDSupplierItemCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

            chbxItemCategory.DataSource     = supplierItemCategoryList;
            chbxItemCategory.DataTextField  = "Name";
            chbxItemCategory.DataValueField = "SupplierItemCategoryID";
            chbxItemCategory.DataBind();

            if (chbxItemCategory != null && chbxItemCategory.Items.Count > 0)
            {
                String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMSupplierItemCategoryMapEntity.FLD_NAME_SupplierID, this.OverviewSupplierID.ToString(), SQLMatchType.Equal);
                IList <PRMSupplierItemCategoryMapEntity> supplierItemCategoryMapList = FCCPRMSupplierItemCategoryMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                if (supplierItemCategoryMapList != null && supplierItemCategoryMapList.Count > 0)
                {
                    _CurrentSupplierItemCategoryList = supplierItemCategoryMapList;

                    foreach (PRMSupplierItemCategoryMapEntity ent in supplierItemCategoryMapList)
                    {
                        foreach (ListItem chbxItem in chbxItemCategory.Items)
                        {
                            if (ent.SupplierItemCategoryID.ToString() == chbxItem.Value.ToString())
                            {
                                chbxItem.Selected = true;
                                break;
                            }
                        }
                    }
                }
            }
        }