public IList <CRMSurveyMasterEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <CRMSurveyMasterEntity> cRMSurveyMasterEntityList = new List <CRMSurveyMasterEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = CRMSurveyMasterEntity.FLD_NAME_SurveyMasterID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; cRMSurveyMasterEntityList = FCCCRMSurveyMaster.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (cRMSurveyMasterEntityList != null && cRMSurveyMasterEntityList.Count > 0) { totalRowCount = cRMSurveyMasterEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cRMSurveyMasterEntityList ?? new List <CRMSurveyMasterEntity>()); }
private void SaveCRMSurveyMasterEntity() { if (IsValid) { try { CRMSurveyMasterEntity cRMSurveyMasterEntity = BuildCRMSurveyMasterEntity(); Int64 result = -1; if (cRMSurveyMasterEntity.IsNew) { result = FCCCRMSurveyMaster.GetFacadeCreate().Add(cRMSurveyMasterEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMSurveyMasterEntity.FLD_NAME_SurveyMasterID, cRMSurveyMasterEntity.SurveyMasterID.ToString(), SQLMatchType.Equal); result = FCCCRMSurveyMaster.GetFacadeCreate().Update(cRMSurveyMasterEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _SurveyMasterID = 0; _CRMSurveyMasterEntity = new CRMSurveyMasterEntity(); PrepareInitialView(); BindCRMSurveyMasterList(); if (cRMSurveyMasterEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Survey Master Information has been added successfully.", false); String NavigationUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMSurvey.aspx", string.Empty, UrlConstants.OVERVIEW_SURVEY_MASTER_ID, result.ToString()).ToString(); Response.Redirect(NavigationUrl); } else { MiscUtil.ShowMessage(lblMessage, "Survey Master Information has been updated successfully.", false); String NavigationUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMSurvey.aspx", string.Empty, UrlConstants.OVERVIEW_SURVEY_MASTER_ID, result.ToString()).ToString(); Response.Redirect(NavigationUrl); } } else { if (cRMSurveyMasterEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Survey Master Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Survey Master Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvCRMSurveyMaster_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 SurveyMasterID; Int64.TryParse(e.CommandArgument.ToString(), out SurveyMasterID); if (SurveyMasterID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _SurveyMasterID = SurveyMasterID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMSurveyMasterEntity.FLD_NAME_SurveyMasterID, SurveyMasterID.ToString(), SQLMatchType.Equal); CRMSurveyMasterEntity cRMSurveyMasterEntity = new CRMSurveyMasterEntity(); result = FCCCRMSurveyMaster.GetFacadeCreate().Delete(cRMSurveyMasterEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _SurveyMasterID = 0; _CRMSurveyMasterEntity = new CRMSurveyMasterEntity(); PrepareInitialView(); BindCRMSurveyMasterList(); MiscUtil.ShowMessage(lblMessage, "Survey Master has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Survey Master.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <CRMSurveyMasterEntity> GetData() { IList <CRMSurveyMasterEntity> cRMSurveyMasterEntityList = new List <CRMSurveyMasterEntity>(); try { cRMSurveyMasterEntityList = FCCCRMSurveyMaster.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (cRMSurveyMasterEntityList != null && cRMSurveyMasterEntityList.Count > 0) { totalRowCount = cRMSurveyMasterEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cRMSurveyMasterEntityList ?? new List <CRMSurveyMasterEntity>()); }