Ejemplo n.º 1
0
        /// <summary>
        /// 新增按钮事件
        /// </summary>
        private void btnNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                DataRow baseRow = TableStnModule.NewRow();
                TableStnModule.Rows.Add(baseRow);
                bindingSource_StnModule.MoveLast();

                ColumnView headView = (ColumnView)gridControlStnModule.FocusedView;
                gridViewStnModule.FocusedRowHandle = headView.FocusedRowHandle;

                copyRow = null;

                Set_ButtonEditGrid_State(false);
                textFunctionDesc.Focus();
                QueryDeliveryDetail("");
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--新增按钮事件错误。", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 复制按钮事件
        /// </summary>
        private void btnCopy_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FrmMainDAO.QueryUserButtonPower(this.Name, this.Text, sender, true))
                {
                    return;
                }

                DataRow headRow;
                string  tmpSMNoStr = DataTypeConvert.GetString(textCommon.Tag);
                if (tmpSMNoStr != "")
                {
                    DataTable tmpTable = TableStnModule.Clone();
                    smDAO.QueryStnModule(tmpTable, "", "", 0, tmpSMNoStr, "", false);

                    btnNew_Click(null, null);

                    copyRow = tmpTable.Rows[0];
                }
                else
                {
                    if (TableStnModule.Rows.Count == 0 || bindingSource_StnModule.Current == null)
                    {
                        MessageHandler.ShowMessageBox("当前没有功能模块信息记录,不能进行复制。");
                        return;
                    }

                    headRow = ((DataRowView)bindingSource_StnModule.Current).Row;
                    DataTable tmpTable = TableStnModule.Clone();
                    tmpTable.ImportRow(headRow);

                    btnNew_Click(null, null);

                    copyRow = tmpTable.Rows[0];
                }

                headRow = ((DataRowView)bindingSource_StnModule.Current).Row;
                headRow["FunctionDesc"]   = copyRow["FunctionDesc"];
                headRow["FunctionDetail"] = copyRow["FunctionDetail"];
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(this.Text + "--复制按钮事件错误。", ex);
            }
        }