Esempio n. 1
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.m_EditStatus = XEditStatus.None;
            if (this.m_PreSelecedNode != null)
            {
                this.m_PreSelecedNode.ForeColor = Color.Black;
            }
            TreeNode currentNode = e.Node;

            currentNode.ForeColor = Color.Blue;
            this.m_PreSelecedNode = currentNode;
            this.InitSavedForm();
            XModelBase model = currentNode.Tag as XModelBase;

            if (e.Node.Parent == null)
            {
                this.chkRootNode.Checked = true;
            }
            else
            {
                this.chkRootNode.Checked = false;
            }
            this.chkRootNode_CheckedChanged(null, null);
            if (model != null)
            {
                this.FillEditControl(model);
            }
        }
Esempio n. 2
0
 protected virtual void Edit()
 {
     this.m_EditStatus = XEditStatus.Edit;
     this.InitEdit();
     this.InitEditForm();
     if (this.ValidateBeforeEdit())
     {
         m_CurrentModel = this.treeView.SelectedNode.Tag as XModelBase;
         if (m_CurrentModel != null)
         {
             this.FillEditControl(m_CurrentModel);
         }
     }
 }
Esempio n. 3
0
        protected virtual void Delete()
        {
            this.m_EditStauts = XEditStatus.Delete;

            if (this.IsSelectedRowByCheckBox())
            {
                if (this.ConfimDelete() == false)
                {
                    return;
                }

                if (this.ValidateDelete() == false)
                {
                    return;
                }

                bool isDeleteSuccess = false;
                try
                {
                    isDeleteSuccess  = this.DeleteOperate();
                    this.m_ErrorInfo = string.Empty;
                }
                catch (Exception ex)
                {
                    this.m_ErrorInfo = ex.ToString();
                    XErrorLogTool.WriteLog(ex.ToString());
                }
                if (isDeleteSuccess)
                {
                    //删除成功
                    this.DeleteRowsFromMemory();
                    if (this.m_IsShowDeleteSuccessMessage)
                    {
                        this.ShowDeleteMessage(true);
                    }
                }
                else
                {
                    //删除失败
                    this.ShowDeleteMessage(false);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 是否需要已存在校验
        /// </summary>
        /// <param name="editStatus"></param>
        /// <param name="control"></param>
        /// <returns></returns>
        protected virtual bool IsNeedExistValidata(XEditStatus editStatus, Control control)
        {
            //是否已存在校验
            bool isNeedValidateTypeExist = false;

            if (editStatus == XEditStatus.AddNew || editStatus == XEditStatus.Copy ||
                editStatus == XEditStatus.AddContinue)
            {
                isNeedValidateTypeExist = true;
            }
            else if (this.m_EditStatus == XEditStatus.Edit)
            {
                if (control.Tag.ToString().Trim() != control.Text.Trim())
                {
                    isNeedValidateTypeExist = true;
                }
            }

            return(isNeedValidateTypeExist);
        }
Esempio n. 5
0
 /// <summary>
 /// 修改
 /// </summary>
 protected virtual void Edit()
 {
     if (!this.IsAllowOperateData)
     {
         return;
     }
     this.m_EditStauts = XEditStatus.Edit;
     if (IsSelectedRow() && ValidateEdit())
     {
         frmEditBase frm = this.GetEditForm();
         if (frm == null)
         {
             return;
         }
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.grdData.Refresh();
             this.EditAfter(frm);
         }
         //this.EditOperate();
     }
 }
Esempio n. 6
0
        protected virtual void AddNew()
        {
            this.m_EditStauts = XEditStatus.AddNew;
            this.GetGridTable();
            if (ValiedateAddNew())
            {
                this.m_TreeModel = this.GetSelectedTreeModel();

                frmEditBase frm = this.GetAddForm(this.m_TreeModel);
                if (frm == null)
                {
                    return;
                }
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.grdData.DataSource = null;
                    this.grdData.DataSource = frm.ModelList;
                    this.grdData.Refresh();
                    this.AddAfter(frm);
                }
                //this.AddNewOperate();
            }
        }
Esempio n. 7
0
 protected virtual void AddNew()
 {
     this.m_EditStatus = XEditStatus.AddNew;
     this.InitAddNew();
     this.InitAddForm();
 }