protected void lvBDProjectDocumentTemplate_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 ProjectDocumentTemplateID; Int64.TryParse(e.CommandArgument.ToString(), out ProjectDocumentTemplateID); if (ProjectDocumentTemplateID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _ProjectDocumentTemplateID = ProjectDocumentTemplateID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProjectDocumentTemplateEntity.FLD_NAME_ProjectDocumentTemplateID, ProjectDocumentTemplateID.ToString(), SQLMatchType.Equal); BDProjectDocumentTemplateEntity bDProjectDocumentTemplateEntity = new BDProjectDocumentTemplateEntity(); result = FCCBDProjectDocumentTemplate.GetFacadeCreate().Delete(bDProjectDocumentTemplateEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _ProjectDocumentTemplateID = 0; _BDProjectDocumentTemplateEntity = new BDProjectDocumentTemplateEntity(); PrepareInitialView(); BindBDProjectDocumentTemplateList(); MiscUtil.ShowMessage(lblMessage, "Project Document Template has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Document Template.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private void PrepareEditView() { String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProjectDocumentTemplateMapEntity.FLD_NAME_ProjectDocumentTemplateID, ProjectDocumentTemplateID.ToString(), SQLMatchType.Equal); currentMappedDocuments = FCCBDProjectDocumentTemplateMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); #region Setting check to the documents if (currentMappedDocuments != null && currentMappedDocuments.Count > 0) { foreach (TreeNode tn in treeDocument.Nodes) { IsDocumentNode(tn); } } else { currentMappedDocuments = new List <BDProjectDocumentTemplateMapEntity>(); } currentMappedNodes = treeDocument.CheckedNodes; #endregion }