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