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