Esempio n. 1
0
        /// <summary>
        /// 选择绘图
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void innerChartBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            innerChartPath = innerChartBox.Text;
            string    id        = idTable[innerChartPath].ToString();
            Hashtable infoTable = null;

            lDescription.Text = "子绘图描述";

            if (diagramTable[id] == null)
            {
                DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
                infoTable        = dataBaseManager.GetDiagramData(id) as Hashtable;
                diagramTable[id] = infoTable;
            }
            else
            {
                infoTable = diagramTable[id] as Hashtable;
            }

            if (infoTable != null)
            {
                Hashtable customData = infoTable["customData"] as Hashtable;

                if (customData != null)
                {
                    string description = customData["description"] as string;

                    if (description != null)
                    {
                        lDescription.Text = description;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 选择恢复
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (dataGridViewX1.SelectedCells.Count >= 0)
            {
                string          id = dataGridViewX1.SelectedCells[0].OwningRow.Tag.ToString();
                DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
                string          lockUser        = dataBaseManager.Diagram_WhoLocked(int.Parse(originID));

                if (lockUser == null)
                {
                    bool success = dataBaseManager.RestoreDiagramData(originID, id);

                    if (success)
                    {
                        MessageBox.Show("绘图恢复成功!", "恢复绘图", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DialogResult = DialogResult.OK;
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("该绘图当前被{0}锁定!"), "恢复绘图", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("请先选择要恢复的绘图版本!", "恢复绘图", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 创建绘图
        /// </summary>
        /// <param name="flowChartManager">绘图管理器</param>
        /// <param name="logicData">逻辑数据</param>
        /// <returns>是否操作成功</returns>
        protected virtual bool LogicCreateChart(FlowChartManager flowChartManager, object logicData)
        {
            DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
            DocumentManager documentManager = DocumentManager.GetDocumentManager();
            TreeView        tree            = logicData as TreeView;
            TreeNode        currentNode     = tree.SelectedNode;

            InputForm iForm = new InputForm("请输入新建绘图的名称", "新建绘图");

            if (iForm.ShowDialog() == DialogResult.OK)
            {
                TreeNode newNode = currentNode.Nodes.Add(iForm.InputText);
                newNode.ImageIndex              = 1;
                newNode.SelectedImageIndex      = 1;
                tree.SelectedNode               = newNode;
                documentManager.CurrentTreeMode = EditMode.Normal;

                // 对数据库进行操作
                string path = documentManager.GetNodePath(newNode);
                string id   = dataBaseManager.CreateNewDiagram(path, false, documentManager.CurrentChartMode);
                newNode.Tag = id;
            }

            return(true);
        }
Esempio n. 4
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private void Init()
        {
            // 初始化数据库管理器
            dataBaseManager = DataBaseManager.GetDataBaseManager();

            // 初始化分类管理器
            documentManager                         = DocumentManager.GetDocumentManager();
            documentManager.TreeMenu                = this.bTreeMenu;
            documentManager.UndoButton              = this.bUndoCommand;
            documentManager.RedoButton              = this.bRedoCommand;
            documentManager.CommandSwitchButton     = this.bCommandSwitch;
            documentManager.CurrentTabControl       = this.canvasGroupContainer;
            documentManager.TreeTabControl          = this.treeContainer;
            documentManager.CurrentAbbreviateCanvas = this.abbreviateCanvas;
            documentManager.CurrentPropertyGrid     = this.propertyGrid1;
            documentManager.LogBox                  = this.LogEditBox;
            documentManager.TreePanel               = this.expandablePanel1;
            documentManager.TreeImageList           = this.treeNodeImageList;
            documentManager.ScaleComboBox           = this.canvasScaleBox;
            documentManager.AddDiagramRecordButton(this.bLatestDiagram1);
            documentManager.AddDiagramRecordButton(this.bLatestDiagram2);
            documentManager.AddDiagramRecordButton(this.bLatestDiagram3);
            documentManager.AddDiagramRecordButton(this.bLatestDiagram4);
            documentManager.AddDiagramRecordButton(this.bLatestDiagram5);
            documentManager.Init();

            // 显示数据库名称
            LDBName.Text = dataBaseManager.Connection.Database;

            #if (!DEBUG) // 自动隐藏日志条
            barLog.AutoHide = true;
            #endif
        }
Esempio n. 5
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="canvas">绘图板实例</param>
        /// <param name="propertyGrid">属性面板实例</param>
        public void Init(Canvas canvas)
        {
            graphManager    = new GraphManager(this, canvas);
            dataManager     = new DataManager(this);
            dataBaseManager = DataBaseManager.GetDataBaseManager();
            int i = path.IndexOf('\\');

            mapName             = path.Substring(0, i);
            flowChartInteractor = new FlowChartInteractor();
        }
Esempio n. 6
0
        /// <summary>
        /// 重载数据
        /// </summary>
        public void Reload()
        {
            string          sqlString       = string.Format("SELECT Top 25 * FROM DiagramLog ORDER BY OperateTime DESC");
            DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();

            logTable = dataBaseManager.GetDataTable(sqlString);

            // 加载数据行
            dataGridViewX1.Rows.Clear();
            int           index    = 0;
            List <string> userList = new List <string>();

            userList.Add("所有用户");
            List <string> operationList = new List <string>();

            operationList.Add("所有操作");

            foreach (DataRow row in logTable.Rows)
            {
                dataGridViewX1.Rows.Add(1);
                DataGridViewRow newRow    = dataGridViewX1.Rows[index];
                string          hostName  = row["HostName"].ToString();
                string          operation = row["Operation"].ToString();

                newRow.Cells["HostName"].Value    = hostName;
                newRow.Cells["Operation"].Value   = operation;
                newRow.Cells["OperateTime"].Value = row["OperateTime"].ToString();
                newRow.Cells["Success"].Value     = row["Success"].ToString();
                newRow.Cells["Description"].Value = row["Description"].ToString();

                if (!userList.Contains(hostName))
                {
                    userList.Add(hostName);
                }

                if (!operationList.Contains(operation))
                {
                    operationList.Add(operation);
                }

                index++;
            }

            // 添加下拉框内容
            comboBoxEx1.Items.Clear();
            comboBoxEx1.Items.AddRange(userList.ToArray());
            comboBoxEx1.SelectedIndex = 0;
            comboBoxEx2.Items.Clear();
            comboBoxEx2.Items.AddRange(operationList.ToArray());
            comboBoxEx2.SelectedIndex = 0;
            dateTimeInput1.Value      = DateTime.Now.AddDays(-1);
            dateTimeInput2.Value      = DateTime.Now;
        }
Esempio n. 7
0
        /// <summary>
        /// 初始化子绘图数据表
        /// </summary>
        private void InitGraphTable()
        {
            if (!string.IsNullOrEmpty(innerChartPath))
            {
                DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
                string          fullPath        = string.Format(@"子绘图\{0}", innerChartPath);
                Hashtable       infoTable       = dataBaseManager.GetDiagramDataByPath(fullPath, "AI图") as Hashtable;

                if (infoTable != null)
                {
                    Hashtable logicData = infoTable["logicData"] as Hashtable;
                    graphTable = logicData["graphTable"] as Hashtable;
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 保存日志
        /// </summary>
        /// <param name="operation">当前操作</param>
        /// <param name="description">操作描述</param>
        /// <param name="success">是否操作成功</param>
        public void SaveLog(string operation, string description, bool success)
        {
            string hostName   = Dns.GetHostName();
            string strSuccess = "0";

            if (success)
            {
                strSuccess = "1";
            }

            string sqlString = string.Format("INSERT INTO {0} ([HostName], [Operation], [OperateTime], [Success], [Description]) VALUES ('{1}', '{2}', GetDate(), {3}, '{4}')",
                                             logTableName, hostName, operation, strSuccess, description);
            DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();

            dataBaseManager.ExecuteSqlCommand(sqlString);
        }
Esempio n. 9
0
        /// <summary>
        /// 过滤日志
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX1_Click(object sender, EventArgs e)
        {
            string hostName         = comboBoxEx1.Text;
            string selectHostString = string.Format("HostName = '{0}'", hostName);

            if (hostName == "所有用户")
            {
                selectHostString = "";
            }

            string operation             = comboBoxEx2.Text;
            string selectOperationString = string.Format("Operation = '{0}'", operation);

            if (operation == "所有操作")
            {
                selectOperationString = "";
            }

            DateTime startTime = dateTimeInput1.Value;

            startTime = startTime.AddHours(-dateTimeInput1.Value.Hour);
            startTime = startTime.AddMinutes(-dateTimeInput1.Value.Minute);
            startTime = startTime.AddSeconds(-dateTimeInput1.Value.Second);

            DateTime endTime = dateTimeInput2.Value;

            endTime = endTime.AddHours(23 - dateTimeInput2.Value.Hour);
            endTime = endTime.AddMinutes(59 - dateTimeInput2.Value.Minute);
            endTime = endTime.AddSeconds(59 - dateTimeInput2.Value.Second);

            string selectString = string.Format("SELECT * FROM DiagramLog WHERE OperateTime >= '{0}' AND OperateTime <= '{1}'",
                                                startTime, endTime);

            if (selectHostString != "")
            {
                selectString += string.Format(" AND {0}", selectHostString);
            }

            if (selectOperationString != "")
            {
                selectString += string.Format(" AND {0}", selectOperationString);
            }

            DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();

            logTable = dataBaseManager.GetDataTable(selectString);

            // 加载数据行
            dataGridViewX1.Rows.Clear();
            int index = 0;

            foreach (DataRow row in logTable.Rows)
            {
                dataGridViewX1.Rows.Add(1);
                DataGridViewRow newRow = dataGridViewX1.Rows[index];

                newRow.Cells["HostName"].Value    = row["HostName"].ToString();
                newRow.Cells["Operation"].Value   = row["Operation"].ToString();
                newRow.Cells["OperateTime"].Value = row["OperateTime"].ToString();
                newRow.Cells["Success"].Value     = row["Success"].ToString();
                newRow.Cells["Description"].Value = row["Description"].ToString();

                index++;
            }
        }