Exemplo n.º 1
0
        /// <summary>
        /// 加载窗体
        /// </summary>
        public override void FormOnLoad()
        {
            this.txtTargetTable.Text = this.TableRealName;

            // 表格显示序号的处理部分
            this.DataGridViewOnLoad(grdTable);

            string commandText = string.Empty;
            commandText = " SELECT * FROM " + this.TableName + " WHERE " + this.TableConstraint;
            UserCenterDbHelperService dbHelperService = new UserCenterDbHelperService();
            // BusinessDbHelperService dbHelperService = new BusinessDbHelperService();
            DataTable dt = dbHelperService.Fill(this.UserInfo, commandText);
            dt.TableName = this.TableName;
            // 表格显示序号的处理部分
            this.ProcessTable(dt);
            this.grdTable.AutoGenerateColumns = false;
            this.grdTable.DataSource = dt;
        }
 private void btnTestCondition_Click(object sender, EventArgs e)
 {
     // 设置鼠标繁忙状态,并保留原先的状态
     Cursor holdCursor = this.Cursor;
     this.Cursor = Cursors.WaitCursor;
     try
     {
         if (!this.CheckInput())
         {
             return;
         }
         this.TableConstraint = this.GetConstraintExpression();
         if (string.IsNullOrEmpty(this.TableConstraint))
         {
             MessageBox.Show(AppMessage.MSG9915, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         else
         {
             string commandText = string.Empty;
             commandText = " SELECT COUNT(*) FROM " + this.TableName + " WHERE " + this.TableConstraint;
             UserCenterDbHelperService dbHelperService = new UserCenterDbHelperService();
             // BusinessDbHelperService dbHelperService = new BusinessDbHelperService();
             dbHelperService.ExecuteNonQuery(UserInfo, commandText);
             this.txtTableConstraint.Text = this.TableConstraint;
         }
         // 是否需要有提示信息?
         if (BaseSystemInfo.ShowInformation)
         {
             // 批量保存,进行提示
             MessageBox.Show(AppMessage.MSG9918, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         this.ProcessException(ex);
     }
     finally
     {
         // 设置鼠标默认状态,原来的光标状态
         this.Cursor = holdCursor;
     }
 }