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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = PRMWorkOrderPaymentTermEntity.FLD_NAME_WorkOrderPaymentTermID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                pRMWorkOrderPaymentTermEntityList = FCCPRMWorkOrderPaymentTerm.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(pRMWorkOrderPaymentTermEntityList ?? new List <PRMWorkOrderPaymentTermEntity>());
        }
        private void SavePRMWorkOrderPaymentTermEntity()
        {
            if (IsValid)
            {
                try
                {
                    PRMWorkOrderPaymentTermEntity pRMWorkOrderPaymentTermEntity = BuildPRMWorkOrderPaymentTermEntity();

                    Int64 result = -1;

                    if (pRMWorkOrderPaymentTermEntity.IsNew)
                    {
                        result = FCCPRMWorkOrderPaymentTerm.GetFacadeCreate().Add(pRMWorkOrderPaymentTermEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderPaymentTermEntity.FLD_NAME_WorkOrderPaymentTermID, pRMWorkOrderPaymentTermEntity.WorkOrderPaymentTermID.ToString(), SQLMatchType.Equal);
                        result = FCCPRMWorkOrderPaymentTerm.GetFacadeCreate().Update(pRMWorkOrderPaymentTermEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _WorkOrderPaymentTermID        = 0;
                        _PRMWorkOrderPaymentTermEntity = new PRMWorkOrderPaymentTermEntity();
                        PrepareInitialView();
                        BindPRMWorkOrderPaymentTermList();

                        if (pRMWorkOrderPaymentTermEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Work Order Payment Term Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Work Order Payment Term Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (pRMWorkOrderPaymentTermEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Work Order Payment Term Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Work Order Payment Term Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvPRMWorkOrderPaymentTerm_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 WorkOrderPaymentTermID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderPaymentTermEntity.FLD_NAME_WorkOrderPaymentTermID, WorkOrderPaymentTermID.ToString(), SQLMatchType.Equal);

                        PRMWorkOrderPaymentTermEntity pRMWorkOrderPaymentTermEntity = new PRMWorkOrderPaymentTermEntity();


                        result = FCCPRMWorkOrderPaymentTerm.GetFacadeCreate().Delete(pRMWorkOrderPaymentTermEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _WorkOrderPaymentTermID        = 0;
                            _PRMWorkOrderPaymentTermEntity = new PRMWorkOrderPaymentTermEntity();
                            PrepareInitialView();
                            BindPRMWorkOrderPaymentTermList();

                            MiscUtil.ShowMessage(lblMessage, "Work Order Payment Term has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Work Order Payment Term.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <PRMWorkOrderPaymentTermEntity> GetData()
        {
            IList <PRMWorkOrderPaymentTermEntity> pRMWorkOrderPaymentTermEntityList = new List <PRMWorkOrderPaymentTermEntity>();

            try
            {
                pRMWorkOrderPaymentTermEntityList = FCCPRMWorkOrderPaymentTerm.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(pRMWorkOrderPaymentTermEntityList ?? new List <PRMWorkOrderPaymentTermEntity>());
        }