Пример #1
0
        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);
        }
Пример #2
0
        // 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 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);
                }
            }
        }