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