public IList <CMMeasurementBookEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <CMMeasurementBookEntity> cMMeasurementBookEntityList = new List <CMMeasurementBookEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = CMMeasurementBookEntity.FLD_NAME_MeasurementBookID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; cMMeasurementBookEntityList = FCCCMMeasurementBook.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (cMMeasurementBookEntityList != null && cMMeasurementBookEntityList.Count > 0) { totalRowCount = cMMeasurementBookEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMMeasurementBookEntityList ?? new List <CMMeasurementBookEntity>()); }
private void SaveCMMeasurementBookEntity() { if (IsValid) { try { CMMeasurementBookEntity cMMeasurementBookEntity = BuildCMMeasurementBookEntity(); Int64 result = -1; if (cMMeasurementBookEntity.IsNew) { result = FCCCMMeasurementBook.GetFacadeCreate().Add(cMMeasurementBookEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookEntity.FLD_NAME_MeasurementBookID, cMMeasurementBookEntity.MeasurementBookID.ToString(), SQLMatchType.Equal); result = FCCCMMeasurementBook.GetFacadeCreate().Update(cMMeasurementBookEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _MeasurementBookID = 0; _CMMeasurementBookEntity = new CMMeasurementBookEntity(); PrepareInitialView(); BindCMMeasurementBookList(); if (cMMeasurementBookEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "C MMeasurement Book Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "C MMeasurement Book Information has been updated successfully.", false); } } else { if (cMMeasurementBookEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Measurement Book Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Measurement Book Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvCMMeasurementBook_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 MeasurementBookID; Int64.TryParse(e.CommandArgument.ToString(), out MeasurementBookID); if (MeasurementBookID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _MeasurementBookID = MeasurementBookID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookEntity.FLD_NAME_MeasurementBookID, MeasurementBookID.ToString(), SQLMatchType.Equal); CMMeasurementBookEntity cMMeasurementBookEntity = new CMMeasurementBookEntity(); result = FCCCMMeasurementBook.GetFacadeCreate().Delete(cMMeasurementBookEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _MeasurementBookID = 0; _CMMeasurementBookEntity = new CMMeasurementBookEntity(); PrepareInitialView(); BindCMMeasurementBookList(); MiscUtil.ShowMessage(lblMessage, "C MMeasurement Book has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete C MMeasurement Book.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <CMMeasurementBookEntity> GetData() { IList <CMMeasurementBookEntity> cMMeasurementBookEntityList = new List <CMMeasurementBookEntity>(); try { cMMeasurementBookEntityList = FCCCMMeasurementBook.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (cMMeasurementBookEntityList != null && cMMeasurementBookEntityList.Count > 0) { totalRowCount = cMMeasurementBookEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMMeasurementBookEntityList ?? new List <CMMeasurementBookEntity>()); }
private void UpdateMeasurementBookFloorInfo() { String fe_MeasurementBook = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookEntity.FLD_NAME_MeasurementBookID, CurrentCMMeasurementBook_DetailedEntity.MeasurementBookID.ToString(), SQLMatchType.Equal); CMMeasurementBookEntity cMMeasurementBookEntity = FCCCMMeasurementBook.GetFacadeCreate().GetByID(CurrentCMMeasurementBook_DetailedEntity.MeasurementBookID); if (cMMeasurementBookEntity != null && cMMeasurementBookEntity.MeasurementBookID > 0) { if (ddlProjectFloorID.SelectedValue != "0" && ddlProjectFloorID.Items.Count > 0) { cMMeasurementBookEntity.ProjectFloorID = Int64.Parse(ddlProjectFloorID.SelectedValue); } else { cMMeasurementBookEntity.ProjectFloorID = null; } FCCCMMeasurementBook.GetFacadeCreate().Update(cMMeasurementBookEntity, fe_MeasurementBook, DatabaseOperationType.Update, TransactionRequired.No); } }