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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDItemGroupItemCategoryMapEntity.FLD_NAME_ItemGroupItemCategoryMapID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDItemGroupItemCategoryMapEntityList = FCCMDItemGroupItemCategoryMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDItemGroupItemCategoryMapEntityList ?? new List <MDItemGroupItemCategoryMapEntity>());
        }
        protected void lstBxItemGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemGroupItemCategoryMapEntity.FLD_NAME_ItemGroupID, lstBxItemGroup.SelectedValue.ToString(), SQLMatchType.Equal);
            IList <MDItemGroupItemCategoryMapEntity> ItemCategoryList = FCCMDItemGroupItemCategoryMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            _CurrentItemGroupItemCategoryMapList = ItemCategoryList;

            if (ItemCategoryList != null && ItemCategoryList.Count > 0)
            {
                foreach (MDItemGroupItemCategoryMapEntity ent in ItemCategoryList)
                {
                    foreach (ListItem chbxItem in chbxItemCategroy.Items)
                    {
                        if (ent.ItemCategoryID.ToString() == chbxItem.Value.ToString())
                        {
                            chbxItem.Selected = true;
                            break;
                        }
                    }
                }
                IList <MDItemGroupItemCategoryMapEntity> TempitemGroupList = new List <MDItemGroupItemCategoryMapEntity>();
                if (_CurrentItemCategoryList != null && _CurrentItemCategoryList.Count > 0)
                {
                    foreach (MDItemCategoryEntity ent in _CurrentItemCategoryList)
                    {
                        MDItemGroupItemCategoryMapEntity mDItemGroupEntity = new MDItemGroupItemCategoryMapEntity();
                        mDItemGroupEntity.ItemCategoryID = ent.ItemCategoryID;
                        TempitemGroupList.Add(mDItemGroupEntity);
                    }

                    IList <MDItemGroupItemCategoryMapEntity> uncheckedList = TempitemGroupList.Except(_CurrentItemGroupItemCategoryMapList, new CustomerComparerAnother()).ToList();

                    if (uncheckedList != null && uncheckedList.Count > 0)
                    {
                        foreach (MDItemGroupItemCategoryMapEntity ent in uncheckedList)
                        {
                            foreach (ListItem chbxItem in chbxItemCategroy.Items)
                            {
                                if (ent.ItemCategoryID.ToString() == chbxItem.Value.ToString())
                                {
                                    chbxItem.Selected = false;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (ListItem chbxItem in chbxItemCategroy.Items)
                {
                    chbxItem.Selected = false;
                }
            }
        }
        private void UpdateMDItemGroupItemCategoryMapEntity()
        {
            if (IsValid)
            {
                try
                {
                    IList <MDItemGroupItemCategoryMapEntity> newMappedItems = new List <MDItemGroupItemCategoryMapEntity>();

                    foreach (ListItem chbxItem in chbxItemCategroy.Items)
                    {
                        if (chbxItem.Selected)
                        {
                            MDItemGroupItemCategoryMapEntity mDItemGroupItemCategoryMapEntity = new MDItemGroupItemCategoryMapEntity();
                            mDItemGroupItemCategoryMapEntity.ItemGroupID    = Int64.Parse(lstBxItemGroup.SelectedValue.ToString());
                            mDItemGroupItemCategoryMapEntity.ItemCategoryID = Int64.Parse(chbxItem.Value.ToString());
                            newMappedItems.Add(mDItemGroupItemCategoryMapEntity);
                        }
                    }

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

                    if (deleteList != null && deleteList.Count > 0)
                    {
                        foreach (MDItemGroupItemCategoryMapEntity ent in deleteList)
                        {
                            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(MDItemGroupItemCategoryMapEntity.FLD_NAME_ItemCategoryID, ent.ItemCategoryID.ToString(), SQLMatchType.Equal);
                            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(MDItemGroupItemCategoryMapEntity.FLD_NAME_ItemGroupID, ent.ItemGroupID.ToString(), SQLMatchType.Equal);
                            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

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

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

                    MiscUtil.ShowMessage(lblMessage, "Item Group Item Category Map Information has been updated successfully.", false);
                    _CurrentItemGroupItemCategoryMapList = new List <MDItemGroupItemCategoryMapEntity>();
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        public IList <MDItemGroupItemCategoryMapEntity> GetData()
        {
            IList <MDItemGroupItemCategoryMapEntity> mDItemGroupItemCategoryMapEntityList = new List <MDItemGroupItemCategoryMapEntity>();

            try
            {
                mDItemGroupItemCategoryMapEntityList = FCCMDItemGroupItemCategoryMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDItemGroupItemCategoryMapEntityList ?? new List <MDItemGroupItemCategoryMapEntity>());
        }