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