예제 #1
0
        public IList <MDAssetEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDAssetEntity> mDAssetEntityList = new List <MDAssetEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDAssetEntity.FLD_NAME_AssetID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDAssetEntityList = FCCMDAsset.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDAssetEntityList ?? new List <MDAssetEntity>());
        }
예제 #2
0
        protected override void OnSelectedNodeChanged(EventArgs e)
        {
            TreeNode selectedNode = this.SelectedNode;

            Int64 assetCategoryID = Int64.Parse(selectedNode.Value);

            switch (selectedNode.Depth)
            {
            case 0:
                break;

            case 1:
                if (selectedNode.ChildNodes.Count <= 0)
                {
                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetEntity.FLD_NAME_AssetCateogryID, assetCategoryID.ToString(), SQLMatchType.Equal);
                    IList <MDAssetEntity> assetList = FCCMDAsset.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

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

                            childItemCategory.Text         = ent.AssetName;
                            childItemCategory.Value        = ent.AssetID.ToString();
                            childItemCategory.SelectAction = TreeNodeSelectAction.Select;

                            if (ShowCheckBoxesInAllNodes == true)
                            {
                                childItemCategory.ShowCheckBox = true;
                                if (ShowCheckedAtLastNode == true)
                                {
                                    childItemCategory.Checked = true;
                                }
                            }
                            selectedNode.ChildNodes.Add(childItemCategory);
                        }
                    }
                }
                break;

            case 2:
                break;

            default:
                break;
            }

            base.OnSelectedNodeChanged(e);
        }
예제 #3
0
        public IList <MDAssetEntity> GetData()
        {
            IList <MDAssetEntity> mDAssetEntityList = new List <MDAssetEntity>();

            try
            {
                mDAssetEntityList = FCCMDAsset.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDAssetEntityList ?? new List <MDAssetEntity>());
        }
예제 #4
0
        private void DeleteItem()
        {
            Int64 AssetID;

            Int64.TryParse(treeAsset.SelectedValue, out AssetID);

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

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetEntity.FLD_NAME_AssetID, AssetID.ToString(), SQLMatchType.Equal);

                    MDAssetEntity mDAssetEntity = new MDAssetEntity();

                    result = FCCMDAsset.GetFacadeCreate().Delete(mDAssetEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _AssetID       = 0;
                        _MDAssetEntity = new MDAssetEntity();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Item has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Item.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #5
0
        private void SaveMDAssetEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDAssetEntity mDAssetEntity = BuildMDAssetEntity();

                    Boolean addInputValidation = true;

                    Int64 result = -1;

                    if (mDAssetEntity.IsNew)
                    {
                        if (ValidateInput())
                        {
                            if (treeAsset.SelectedNode != null)
                            {
                                mDAssetEntity.AssetCateogryID = Int64.Parse(treeAsset.SelectedValue);
                            }

                            result = FCCMDAsset.GetFacadeCreate().Add(mDAssetEntity, DatabaseOperationType.Add, TransactionRequired.No);

                            if (ViewState["PushToStore"] != null)
                            {
                                //INVManager.AddItemsToStoreUnit(result, brandID, regionID, countryID, "", receiveQty, MiscUtil.GetLocalIP(), _employeeID, _rate, lstprmMaterialReceive[0].RequisitionNo.ToString(), lstprmMaterialReceive[0].WorkOrderNo.ToString(), lstprmMaterialReceive[0].MaterialReceiveID.ToString(), "", lstprmMaterialReceive[0].ProjectID, storeID, storeUnitID);
                            }
                        }
                        else
                        {
                            addInputValidation = false;
                        }
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDAssetEntity.FLD_NAME_AssetID, mDAssetEntity.AssetID.ToString(), SQLMatchType.Equal);
                        result = FCCMDAsset.GetFacadeCreate().Update(mDAssetEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _AssetID       = 0;
                        _MDAssetEntity = new MDAssetEntity();
                        PrepareInitialView();
                        LoadTreeView();

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