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 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(); } }
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 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); } } }