private void LoadSubCategories(TreeNode parentCategory)
        {
            Int64 itemCategoryID = Int64.Parse(parentCategory.Value);

            IList <MDItemCategoryEntity> childItemCategoryList = FCCMDItemCategory.GetFacadeCreate().GetByParentCategoryILFC(itemCategoryID);

            if (childItemCategoryList != null && childItemCategoryList.Count > 0)
            {
                foreach (MDItemCategoryEntity ent in childItemCategoryList)
                {
                    TreeNode childItemCategory = new TreeNode();

                    childItemCategory.Text         = ent.CategoryName;
                    childItemCategory.Value        = ent.ItemCategoryID.ToString();
                    childItemCategory.SelectAction = TreeNodeSelectAction.Select;

                    if (ShowCheckBoxesInAllNodes == true)
                    {
                        childItemCategory.ShowCheckBox = true;
                    }

                    parentCategory.ChildNodes.Add(childItemCategory);
                }
            }
        }
Esempio n. 2
0
        private void Search()
        {
            String    fe       = BuildFilterExpression();
            DataTable dtCommon = null;

            switch (Action)
            {
            case "ItemAdvanceSearch":
                dtCommon = FCCMDItem_Custom.GetFacadeCreate().GetDT(100000, 1, String.Empty, fe);
                break;

            case "ItemCategoryAdvanceSearch":
                dtCommon = FCCMDItemCategory.GetFacadeCreate().GetDT(1, 10000, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);
                break;

            default:
                break;
            }

            //lvCMNAdvanceSearch.DataSource = dtCommon;
            //lvCMNAdvanceSearch.DataBind();

            lblSearch.Visible = true;
            grvCMNAdvanceSearch.DataSource = dtCommon;
            grvCMNAdvanceSearch.DataBind();
        }
Esempio n. 3
0
        public IList <MDItemCategoryEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDItemCategoryEntity> mDItemCategoryEntityList = new List <MDItemCategoryEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDItemCategoryEntity.FLD_NAME_ItemCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDItemCategoryEntityList = FCCMDItemCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDItemCategoryEntityList ?? new List <MDItemCategoryEntity>());
        }
        private void BindMDItemCategoryList()
        {
            String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemCategoryEntity.FLD_NAME_ParentItemCategoryID, String.Empty, SQLMatchType.IsNull);
            IList <MDItemCategoryEntity> itemCategoryList = FCCMDItemCategory.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            _CurrentItemCategoryList        = itemCategoryList;
            chbxItemCategroy.DataSource     = itemCategoryList;
            chbxItemCategroy.DataTextField  = "CategoryName";
            chbxItemCategroy.DataValueField = "ItemCategoryID";
            chbxItemCategroy.DataBind();
        }
        private void BuildTree()
        {
            this.Nodes.Clear();

            itemCategoryList = FCCMDItemCategory.GetFacadeCreate().GetILFC();

            TreeNode rootNode = new TreeNode();

            rootNode.Text         = "Item Categories";
            rootNode.Value        = "0";
            rootNode.SelectAction = TreeNodeSelectAction.Select;
            rootNode.Expanded     = true;

            LoadCategories(rootNode);

            this.Nodes.Add(rootNode);
        }
        private void DeleteItemCategory()
        {
            Int64 ItemCategoryID;

            Int64.TryParse(treeItemCategory.SelectedValue, out ItemCategoryID);

            if (ItemCategoryID > 0)
            {
                try
                {
                    Int64 result = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemCategoryEntity.FLD_NAME_ItemCategoryID, ItemCategoryID.ToString(), SQLMatchType.Equal);

                    MDItemCategoryEntity mDItemCategoryEntity = new MDItemCategoryEntity();


                    result = FCCMDItemCategory.GetFacadeCreate().Delete(mDItemCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _ItemCategoryID       = 0;
                        _MDItemCategoryEntity = new MDItemCategoryEntity();

                        // clearing cache
                        FCCMDItemCategory.GetFacadeCreate().RemoveCache();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Item Category has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Item Category.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Esempio n. 7
0
        public IList <MDItemCategoryEntity> GetData()
        {
            IList <MDItemCategoryEntity> mDItemCategoryEntityList = new List <MDItemCategoryEntity>();

            try
            {
                mDItemCategoryEntityList = FCCMDItemCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDItemCategoryEntityList ?? new List <MDItemCategoryEntity>());
        }
Esempio n. 8
0
        private void BuildTree()
        {
            this.Nodes.Clear();

            itemCategoryList = FCCMDItemCategory.GetFacadeCreate().GetILFC();

            #region Load Main Categories

            if (itemCategoryList != null && itemCategoryList.Count > 0)
            {
                rootItemCategoryList = (from a in itemCategoryList
                                        where a.ParentItemCategoryID == null
                                        select a).ToList();

                if (rootItemCategoryList != null && rootItemCategoryList.Count > 0)
                {
                    foreach (MDItemCategoryEntity ent in rootItemCategoryList)
                    {
                        TreeNode parentCategory = new TreeNode();

                        parentCategory.Text         = ent.CategoryName;
                        parentCategory.Value        = ent.ItemCategoryID.ToString();
                        parentCategory.SelectAction = TreeNodeSelectAction.Expand;
                        parentCategory.Expanded     = false;

                        if (ShowCheckBoxesInAllNodes == true)
                        {
                            // parentCategory.ShowCheckBox = true;
                        }

                        LoadSubCategories(parentCategory);

                        this.Nodes.Add(parentCategory);
                    }
                }
            }

            #endregion
        }
        private void SaveMDItemCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDItemCategoryEntity mDItemCategoryEntity = BuildMDItemCategoryEntity();

                    Int64 result = -1;

                    if (mDItemCategoryEntity.IsNew)
                    {
                        if (treeItemCategory.SelectedNode != null)
                        {
                            if (treeItemCategory.SelectedValue == "0")
                            {
                                mDItemCategoryEntity.ParentItemCategoryID = null;
                            }
                            else
                            {
                                mDItemCategoryEntity.ParentItemCategoryID = Int64.Parse(treeItemCategory.SelectedValue);
                            }
                        }

                        result = FCCMDItemCategory.GetFacadeCreate().Add(mDItemCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDItemCategoryEntity.FLD_NAME_ItemCategoryID, mDItemCategoryEntity.ItemCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCMDItemCategory.GetFacadeCreate().Update(mDItemCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ItemCategoryID       = 0;
                        _MDItemCategoryEntity = new MDItemCategoryEntity();

                        // clearing cache
                        FCCMDItemCategory.GetFacadeCreate().RemoveCache();

                        PrepareInitialView();

                        LoadTreeView();

                        if (mDItemCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Item Category Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Item Category Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDItemCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Item Category Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Item Category Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }