public IList <CMConstructionToolDetailEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <CMConstructionToolDetailEntity> cMConstructionToolDetailEntityList = new List <CMConstructionToolDetailEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = CMConstructionToolDetailEntity.FLD_NAME_ConstructionToolDetailID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; cMConstructionToolDetailEntityList = FCCCMConstructionToolDetail.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (cMConstructionToolDetailEntityList != null && cMConstructionToolDetailEntityList.Count > 0) { totalRowCount = cMConstructionToolDetailEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMConstructionToolDetailEntityList ?? new List <CMConstructionToolDetailEntity>()); }
private void PopulateTree() { this.Nodes.Clear(); nodeList = FCCCMConstructionTool.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); toolDetailList = FCCCMConstructionToolDetail.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); TreeNode rootNode = new TreeNode(); rootNode.Text = RootNodeText; rootNode.Value = "0"; rootNode.SelectAction = TreeNodeSelectAction.Expand; rootNode.Expanded = true; LoadCategories(rootNode); this.Nodes.Add(rootNode); }
public IList <CMConstructionToolDetailEntity> GetData() { IList <CMConstructionToolDetailEntity> cMConstructionToolDetailEntityList = new List <CMConstructionToolDetailEntity>(); try { cMConstructionToolDetailEntityList = FCCCMConstructionToolDetail.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (cMConstructionToolDetailEntityList != null && cMConstructionToolDetailEntityList.Count > 0) { totalRowCount = cMConstructionToolDetailEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMConstructionToolDetailEntityList ?? new List <CMConstructionToolDetailEntity>()); }
protected void lvCMConstructionToolDetail_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 ConstructionToolDetailID; Int64.TryParse(e.CommandArgument.ToString(), out ConstructionToolDetailID); if (ConstructionToolDetailID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _ConstructionToolDetailID = ConstructionToolDetailID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { #region Resource Delete Int64 resultOne = -1; String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ConstructionToolDetailID.ToString(), SQLMatchType.Equal); String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.TOOL.ToString(), SQLMatchType.Equal); String fe_re = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re); IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression); foreach (ResourceEntity ent in resourceList) { String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal); resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No); } #endregion if (resultOne == 0) { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CMConstructionToolDetailEntity.FLD_NAME_ConstructionToolDetailID, ConstructionToolDetailID.ToString(), SQLMatchType.Equal); CMConstructionToolDetailEntity cMConstructionToolDetailEntity = new CMConstructionToolDetailEntity(); result = FCCCMConstructionToolDetail.GetFacadeCreate().Delete(cMConstructionToolDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _ConstructionToolDetailID = 0; _CMConstructionToolDetailEntity = new CMConstructionToolDetailEntity(); PrepareInitialView(); BindCMConstructionToolDetailList(); MiscUtil.ShowMessage(lblMessage, "Construction Tool Detail has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Construction Tool Detail.", true); } } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Construction Tool Detail and Resource Information.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private void SaveCMConstructionToolDetailEntity() { if (IsValid) { try { CMConstructionToolDetailEntity cMConstructionToolDetailEntity = BuildCMConstructionToolDetailEntity(); Int64 result = -1; if (cMConstructionToolDetailEntity.IsNew) { result = FCCCMConstructionToolDetail.GetFacadeCreate().Add(cMConstructionToolDetailEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMConstructionToolDetailEntity.FLD_NAME_ConstructionToolDetailID, cMConstructionToolDetailEntity.ConstructionToolDetailID.ToString(), SQLMatchType.Equal); result = FCCCMConstructionToolDetail.GetFacadeCreate().Update(cMConstructionToolDetailEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _ConstructionToolDetailID = 0; _CMConstructionToolDetailEntity = new CMConstructionToolDetailEntity(); PrepareInitialView(); BindCMConstructionToolDetailList(); if (cMConstructionToolDetailEntity.IsNew) { #region Adding Rsource Information ResourceEntity resourceEntity = new ResourceEntity(); resourceEntity.ReferenceID = result; // means new contractor id resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.TOOL; FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No); #endregion MiscUtil.ShowMessage(lblMessage, "Construction Tool Detail Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Construction Tool Detail Information has been updated successfully.", false); } } else { if (cMConstructionToolDetailEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Construction Tool Detail Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Construction Tool Detail Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }