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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = DMSFileMovementRegisterEntity.FLD_NAME_FileMovementRegisterID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                dMSFileMovementRegisterEntityList = FCCDMSFileMovementRegister.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(dMSFileMovementRegisterEntityList ?? new List <DMSFileMovementRegisterEntity>());
        }
        protected void lvDMSFileMovementRegister_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 FileMovementRegisterID;

            Int64.TryParse(e.CommandArgument.ToString(), out FileMovementRegisterID);

            if (FileMovementRegisterID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _FileMovementRegisterID = FileMovementRegisterID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(DMSFileMovementRegisterEntity.FLD_NAME_FileMovementRegisterID, FileMovementRegisterID.ToString(), SQLMatchType.Equal);

                        DMSFileMovementRegisterEntity dMSFileMovementRegisterEntity = new DMSFileMovementRegisterEntity();


                        result = FCCDMSFileMovementRegister.GetFacadeCreate().Delete(dMSFileMovementRegisterEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _FileMovementRegisterID        = 0;
                            _DMSFileMovementRegisterEntity = new DMSFileMovementRegisterEntity();
                            PrepareInitialView();
                            BindDMSFileMovementRegisterList();

                            MiscUtil.ShowMessage(lblMessage, "D MSFile Movement Register has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete D MSFile Movement Register.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <DMSFileMovementRegisterEntity> GetData()
        {
            IList <DMSFileMovementRegisterEntity> dMSFileMovementRegisterEntityList = new List <DMSFileMovementRegisterEntity>();

            try
            {
                dMSFileMovementRegisterEntityList = FCCDMSFileMovementRegister.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(dMSFileMovementRegisterEntityList ?? new List <DMSFileMovementRegisterEntity>());
        }
        private void SaveDMSFileMovementRegisterEntity()
        {
            if (IsValid)
            {
                try
                {
                    DMSFileMovementRegisterEntity dMSFileMovementRegisterEntity = BuildDMSFileMovementRegisterEntity();

                    Int64 result = -1;

                    if (dMSFileMovementRegisterEntity.IsNew)
                    {
                        result = FCCDMSFileMovementRegister.GetFacadeCreate().Add(dMSFileMovementRegisterEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(DMSFileMovementRegisterEntity.FLD_NAME_FileMovementRegisterID, dMSFileMovementRegisterEntity.FileMovementRegisterID.ToString(), SQLMatchType.Equal);
                        result = FCCDMSFileMovementRegister.GetFacadeCreate().Update(dMSFileMovementRegisterEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        #region Update File Current Location

                        _FileMovementRegisterID = result;

                        DMSFileMovementRegisterEntity _dMSFileMovementRegisterEntity = CurrentDMSFileMovementRegisterEntity;

                        DMSFileTrackingEntity dMSFileTrackingEntity = FCCDMSFileTracking.GetFacadeCreate().GetByID(_dMSFileMovementRegisterEntity.FileTrackingID);
                        dMSFileTrackingEntity.FileCurrentPlace = _dMSFileMovementRegisterEntity.FileMovementPlace;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(DMSFileTrackingEntity.FLD_NAME_FileTrackingID, _dMSFileMovementRegisterEntity.FileTrackingID.ToString(), SQLMatchType.Equal);
                        result = FCCDMSFileTracking.GetFacadeCreate().Update(dMSFileTrackingEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                        #endregion

                        _FileMovementRegisterID        = 0;
                        _DMSFileMovementRegisterEntity = new DMSFileMovementRegisterEntity();
                        PrepareInitialView();
                        BindDMSFileMovementRegisterList();

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