public IList <MDAssetConditionEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <MDAssetConditionEntity> mDAssetConditionEntityList = new List <MDAssetConditionEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = MDAssetConditionEntity.FLD_NAME_AssetConditionID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; mDAssetConditionEntityList = FCCMDAssetCondition.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (mDAssetConditionEntityList != null && mDAssetConditionEntityList.Count > 0) { totalRowCount = mDAssetConditionEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDAssetConditionEntityList ?? new List <MDAssetConditionEntity>()); }
private void SaveMDAssetConditionEntity() { if (IsValid) { try { MDAssetConditionEntity mDAssetConditionEntity = BuildMDAssetConditionEntity(); Int64 result = -1; if (mDAssetConditionEntity.IsNew) { result = FCCMDAssetCondition.GetFacadeCreate().Add(mDAssetConditionEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDAssetConditionEntity.FLD_NAME_AssetConditionID, mDAssetConditionEntity.AssetConditionID.ToString(), SQLMatchType.Equal); result = FCCMDAssetCondition.GetFacadeCreate().Update(mDAssetConditionEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _AssetConditionID = 0; _MDAssetConditionEntity = new MDAssetConditionEntity(); PrepareInitialView(); BindMDAssetConditionList(); if (mDAssetConditionEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Asset Condition Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Asset Condition Information has been updated successfully.", false); } } else { if (mDAssetConditionEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Asset Condition Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Asset Condition Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvMDAssetCondition_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 AssetConditionID; Int64.TryParse(e.CommandArgument.ToString(), out AssetConditionID); if (AssetConditionID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _AssetConditionID = AssetConditionID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAssetConditionEntity.FLD_NAME_AssetConditionID, AssetConditionID.ToString(), SQLMatchType.Equal); MDAssetConditionEntity mDAssetConditionEntity = new MDAssetConditionEntity(); result = FCCMDAssetCondition.GetFacadeCreate().Delete(mDAssetConditionEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _AssetConditionID = 0; _MDAssetConditionEntity = new MDAssetConditionEntity(); PrepareInitialView(); BindMDAssetConditionList(); MiscUtil.ShowMessage(lblMessage, "Asset Condition has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Asset Condition.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <MDAssetConditionEntity> GetData() { IList <MDAssetConditionEntity> mDAssetConditionEntityList = new List <MDAssetConditionEntity>(); try { mDAssetConditionEntityList = FCCMDAssetCondition.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (mDAssetConditionEntityList != null && mDAssetConditionEntityList.Count > 0) { totalRowCount = mDAssetConditionEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDAssetConditionEntityList ?? new List <MDAssetConditionEntity>()); }