重载怎么样改成PUBLIC的一个类
using System;using System.Collections.Generic;
using
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DB;
namespace WindowsApplication1
{
public partial class Route : UserControl
{
//ReQueue1 rq1;
//ReQueue2 rq2;
string filedId = Confing.FieldId;
string couseid = "";
string daikaoQueue = Confing.DaikaoQueue;
string kaoshiQueue = Confing.KaoshiQueue;
int time = Convert.ToInt32(Confing.Time.Trim());
string NumberSwitch = Confing.NumberSwitch;
mainform mf;
public Route(string couseName, string couseId, string fangshi, mainform main)
{
InitializeComponent();
try
{
couseid = couseId;
mf = main;
label1.Text = couseName;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
if (fangshi == "1")
{
timer2.Interval = time;
timer2.Enabled = true;
}
else if (fangshi == "2")
{
try
{
mf.rq1.Re_Exam_Queue.Clear();
mf.rq1.Exam_State.Clear();
DB.DBhelp.GetExamStateByFieldId(filedId,mf.rq1);
DBhelp.GetReExamQueueByCourseId(couseid,mf.rq1);
int count1 = 0;
int count2 = 1;
groupBox2.Controls.Clear();
groupBox3.Controls.Clear();
addTitl();
int nPosX = 16;
int nPosY = 25;
foreach (ReQueue1.Re_Exam_QueueRow row in mf.rq1.Re_Exam_Queue)
{
mf.rq1.Exam_result.Clear();
DBhelp.ExamResult(row.Examid_No, mf.rq1);
if (row.Exam_Status_Cd == "AW")
{
try
{
if (count1 + 1 > Convert.ToInt16(daikaoQueue))
continue;
string y = "";
if (count1 % 2 == 0)
{
y = "0";
}
else
{
y = "1";
}
Daikao dq = new Daikao((count1 + 1).ToString(), row.Exame_Name, row.Examid_No, y, row.Pid_No);
dq.Location = new Point(nPosX, count1 * 13 + nPosY);
groupBox2.Controls.Add(dq);
count1++;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
else if (row.Exam_Status_Cd == "IE")
{
try
{
if (count2 > Convert.ToInt16(kaoshiQueue))
continue;
string st = "";
string cj = "";
foreach (ReQueue1.Exam_StateRow row2 in mf.rq1.Exam_State)
{
if (row.Examid_No == row2.Examid_No)
{
switch (row2.Ei_Desc)
{
case "上坡路定点停车与坡道起步":
st = "坡道起步"; break;
case "限速通过限宽门":
st = "限速限宽门"; break;
default:
st = row2.Ei_Desc; break;
}
}
}
foreach (ReQueue1.Exam_resultRow row3 in mf.rq1.Exam_result)
{
cj = row3.Exam_Score;
}
if (st == "")
{
st = "准备考试";
}
kaoshi kq = new kaoshi(row.Auto_Id, row.Exame_Name, st, cj);
kq.Width = groupBox2.Width - 10;
kq.Location = new Point(16, 30 + (count2 - 1) * 13);
groupBox3.Controls.Add(kq);
count2++;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
//find();
//copyrq1();
int count3 = 1;
try
{
foreach (ReQueue1.DispcompleteExamRow row in mf.rq1.DispcompleteExam)
{
if (Convert.ToInt16(row.Count) < 2)
{
mf.rq1.Exam_result.Clear();
DBhelp.ExamResult(row.Examid_No, mf.rq1);
string cj = "";
foreach (ReQueue1.Exam_resultRow row3 in mf.rq1.Exam_result)
{
cj = row3.Exam_Score;
}
kaoshi kq = new kaoshi(row.Auto_id, row.Exam_Name, "考试结束", cj);
kq.Location = new Point(16, 300 - (count3 - 1) * 13);
groupBox3.Controls.Add(kq);
int x = Convert.ToInt16(row.Count);
x++;
row.Count = x.ToString();
count3++;
}
else
{
mf.rq1.DispcompleteExam.RemoveDispcompleteExamRow(row);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch(Exception ex)
{ MessageBox.Show(ex.Message); }
}
}
private void Route_Load(object sender, EventArgs e)
{
if (NumberSwitch == "1")
{
label4.Text = "身份证号码";
}
}
private void timer2_Tick(object sender, EventArgs e)
{
mf.rq1.Re_Exam_Queue.Clear();
mf.rq1.Exam_State.Clear();
DB.DBhelp.GetExamStateByFieldId(filedId, mf.rq1);
DBhelp.GetReExamQueueByCourseId(couseid, mf.rq1);
int count1 = 0;
int count2 = 1;
groupBox2.Controls.Clear();
groupBox3.Controls.Clear();
addTitl();
int nPosX = 16;
int nPosY = 25;
foreach (ReQueue1.Re_Exam_QueueRow row in mf.rq1.Re_Exam_Queue)
{
try
{
mf.rq1.Exam_result.Clear();
DBhelp.ExamResult(row.Examid_No, mf.rq1);
if (row.Exam_Status_Cd == "AW")
{
if (count1 + 1 > Convert.ToInt16(daikaoQueue))
continue;
string y = "";
if (count1 % 2 == 0)
{
y = "0";
}
else
{
y = "1";
}
Daikao dq = new Daikao((count1 + 1).ToString(), row.Exame_Name, row.Examid_No, y, row.Pid_No);
dq.Location = new Point(nPosX, count1 * 13 + nPosY);
//dq.Location = new Point(1630+count1*30);
// dq.Width = groupBox2.Width - 10;
groupBox2.Controls.Add(dq);
count1++;
}
else if (row.Exam_Status_Cd == "IE")
{
if (count2 > Convert.ToInt16(kaoshiQueue))
continue;
string st = "";
string cj = "";
foreach (ReQueue1.Exam_StateRow row2 in mf.rq1.Exam_State)
{
if (row.Examid_No == row2.Examid_No)
{
switch (row2.Ei_Desc)
{
case "上坡路定点停车与坡道起步":
st = "坡道起步"; break;
case "限速通过限宽门":
st = "限速限宽门"; break;
default:
st = row2.Ei_Desc; break;
}
}
}
foreach (ReQueue1.Exam_resultRow row3 in mf.rq1.Exam_result)
{
cj = row3.Exam_Score;
}
kaoshi kq = new kaoshi(row.Auto_Id, row.Exame_Name, st, cj);
kq.Width = groupBox2.Width - 10;
kq.Location = new Point(16, 30 + (count2 - 1) * 13);
groupBox3.Controls.Add(kq);
count2++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//find();
//copyrq1();
int count3 = 1;
try
{
foreach (ReQueue1.DispcompleteExamRow row in mf.rq1.DispcompleteExam)
{
if (Convert.ToInt16(row.Count) < 3)
{
mf.rq1.Exam_result.Clear();
DBhelp.ExamResult(row.Examid_No, mf.rq1);
string cj = "";
foreach (ReQueue1.Exam_resultRow row3 in mf.rq1.Exam_result)
{
cj = row3.Exam_Score;
}
kaoshi kq = new kaoshi(row.Auto_id, row.Exam_Name, "考试结束", cj);
kq.Location = new Point(16, 175 - (count3 - 1) * 13);
groupBox3.Controls.Add(kq);
int x = Convert.ToInt16(row.Count);
x++;
row.Count = x.ToString();
count3++;
}
else
{
mf.rq1.DispcompleteExam.RemoveDispcompleteExamRow(row);
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void addTitl()
{
try
{
groupBox2.Controls.Add(label2);
if (NumberSwitch == "1")
{
label4.Text = "身份证号码";
}
groupBox2.Controls.Add(label3);
groupBox2.Controls.Add(label4);
groupBox3.Controls.Add(label5);
groupBox3.Controls.Add(label6);
groupBox3.Controls.Add(label7);
groupBox3.Controls.Add(label8);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void find()
{
foreach (ReQueue2.Re_Exam_QueueRow rowB in mf.rq2.Re_Exam_Queue)
{
int i = mf.rq1.Re_Exam_Queue.Rows.Count;
foreach (ReQueue1.Re_Exam_QueueRow rowN in mf.rq1.Re_Exam_Queue)
{
if (rowN.Exam_Status_Cd == "IE")
{
if (rowB.Examid_No == rowN.Examid_No)
{
i--;
}
}
}
if (i != mf.rq1.Re_Exam_Queue.Rows.Count)
continue;
else
{
ReQueue1.DispcompleteExamRow drow = mf.rq1.DispcompleteExam.NewDispcompleteExamRow();
drow.Auto_id = rowB.Auto_Id;
drow.Course_Id = rowB.Course_Id;
drow.Exam_Name = rowB.Exame_Name;
drow.Examid_No = rowB.Examid_No;
drow.Count = "0";
mf.rq1.DispcompleteExam.AddDispcompleteExamRow(drow);
}
}
}
void copyrq1()
{
mf.rq2.Re_Exam_Queue.Clear();
foreach (ReQueue1.Re_Exam_QueueRow rowN in mf.rq1.Re_Exam_Queue)
{
ReQueue2.Re_Exam_QueueRow rowB = mf.rq2.Re_Exam_Queue.NewRe_Exam_QueueRow();
if (rowN.Exam_Status_Cd == "IE")
{
rowB.Auto_Id = rowN.Auto_Id;
rowB.Course_Id = rowN.Course_Id;
rowB.Exame_Name = rowN.Exame_Name;
rowB.Examid_No = rowN.Examid_No;
mf.rq2.Re_Exam_Queue.AddRe_Exam_QueueRow(rowB);
}
}
}
}
}
就是红字的那部分怎么样改写成一个public的类