private void tsmiDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.trvTemplateNode.SelectedNode == null)
                {
                    MetroMessageBox.Show(this, "请选择要删除的节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                gpTemplateNodeWebDO gptn = this.trvTemplateNode.SelectedNode.Tag as gpTemplateNodeWebDO;

                if (this.gpTemplateNodeService.Remove(gptn.gtnId))
                {
                    this.LoadTree();
                }
                else
                {
                    MetroMessageBox.Show(this, "删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                MetroMessageBox.Show(this, "删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void trvTemplateNode_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                this.gptnParentId = -1;

                gpTemplateNodeWebDO gptn = e.Node.Tag as gpTemplateNodeWebDO;

                this.txtName.Text                      = gptn.gtnName;
                this.txtFileName.Text                  = gptn.gtnFileName;
                this.cboProjectType.SelectedValue      = gptn.gtnFiletype;
                this.cboCanModify.SelectedValue        = gptn.editState;
                this.cboCanDelete.SelectedValue        = gptn.delState;
                this.cboProperty.SelectedValue         = gptn.gtnAttr;
                this.cboDocumentType.SelectedValue     = gptn.gtnDocType;
                this.cboCanModifyManage.SelectedValue  = gptn.bossEditState;
                this.cboClient.SelectedValue           = gptn.carryState;
                this.cboCanModifyITender.SelectedValue = gptn.biderEditState;
                this.txtSort.Text                      = gptn.sort.ToString();
            }
            catch (Exception ex)
            {
                log.Error(ex);
                MetroMessageBox.Show(this, "获取失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        /// <summary>
        /// Update
        /// </summary>
        /// <param name="gpTemplateNode">gpTemplateNode</param>
        /// <returns>bool</returns>
        public bool Update(gpTemplateNodeWebDO gpTemplateNode)
        {
            if (gpTemplateNode == null)
            {
                throw new ArgumentNullException(nameof(gpTemplateNode));
            }

            return(this.wsAgent.edit(gpTemplateNode).success);
        }
        private void tsmiSubNew_Click(object sender, EventArgs e)
        {
            if (this.trvTemplateNode.SelectedNode == null)
            {
                MetroMessageBox.Show(this, "请选择要添加节点的父节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            this.txtName.Text     = string.Empty;
            this.txtFileName.Text = string.Empty;
            this.txtSort.Text     = string.Empty;

            gpTemplateNodeWebDO gptn = this.trvTemplateNode.SelectedNode.Tag as gpTemplateNodeWebDO;

            this.gptnParentId = gptn.gtnId;
        }
        private void tsmiNew_Click(object sender, EventArgs e)
        {
            this.txtName.Text     = string.Empty;
            this.txtFileName.Text = string.Empty;
            this.txtSort.Text     = string.Empty;

            if (this.trvTemplateNode.SelectedNode == null)
            {
                this.gptnParentId = 0;
            }
            else
            {
                gpTemplateNodeWebDO gptn = this.trvTemplateNode.SelectedNode.Tag as gpTemplateNodeWebDO;
                this.gptnParentId = gptn.gtnPid;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                baseUserWebDO user = Cache.GetInstance().GetValue <baseUserWebDO>("login");

                gpTemplateNodeWebDO gptn = null;

                //修改
                if (this.gptnParentId == -1)
                {
                    gptn         = this.trvTemplateNode.SelectedNode.Tag as gpTemplateNodeWebDO;
                    gptn.optId   = user.auID;
                    gptn.optCoId = user.acId;
                    gptn.optTime = DateTime.Now;
                }
                else //新增
                {
                    gptn                 = new gpTemplateNodeWebDO();
                    gptn.gtId            = gptId;
                    gptn.gtnPid          = this.gptnParentId;
                    gptn.gtnPidSpecified = true;
                    gptn.adtId           = user.auID;
                    gptn.adtCoId         = user.acId;
                    gptn.adtTime         = DateTime.Now;
                }

                gptn.gtnName                 = this.txtName.Text.Trim();
                gptn.gtnFileName             = this.txtFileName.Text.Trim();
                gptn.gtnFiletype             = (int)this.cboProjectType.SelectedValue;
                gptn.gtnFiletypeSpecified    = true;
                gptn.editState               = (int)this.cboCanModify.SelectedValue;
                gptn.editStateSpecified      = true;
                gptn.delState                = (int)this.cboCanDelete.SelectedValue;
                gptn.delStateSpecified       = true;
                gptn.gtnAttr                 = (int)this.cboProperty.SelectedValue;
                gptn.gtnAttrSpecified        = true;
                gptn.gtnDocType              = (int)this.cboDocumentType.SelectedValue;
                gptn.gtnDocTypeSpecified     = true;
                gptn.bossEditState           = (int)this.cboCanModifyManage.SelectedValue;
                gptn.bossEditStateSpecified  = true;
                gptn.carryState              = (int)this.cboClient.SelectedValue;
                gptn.carryStateSpecified     = true;
                gptn.biderEditState          = (int)this.cboCanModifyITender.SelectedValue;
                gptn.biderEditStateSpecified = true;
                gptn.sort          = int.Parse(this.txtSort.Text.Trim());
                gptn.sortSpecified = true;

                //修改
                if (this.gptnParentId == -1)
                {
                    if (this.gpTemplateNodeService.Update(gptn))
                    {
                        this.LoadTree();
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else //新增
                {
                    if (this.gpTemplateNodeService.Add(gptn))
                    {
                        this.gptnParentId = -1;
                        this.LoadTree();
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                MetroMessageBox.Show(this, "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }