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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMNERPCommentEntity.FLD_NAME_CommentID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cMNERPCommentEntityList = FCCCMNERPComment.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cMNERPCommentEntityList ?? new List <CMNERPCommentEntity>());
        }
        public static IList <CMNERPCommentEntity> GetAllCommentByProcessAndReference(Int64 processCategoryID, Int64 referenceID)
        {
            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMNERPCommentEntity.FLD_NAME_ProcessCategoryID, processCategoryID.ToString(), SQLMatchType.Equal);
            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CMNERPCommentEntity.FLD_NAME_ReferenceID, referenceID.ToString(), SQLMatchType.Equal);
            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

            IList <CMNERPCommentEntity> list = FCCCMNERPComment.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            return(list);
        }
        private void SaveCMNERPCommentEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMNERPCommentEntity cMNERPCommentEntity = BuildCMNERPCommentEntity();

                    Int64 result = -1;

                    if (cMNERPCommentEntity.IsNew)
                    {
                        result = FCCCMNERPComment.GetFacadeCreate().Add(cMNERPCommentEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMNERPCommentEntity.FLD_NAME_CommentID, cMNERPCommentEntity.CommentID.ToString(), SQLMatchType.Equal);
                        result = FCCCMNERPComment.GetFacadeCreate().Update(cMNERPCommentEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _CommentID           = 0;
                        _CMNERPCommentEntity = new CMNERPCommentEntity();
                        PrepareInitialView();
                        BindCMNERPCommentList();

                        if (cMNERPCommentEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Comment Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Comment Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cMNERPCommentEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Comment Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C MNERPComment Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCMNERPComment_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 CommentID;

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

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMNERPCommentEntity.FLD_NAME_CommentID, CommentID.ToString(), SQLMatchType.Equal);

                        CMNERPCommentEntity cMNERPCommentEntity = new CMNERPCommentEntity();


                        result = FCCCMNERPComment.GetFacadeCreate().Delete(cMNERPCommentEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _CommentID           = 0;
                            _CMNERPCommentEntity = new CMNERPCommentEntity();
                            PrepareInitialView();
                            BindCMNERPCommentList();

                            MiscUtil.ShowMessage(lblMessage, "C MNERPComment has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C MNERPComment.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <CMNERPCommentEntity> GetData()
        {
            IList <CMNERPCommentEntity> cMNERPCommentEntityList = new List <CMNERPCommentEntity>();

            try
            {
                cMNERPCommentEntityList = FCCCMNERPComment.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cMNERPCommentEntityList ?? new List <CMNERPCommentEntity>());
        }
        public static Int64 CreateComment(Int64 processCategory, Int64 referenceID, String comments, Int64 employeeID)
        {
            Int64 commentID = 0;

            try
            {
                CMNERPCommentEntity cMNERPCommentEntity = new CMNERPCommentEntity();
                cMNERPCommentEntity.ProcessCategoryID = processCategory;
                cMNERPCommentEntity.ReferenceID       = referenceID;
                cMNERPCommentEntity.Comment           = comments;
                cMNERPCommentEntity.CommentDate       = DateTime.Now;
                cMNERPCommentEntity.IP         = MiscUtil.GetLocalIP();
                cMNERPCommentEntity.EmployeeID = employeeID;

                commentID = FCCCMNERPComment.GetFacadeCreate().Add(cMNERPCommentEntity, DatabaseOperationType.Add, TransactionRequired.No);
            }
            catch (Exception ex)
            {
            }

            return(commentID);
        }
        public static IList <CMNERPCommentEntity> GetAllComments()
        {
            IList <CMNERPCommentEntity> list = FCCCMNERPComment.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

            return(list);
        }