ab56a9bcf7
SVN-Revision: r240
128 lines
3.7 KiB
C#
128 lines
3.7 KiB
C#
using Lskj.Business.Impl;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Timers;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.Control
|
|
{
|
|
public partial class FrmProgressBar : BaseForm
|
|
{
|
|
public ProgressBar progressBar { get { return this.progressBarTotal; }}
|
|
|
|
|
|
public System.Timers.Timer ProgressBarTimer = new System.Timers.Timer();
|
|
|
|
public System.Timers.Timer SqlTimer = new System.Timers.Timer();
|
|
|
|
|
|
public int result ;
|
|
|
|
public string SqlValue;
|
|
|
|
public SqlParameter[] Parameters;
|
|
|
|
public FrmProgressBar()
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.progressBarTotal.Value = 0;
|
|
this.ProgressBarTimer.Interval = 200;
|
|
this.ProgressBarTimer.Elapsed += new System.Timers.ElapsedEventHandler(ProgressBarTimerTick);
|
|
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
|
|
this.ProgressBarTimer.Start();
|
|
}
|
|
|
|
|
|
public FrmProgressBar(string sqlValue, SqlParameter[] parameters)
|
|
{
|
|
InitializeComponent();
|
|
this.ProgressBarTimer.Interval = 200;
|
|
this.ProgressBarTimer.Elapsed += new System.Timers.ElapsedEventHandler(ProgressBarTimerTick);
|
|
|
|
|
|
this.SqlTimer.Interval = 100;
|
|
this.SqlTimer.Elapsed += new System.Timers.ElapsedEventHandler(SqlTimerTimerTick);
|
|
|
|
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
|
|
SqlValue = sqlValue;
|
|
Parameters = parameters;
|
|
|
|
this.SqlTimer.Start();
|
|
}
|
|
|
|
//public int save(string masterSql, string detailSql, string detailTable, ref string billNo, string detailGuid, string billSeq, int billWay, int comfirm, out string tipMsg, int auditFlag = 0, int newVer = 0)
|
|
//{
|
|
// InitializeComponent();
|
|
// this.ProgressBarTimer.Interval = 200;
|
|
// this.ProgressBarTimer.Elapsed += new System.Timers.ElapsedEventHandler(ProgressBarTimerTick);
|
|
// int result = BillImpl.BillSave(masterSql, detailSql, BillModel.DetailTable, ref billNo, detailGuid, BillModel.BillSeq, BillModel.SaveState ? 2 : 1, comfirm, out tipMsg, 0, this.BillModel.NewVer);
|
|
// return result;
|
|
//}
|
|
|
|
|
|
|
|
private void SqlTimerTimerTick(object sender, ElapsedEventArgs e)
|
|
{
|
|
this.SqlTimer.Stop();
|
|
ShowForm(SqlValue, Parameters);
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 显示
|
|
/// </summary>
|
|
public void ShowForm(string sqlValue, SqlParameter[] parameters)
|
|
{
|
|
this.progressBarTotal.Value = 0;
|
|
this.ProgressBarTimer.Start();
|
|
//执行sql
|
|
result = MainImpl.ExecProcedure(sqlValue, parameters.ToArray());;
|
|
complete();
|
|
this.Close();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 自动增长进度条的进度
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ProgressBarTimerTick(object sender, EventArgs e)
|
|
{
|
|
int value = this.progressBarTotal.Value+1;
|
|
if (value <= 99)
|
|
{
|
|
this.progressBarTotal.Value = value;
|
|
}
|
|
else {
|
|
this.ProgressBarTimer.Stop();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 进度完成
|
|
/// </summary>
|
|
public void complete()
|
|
{
|
|
this.progressBarTotal.Value = 100;
|
|
this.ProgressBarTimer.Stop();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|