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