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