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