public IList <CMContractorContactPersonEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <CMContractorContactPersonEntity> cMContractorContactPersonEntityList = new List <CMContractorContactPersonEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = CMContractorContactPersonEntity.FLD_NAME_ContractorContactPersonID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; cMContractorContactPersonEntityList = FCCCMContractorContactPerson.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (cMContractorContactPersonEntityList != null && cMContractorContactPersonEntityList.Count > 0) { totalRowCount = cMContractorContactPersonEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMContractorContactPersonEntityList ?? new List <CMContractorContactPersonEntity>()); }
private void SaveCMContractorContactPersonEntity() { if (IsValid) { try { CMContractorContactPersonEntity cMContractorContactPersonEntity = BuildCMContractorContactPersonEntity(); Int64 result = -1; if (cMContractorContactPersonEntity.IsNew) { result = FCCCMContractorContactPerson.GetFacadeCreate().Add(cMContractorContactPersonEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMContractorContactPersonEntity.FLD_NAME_ContractorContactPersonID, cMContractorContactPersonEntity.ContractorContactPersonID.ToString(), SQLMatchType.Equal); result = FCCCMContractorContactPerson.GetFacadeCreate().Update(cMContractorContactPersonEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _ContractorContactPersonID = 0; _CMContractorContactPersonEntity = new CMContractorContactPersonEntity(); PrepareInitialView(); BindCMContractorContactPersonList(); if (cMContractorContactPersonEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Contractor Contact Person Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Contractor Contact Person Information has been updated successfully.", false); } } else { if (cMContractorContactPersonEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Contractor Contact Person Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Contractor Contact Person Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvCMContractorContactPerson_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 ContractorContactPersonID; Int64.TryParse(e.CommandArgument.ToString(), out ContractorContactPersonID); if (ContractorContactPersonID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _ContractorContactPersonID = ContractorContactPersonID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CMContractorContactPersonEntity.FLD_NAME_ContractorContactPersonID, ContractorContactPersonID.ToString(), SQLMatchType.Equal); CMContractorContactPersonEntity cMContractorContactPersonEntity = new CMContractorContactPersonEntity(); result = FCCCMContractorContactPerson.GetFacadeCreate().Delete(cMContractorContactPersonEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _ContractorContactPersonID = 0; _CMContractorContactPersonEntity = new CMContractorContactPersonEntity(); PrepareInitialView(); BindCMContractorContactPersonList(); MiscUtil.ShowMessage(lblMessage, "Contractor Contact Person has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Contractor Contact Person.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <CMContractorContactPersonEntity> GetData() { IList <CMContractorContactPersonEntity> cMContractorContactPersonEntityList = new List <CMContractorContactPersonEntity>(); try { cMContractorContactPersonEntityList = FCCCMContractorContactPerson.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (cMContractorContactPersonEntityList != null && cMContractorContactPersonEntityList.Count > 0) { totalRowCount = cMContractorContactPersonEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMContractorContactPersonEntityList ?? new List <CMContractorContactPersonEntity>()); }