private void LoadDesignations(TreeNode department) { Int64 departmentID = Int64.Parse(BayTreeNodeValue.GetValue(department.Value)); IList <MDDesignationEntity> tempDesignationList = (from a in designationList where a.DepartmentID == departmentID select a).ToList(); if (tempDesignationList != null && tempDesignationList.Count > 0) { foreach (MDDesignationEntity ent in tempDesignationList) { BayTreeNodeValue designationNodeValue = new BayTreeNodeValue(); designationNodeValue.Value = ent.DesignationID.ToString(); designationNodeValue.Attributes["NodeType"] = CustomControlConstants.HRNodeType.Designation; TreeNode designation = new TreeNode(); designation.Text = ent.Name; designation.Value = designationNodeValue.GetValueString(); designation.SelectAction = TreeNodeSelectAction.Select; designation.ImageUrl = "~/Images/designation-16.png"; designation.Expanded = false; if (ShowCheckBoxesInAllNodes == true) { designation.ShowCheckBox = true; } department.ChildNodes.Add(designation); } } }
private void PopulateTree() { this.Nodes.Clear(); nodeList = FCCBDMDTaskCategory.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); taskList = FCCBDMDTask.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); if (ProjectID > 0) { String fe_Project_Document = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentInfoEntity.FLD_NAME_ProjectID, ProjectID.ToString(), SQLMatchType.Equal); projectDocumentList = FCCBDProjectCollectedDocumentInfo.GetFacadeCreate().GetIL(null, null, String.Empty, fe_Project_Document, DatabaseOperationType.LoadWithFilterExpression); } TreeNode rootNode = new TreeNode(); BayTreeNodeValue rootNodeValue = new BayTreeNodeValue(); rootNodeValue.Value = "0"; rootNodeValue.Attributes["NodeType"] = CustomControlConstants.DocumentNodeType.RootNode; rootNode.Text = RootNodeText; rootNode.Value = rootNodeValue.GetValueString(); rootNode.SelectAction = TreeNodeSelectAction.Expand; rootNode.Expanded = true; LoadCategories(rootNode, null); this.Nodes.Add(rootNode); }
private Boolean ValidateInput1() { Boolean validationResult = true; if (treeTask.SelectedNode == null) { validationResult = false; MiscUtil.ShowMessage(lblMessage, "Please Select Task Category.", true); } else { try { TreeNode selectedNode = (TreeNode)treeTask.SelectedNode; BayTreeNodeValue selectedNodeValue = new BayTreeNodeValue(); selectedNodeValue.SetValuesFromString(selectedNode.Value); if (selectedNodeValue.Attributes["NodeType"] != CustomControlConstants.DocumentNodeType.Document) { validationResult = false; MiscUtil.ShowMessage(lblMessage, "Please Select Task..", true); } } catch { validationResult = false; MiscUtil.ShowMessage(lblMessage, "Can not determine Task..", true); } } return(validationResult); }
private void BuildTree() { this.Nodes.Clear(); departmentList = FCCMDDepartment.GetFacadeCreate().GetILFC(); designationList = FCCMDDesignation.GetFacadeCreate().GetILFC(); BayTreeNodeValue rootNodeValue = new BayTreeNodeValue(); rootNodeValue.Value = "0"; rootNodeValue.Attributes["NodeType"] = CustomControlConstants.HRNodeType.RootNode; TreeNode rootNode = new TreeNode(); rootNode.Text = "Designation Tree"; rootNode.Value = rootNodeValue.GetValueString(); rootNode.SelectAction = TreeNodeSelectAction.None; rootNode.Expanded = true; LoadDepartments(rootNode); this.Nodes.Add(rootNode); }
private void LoadSubDepartments(TreeNode parentDepartment) { Int64 departmentID = Int64.Parse(BayTreeNodeValue.GetValue(parentDepartment.Value)); IList <MDDepartmentEntity> childDepartmentList = FCCMDDepartment.GetFacadeCreate().GetByParentDepartmentILFC(departmentID); if (childDepartmentList != null && childDepartmentList.Count > 0) { foreach (MDDepartmentEntity ent in childDepartmentList) { BayTreeNodeValue childDepartmentNodeValue = new BayTreeNodeValue(); childDepartmentNodeValue.Value = ent.DepartmentID.ToString(); childDepartmentNodeValue.Attributes["NodeType"] = CustomControlConstants.HRNodeType.Department; TreeNode childDepartment = new TreeNode(); childDepartment.Text = ent.Name; childDepartment.Value = childDepartmentNodeValue.GetValueString(); childDepartment.SelectAction = TreeNodeSelectAction.Select; childDepartment.ImageUrl = "~/Images/department-16.png"; childDepartment.Expanded = false; if (ShowCheckBoxesInAllNodes == true) { childDepartment.ShowCheckBox = true; } LoadSubDepartments(childDepartment); LoadDesignations(childDepartment); parentDepartment.ChildNodes.Add(childDepartment); } } }
private void EditDocument() { Int64 ProjectDocumentID; Int64.TryParse(BayTreeNodeValue.GetValue(treeProjectDocument.SelectedValue), out ProjectDocumentID); if (ProjectDocumentID > 0) { _ProjectDocumentID = ProjectDocumentID; PrepareEditView(); } }
// listType - 1 means from project node, 2 means from template private void IsDocumentNode(TreeNode tn, Int32 listType) { BayTreeNodeValue bayTreeNodeValue = new BayTreeNodeValue(); bayTreeNodeValue.SetValuesFromString(tn.Value); if (bayTreeNodeValue.Attributes["NodeType"] == CustomControlConstants.DocumentNodeType.Document) { Int64 id = Int64.Parse(bayTreeNodeValue.Value); if (listType == 1) { var tempDocument = from s in currentProjectDocuments where s.ProjectDocumentID == id select s; if (tempDocument != null && tempDocument.Count() > 0) { tn.Checked = true; } else { tn.Checked = false; } } else { if (templateDocumentList != null && templateDocumentList.Count > 0) { var tempDocument = from s in templateDocumentList where s.TaskID == id select s; if (tempDocument != null && tempDocument.Count() > 0) { tn.Checked = true; } else { tn.Checked = false; } } } } else { foreach (TreeNode n in tn.ChildNodes) { IsDocumentNode(n, listType); } } }
private void UpdateProjectDocument() { try { newProjectNodes = treeDocument.CheckedNodes; foreach (TreeNode tn in treeDocument.CheckedNodes) { BayTreeNodeValue bayTreeNodeValue = new BayTreeNodeValue(); bayTreeNodeValue.SetValuesFromString(tn.Value); BDProjectCollectedDocumentInfoEntity ent = new BDProjectCollectedDocumentInfoEntity(); ent.ProjectDocumentID = Int64.Parse(bayTreeNodeValue.Value); ent.ProjectID = this.OverviewProjectID; newProjectDocuments.Add(ent); } IList <BDProjectCollectedDocumentInfoEntity> deleteList = currentProjectDocuments.Except(newProjectDocuments, new ProjectDocumentComparer()).ToList(); IList <BDProjectCollectedDocumentInfoEntity> addNewList = newProjectDocuments.Except(currentProjectDocuments, new ProjectDocumentComparer()).ToList(); if (deleteList != null && deleteList.Count > 0) { foreach (BDProjectCollectedDocumentInfoEntity ent in deleteList) { String fe1 = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentInfoEntity.FLD_NAME_ProjectID, this.OverviewProjectID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentInfoEntity.FLD_NAME_ProjectDocumentID, ent.ProjectDocumentID.ToString(), SQLMatchType.Equal); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); FCCBDProjectCollectedDocumentInfo.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No); } } if (addNewList != null && addNewList.Count > 0) { foreach (BDProjectCollectedDocumentInfoEntity ent in addNewList) { FCCBDProjectCollectedDocumentInfo.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No); } } MiscUtil.ShowMessage(lblMessage, "Project Document Updated Successfully.", false); } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true); } }
protected void treeDocument_SelectedNodeChanged(object sender, EventArgs e) { BayTreeNodeValue bayTreeNodeValue = new BayTreeNodeValue(); bayTreeNodeValue.SetValuesFromString(treeDocument.SelectedValue); if (bayTreeNodeValue.Attributes["NodeType"] == CustomControlConstants.DocumentNodeType.Document) { divUpdatePanel.Visible = true; PrepareInitialViewForm(); PrepareEditView(); BindBDProjectCollectedDocumentUploadInfoList(); } else { divUpdatePanel.Visible = false; } }
private void LoadDepartments(TreeNode parentDepartment) { #region Load Main Departments if (departmentList != null && departmentList.Count > 0) { rootDepartmentList = (from a in departmentList where a.ParentDepartmentID == null select a).ToList(); if (rootDepartmentList != null && rootDepartmentList.Count > 0) { foreach (MDDepartmentEntity ent in rootDepartmentList) { BayTreeNodeValue departmentNodeValue = new BayTreeNodeValue(); departmentNodeValue.Value = ent.DepartmentID.ToString(); departmentNodeValue.Attributes["NodeType"] = CustomControlConstants.HRNodeType.Department; TreeNode department = new TreeNode(); department.Text = ent.Name; department.Value = departmentNodeValue.GetValueString(); department.SelectAction = TreeNodeSelectAction.Select; department.Expanded = false; department.ImageUrl = "~/Images/department-16.png"; if (ShowCheckBoxesInAllNodes == true) { parentDepartment.ShowCheckBox = true; } LoadSubDepartments(department); LoadDesignations(department); parentDepartment.ChildNodes.Add(department); } } } #endregion }
private void DeleteTask() { Int64 taskID; Int64.TryParse(BayTreeNodeValue.GetValue(treeTask.SelectedValue), out taskID); if (taskID > 0) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskEntity.FLD_NAME_TaskID, taskID.ToString(), SQLMatchType.Equal); BDMDTaskEntity bdMDTaskEntity = new BDMDTaskEntity(); result = FCCBDMDTask.GetFacadeCreate().Delete(bdMDTaskEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _TaskID = 0; _BDMDTaskEntity = new BDMDTaskEntity(); PrepareInitialView(); LoadTreeView(); MiscUtil.ShowMessage(lblMessage, "Task has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Task.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void DeleteDocument() { Int64 ProjectDocumentID; Int64.TryParse(BayTreeNodeValue.GetValue(treeProjectDocument.SelectedValue), out ProjectDocumentID); if (ProjectDocumentID > 0) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDProjectDocumentEntity.FLD_NAME_ProjectDocumentID, ProjectDocumentID.ToString(), SQLMatchType.Equal); MDProjectDocumentEntity mDProjectDocumentEntity = new MDProjectDocumentEntity(); result = FCCMDProjectDocument.GetFacadeCreate().Delete(mDProjectDocumentEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _ProjectDocumentID = 0; _MDProjectDocumentEntity = new MDProjectDocumentEntity(); PrepareInitialView(); LoadTreeView(); MiscUtil.ShowMessage(lblMessage, "Project Document has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Document.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void EditTask() { Int64 taskID; Int64.TryParse(BayTreeNodeValue.GetValue(treeTask.SelectedValue), out taskID); if (taskID > 0) { _TaskID = taskID; PrepareEditView(); if (chkIsRepeat.Checked) { dvRepeatInfo.Visible = true; PrepareEditViewRepeat(); } else if (chkIsRepeat.Checked == false) { dvRepeatInfo.Visible = false; } } }
private void IsDocumentNode(TreeNode tn) { BayTreeNodeValue bayTreeNodeValue = new BayTreeNodeValue(); bayTreeNodeValue.SetValuesFromString(tn.Value); if (bayTreeNodeValue.Attributes["NodeType"] == CustomControlConstants.DocumentNodeType.Document) { Int64 id = Int64.Parse(bayTreeNodeValue.Value); var tempDocument = from s in currentMappedDocuments where s.TaskID == id select s; if (tempDocument != null && tempDocument.Count() > 0) { tn.Checked = true; } } else { foreach (TreeNode n in tn.ChildNodes) { IsDocumentNode(n); } } }
private void LoadCategories(TreeNode parentNode, Int64?parentTaskCategoryID) { #region Load Main Categories if (ProjectID > 0 && projectDocumentList == null) { return; } if (nodeList != null && nodeList.Count > 0) { subCategoryNodeList = (from a in nodeList where a.ParentTaskCategoryID == parentTaskCategoryID select a).ToList(); if (subCategoryNodeList != null && subCategoryNodeList.Count > 0) { foreach (BDMDTaskCategoryEntity ent in subCategoryNodeList) { TreeNode category = new TreeNode(); BayTreeNodeValue categoryNodeValue = new BayTreeNodeValue(); categoryNodeValue.Value = ent.TaskCategoryID.ToString(); categoryNodeValue.Attributes["NodeType"] = CustomControlConstants.DocumentNodeType.DocumentCategory; category.ImageUrl = ImageConstants.DOCUMENT_CATEGORY; category.Text = ent.Name; category.Value = categoryNodeValue.GetValueString(); category.SelectAction = TreeNodeSelectAction.SelectExpand; category.Expanded = false; LoadCategories(category, ent.TaskCategoryID); #region Loading the Documents if (taskList != null && taskList.Count > 0) { catTaskList = (from d in taskList where d.TaskCategoryID == ent.TaskCategoryID select d).ToList(); #region If Project Id is setup, the list will be filtered by the project id if (ProjectID > 0) { IList <MDProjectDocumentEntity> felteredDocumentList = new List <MDProjectDocumentEntity>(); if (projectDocumentList != null && projectDocumentList.Count > 0) { foreach (BDProjectCollectedDocumentInfoEntity proDocEnt in projectDocumentList) { // IList<BDMDTaskEntity> tempCatDocumentList = (from pd in catTaskList // where pd.TaskID == proDocEnt.TaskID // select pd).ToList(); //if (tempCatDocumentList != null && tempCatDocumentList.Count > 0) //{ //foreach (BDMDTaskEntitytempDocEnt in tempCatDocumentList) //{ //felteredDocumentList.Add(tempDocEnt); //} //} } //catDocumentList = felteredDocumentList; } } #endregion foreach (BDMDTaskEntity docEnt in catTaskList) { TreeNode docNode = new TreeNode(); BayTreeNodeValue docNodeValue = new BayTreeNodeValue(); docNodeValue.Value = docEnt.TaskID.ToString(); docNodeValue.Attributes["NodeType"] = CustomControlConstants.DocumentNodeType.Document; docNode.Text = docEnt.Name; docNode.Value = docNodeValue.GetValueString(); docNode.SelectAction = TreeNodeSelectAction.Select; docNode.ImageUrl = ImageConstants.DOCUMENT; docNode.Expanded = false; if (ShowCheckBoxesInDocumentNodes == true) { docNode.ShowCheckBox = true; } category.ChildNodes.Add(docNode); } } #endregion if (ProjectID == 0) { parentNode.ChildNodes.Add(category); } else if (category.ChildNodes.Count > 0) { parentNode.ChildNodes.Add(category); } } } } #endregion }
private void SaveBDMDTaskEntity() { if (IsValid) { try { BDMDTaskEntity bDMDTaskEntity = BuildBDMDTaskEntity(); Int64 result = -1; Boolean insertValidation = true; if (bDMDTaskEntity.IsNew) { if (ValidateInput()) { if (treeTask.SelectedNode != null) { bDMDTaskEntity.TaskCategoryID = Int64.Parse(BayTreeNodeValue.GetValue(treeTask.SelectedValue)); } result = FCCBDMDTask.GetFacadeCreate().Add(bDMDTaskEntity, DatabaseOperationType.Add, TransactionRequired.No); if (result > 0 && chkIsRepeat.Checked == true) { BDMDTaskRepeatEntity bDMDTaskRepeatEntity = BuildBDMDTaskRepeatEntity(); bDMDTaskRepeatEntity.TaskID = result; Int64 resultC = -1; resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Add(bDMDTaskRepeatEntity, DatabaseOperationType.Add, TransactionRequired.No); } } else { insertValidation = false; } } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskEntity.FLD_NAME_TaskID, bDMDTaskEntity.TaskID.ToString(), SQLMatchType.Equal); result = FCCBDMDTask.GetFacadeCreate().Update(bDMDTaskEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); if (result > 0) { String fe = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskRepeatEntity.FLD_NAME_TaskID, result.ToString(), SQLMatchType.Equal); IList <BDMDTaskRepeatEntity> lst = FCCBDMDTaskRepeat.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); Int64 resultC = -1; BDMDTaskRepeatEntity bDMDTaskRepeatEntity = BuildBDMDTaskRepeatEntity(); bDMDTaskRepeatEntity.TaskID = result; if (chkIsRepeat.Checked == true) { if (lst != null && lst.Count > 0) { String filterExpression_taskRepeat = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskRepeatEntity.FLD_NAME_TaskRepeatID, bDMDTaskRepeatEntity.TaskRepeatID.ToString(), SQLMatchType.Equal); resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Update(bDMDTaskRepeatEntity, filterExpression_taskRepeat, DatabaseOperationType.Update, TransactionRequired.No); } else { resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Add(bDMDTaskRepeatEntity, DatabaseOperationType.Add, TransactionRequired.No); } } else if (chkIsRepeat.Checked == false) { if (lst != null && lst.Count > 0) { String filterExpression_taskRepeat = SqlExpressionBuilder.PrepareFilterExpression(BDMDTaskRepeatEntity.FLD_NAME_TaskRepeatID, bDMDTaskRepeatEntity.TaskRepeatID.ToString(), SQLMatchType.Equal); resultC = FCCBDMDTaskRepeat.GetFacadeCreate().Delete(bDMDTaskRepeatEntity, filterExpression_taskRepeat, DatabaseOperationType.Delete, TransactionRequired.No); } } } } if (insertValidation) { if (result > 0) { _TaskID = 0; _BDMDTaskEntity = new BDMDTaskEntity(); PrepareInitialView(); BindBDMDTaskList(); _TaskRepeatID = 0; _BDMDTaskRepeatEntity = new BDMDTaskRepeatEntity(); PrepareInitialViewRepeat(); if (bDMDTaskEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Task Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Task Information has been updated successfully.", false); } } else { if (bDMDTaskEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Task Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Task Information.", false); } } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void SaveMDProjectDocumentEntity() { if (IsValid) { try { MDProjectDocumentEntity mDProjectDocumentEntity = BuildMDProjectDocumentEntity(); Int64 result = -1; Boolean insertValidation = true; if (mDProjectDocumentEntity.IsNew) { if (ValidateInput()) { if (treeProjectDocument.SelectedNode != null) { mDProjectDocumentEntity.ProjectDocumentCategoryID = Int64.Parse(BayTreeNodeValue.GetValue(treeProjectDocument.SelectedValue)); } result = FCCMDProjectDocument.GetFacadeCreate().Add(mDProjectDocumentEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { insertValidation = false; } } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDProjectDocumentEntity.FLD_NAME_ProjectDocumentID, mDProjectDocumentEntity.ProjectDocumentID.ToString(), SQLMatchType.Equal); result = FCCMDProjectDocument.GetFacadeCreate().Update(mDProjectDocumentEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (insertValidation) { if (result > 0) { _ProjectDocumentID = 0; _MDProjectDocumentEntity = new MDProjectDocumentEntity(); PrepareInitialViewForm(); if (mDProjectDocumentEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Project Document Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Project Document Information has been updated successfully.", false); } LoadTreeView(); } else { if (mDProjectDocumentEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Project Document Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Project Document Information.", false); } } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }