Skip to content

Commit

Permalink
Merge remote-tracking branch 'hefangli/master1' into DockingForm
Browse files Browse the repository at this point in the history
Conflicts:
	Application/Code/SqlHelper.cs
	Application/WorkStation.csproj
	Application/frmEmployeeEditDelete.cs
	Application/frmEmployeeNew.cs
	Application/frmMain.Designer.cs
	Application/frmReportAnalysisByEmployee.Designer.cs
	Application/frmReportAnalysisByEmployee.cs
	Application/frmReportAnalysisByPlan.Designer.cs
  • Loading branch information
katway committed Dec 13, 2012
2 parents 39cdfc7 + bd9aa35 commit 4770ec2
Show file tree
Hide file tree
Showing 17 changed files with 362 additions and 480 deletions.
2 changes: 0 additions & 2 deletions Application/12.cs
Expand Up @@ -94,8 +94,6 @@ private void btnSearch_Click(object sender, EventArgs e)
}

dsComo.Tables[0].Rows.InsertAt(dr, 0);


}

if (dsComo != null && dsComo.Tables.Count == 1)
Expand Down
12 changes: 6 additions & 6 deletions Application/WorkStation.csproj
Expand Up @@ -80,6 +80,9 @@
<Compile Include="Code\CommonClass.cs" />
<Compile Include="Code\GlobalConfig.cs" />
<Compile Include="Code\SqlHelper.cs" />
<Compile Include="frmPlanToTask.Designer.cs">
<DependentUpon>frmPlanToTask.cs</DependentUpon>
</Compile>
<Compile Include="frmReport.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -125,9 +128,6 @@
<Compile Include="frmPlanToTask.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmPlanToTask.Designer.cs">
<DependentUpon>frmPlanToTask.cs</DependentUpon>
</Compile>
<Compile Include="frmPlanAdd.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -268,6 +268,9 @@
<EmbeddedResource Include="frmCardNew.resx">
<DependentUpon>frmCardNew.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPlanToTask.resx">
<DependentUpon>frmPlanToTask.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPointChoseRfid.resx">
<DependentUpon>frmPointChoseRfid.cs</DependentUpon>
</EmbeddedResource>
Expand All @@ -283,9 +286,6 @@
<EmbeddedResource Include="frmPlanExamine.resx">
<DependentUpon>frmPlanExamine.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPlanToTask.resx">
<DependentUpon>frmPlanToTask.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPlanAdd.resx">
<DependentUpon>frmPlanAdd.cs</DependentUpon>
</EmbeddedResource>
Expand Down
7 changes: 3 additions & 4 deletions Application/frmCardEditDelete.cs
Expand Up @@ -16,12 +16,11 @@ public frmCardEditDelete()
{
InitializeComponent();
}
private static string sqlConnectionStr = "Data Source=192.168.1.221;Initial Catalog=PatrolCheck;User ID=sa;Password=sa123";
private void button1_Click(object sender, EventArgs e)
{
string sql4 = "select Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid,RfidPurpose where Rfid.Purpose = RfidPurpose.Code and ID=@id";
string sql4 = "select Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid left join RfidPurpose on Rfid.Purpose = RfidPurpose.Code where ID=@id";
SqlParameter[] par = new SqlParameter[] { new SqlParameter("@id", this.dgvCardDelete.GetRowCellValue(dgvCardDelete.FocusedRowHandle, "ID")) };
SqlDataReader dr = SqlHelper.ExecuteReader(sqlConnectionStr, CommandType.Text, sql4, par);
SqlDataReader dr = SqlHelper.ExecuteReader(sql4, par);
while (dr.Read())
{
this.txtName.Text = dr[0].ToString();
Expand Down Expand Up @@ -120,7 +119,7 @@ private void button3_Click(object sender, EventArgs e)
}
private void Bind()
{
string sql2 = "select ID,Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid,RfidPurpose where Rfid.Purpose = RfidPurpose.Code";
string sql2 = "select ID,Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid left join RfidPurpose on Rfid.Purpose = RfidPurpose.Code";
DataSet ds = SqlHelper.ExecuteDataset(sql2);
ds.Tables[0].Columns.Add(new DataColumn("Check",typeof(System.Boolean)));
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
Expand Down
4 changes: 2 additions & 2 deletions Application/frmCardNew.cs
Expand Up @@ -23,7 +23,7 @@ public frmCardNew()
/// </summary>
public void Bind()
{
string sql2 = "select ID,Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid,RfidPurpose where Rfid.Purpose = RfidPurpose.Code";
string sql2 = "select ID,Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid left join RfidPurpose on Rfid.Purpose = RfidPurpose.Code";
DataSet ds = SqlHelper.ExecuteDataset(sql2);
this.gridControl1.DataSource = ds.Tables[0];
}
Expand Down Expand Up @@ -89,7 +89,7 @@ private void bwkLoadData_DoWork(object sender, DoWorkEventArgs e)
{
string sql2 = "select * from RfidPurpose ";
dsRfidPurpose = SqlHelper.ExecuteDataset(sql2);
sql2 = "select ID,Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid,RfidPurpose where Rfid.Purpose = RfidPurpose.Code";
sql2 = "select ID,Name,Alias,RFID,Meaning,(select meaning from codes where code=validstate and purpose='validstate') as ValidState from Rfid left join RfidPurpose on Rfid.Purpose = RfidPurpose.Code";
dsRfid = SqlHelper.ExecuteDataset(sql2);
sql2 = "select Code,Meaning from Codes where Purpose='ValidState'";
dse = SqlHelper.ExecuteDataset(sql2);
Expand Down
13 changes: 7 additions & 6 deletions Application/frmEmployeeEditDelete.cs
Expand Up @@ -14,18 +14,18 @@ public partial class frmEmployeeEditDelete : WeifenLuo.WinFormsUI.Docking.DockCo
public frmEmployeeEditDelete()
{
InitializeComponent();
}
private static string sqlConnectionStr = "Data Source=192.168.1.221;Initial Catalog=PatrolCheck;User ID=sa;Password=sa123";
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
string selectEmpoyee = "select Employee.Name emName,Employee.Alias alias,Rfid.Name Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee,Rfid,Post,Post_Employee where Employee.ID=Post_Employee.Employee_ID and Employee.Rfid_ID=Rfid.ID and Post_Employee.ID=Post.ID and Employee.ID=@id";
string selectEmpoyee = "select Employee.Name emName,Employee.Alias alias,Rfid.Name Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee,Rfid,Post,Post_Employee where Employee.ID=Post_Employee.Employee_ID and Employee.Rfid_ID=Rfid.ID and Post_Employee.Post_ID=Post.ID and Employee.ID=@id";
//string selectEmpoyee = "select Employee.Name emName,Employee.Alias alias,Rfid.Name Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee left join Rfid on Employee.Rfid_ID=Rfid.ID left join Post_Employee on Employee.ID=Post_Employee.Employee_ID left join Post on Post_Employee.ID=Post.ID where Employee.ID=@id";
SqlParameter[] par = new SqlParameter[] { new SqlParameter("@id", this.dgvEmployessDel.GetRowCellValue(dgvEmployessDel.FocusedRowHandle,"ID")) };
SqlDataReader dr = SqlHelper.ExecuteReader(sqlConnectionStr, CommandType.Text, selectEmpoyee,par);
SqlDataReader dr = SqlHelper.ExecuteReader(selectEmpoyee,par);
while(dr.Read())
{
this.txtName.Text = dr[0].ToString();
Expand Down Expand Up @@ -113,7 +113,7 @@ private void btnSave_Click(object sender, EventArgs e)
par[2].Value = this.txtAlias.Text;
par[3].Value = this.cboCard.SelectedValue;
par[4].Value = this.cboState.SelectedValue;
string a = SqlHelper.ExecuteScalar(sqlConnectionStr, CommandType.Text, UpdateEmployee, par).ToString();
string a = SqlHelper.ExecuteScalar(UpdateEmployee, par).ToString();
if (a != null)
{
MessageBox.Show("更新成功!");
Expand All @@ -122,7 +122,7 @@ private void btnSave_Click(object sender, EventArgs e)
{
MessageBox.Show("更新失败!");
}
string UpdateEmPost = "update Post_Employee set ID=@id where Employee_ID=@emID";
string UpdateEmPost = "update Post_Employee set Post_ID=@id where Employee_ID=@emID";
SqlParameter[] par2 = new SqlParameter[]
{
new SqlParameter("@emID",SqlDbType.Int),
Expand Down Expand Up @@ -175,6 +175,7 @@ private void frmEditOrDeleteEmployee_Load(object sender, EventArgs e)
public void BindEmployee()
{
string selectEmployee = "select Employee.ID,Employee.Name emName,Employee.Alias alias,Rfid.Name Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee,Rfid,Post,Post_Employee where Employee.ID=Post_Employee.Employee_ID and Employee.Rfid_ID=Rfid.ID and Post_Employee.Post_ID=Post.ID";
//string selectEmployee = "select Employee.ID,Employee.Name emName,Employee.Alias alias,Rfid.Name Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee left join Rfid on Employee.Rfid_ID=Rfid.ID left join Post on Post_Employee.Post_ID=Post.ID left join Post_Employee on Employee.ID=Post_Employee.Employee_ID";
DataSet ds = SqlHelper.ExecuteDataset(selectEmployee);
ds.Tables[0].Columns.Add(new DataColumn("check", typeof(System.Boolean)));
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
Expand Down
19 changes: 7 additions & 12 deletions Application/frmEmployeeNew.cs
Expand Up @@ -52,7 +52,7 @@ private void btnSave_Click(object sender, EventArgs e)
else
{
string insertEmpoyee = "insert into Employee(Name,Alias,Rfid_ID,ValidState) values(@name,@alias,@rfid_id,@ValidState);select @@identity";
string insertEmpoyeePost = "insert into Post_Employee(Employee_ID,ID) values(@em_id,@id)";
string insertEmpoyeePost = "insert into Post_Employee(Employee_ID,Post_ID) values(@em_id,@id)";
SqlParameter[] par = new SqlParameter[]{ new SqlParameter("@name",SqlDbType.NVarChar),
new SqlParameter("@alias",SqlDbType.NVarChar),
new SqlParameter("@rfid_id",SqlDbType.Int),
Expand All @@ -61,9 +61,8 @@ private void btnSave_Click(object sender, EventArgs e)
par[1].Value = this.txtAlias.Text;
par[2].Value = this.cboCard.SelectedValue.ToString();
par[3].Value = this.cboState.SelectedValue.ToString();
// string id = SqlHelper.ExecuteScalar( CommandType.Text, insertEmpoyee, par).ToString();
int id = SqlHelper.ExecuteNonQuery(insertEmpoyee,par);
if (id != null)
string id = SqlHelper.ExecuteScalar(insertEmpoyee, par).ToString();
if (id != null )
{
MessageBox.Show("保存成功!");
}
Expand All @@ -85,15 +84,11 @@ private void btnSave_Click(object sender, EventArgs e)
/// 数据绑定
/// </summary>
public void BindEmployee()
{
string selectEmployee = @"select
ID,Name as emName,Alias,
(select name from rfid where id=Rfid_ID) as Name,
(select name from post where id=(SELECT post_id from Post_Employee where Employee_ID=ID)) as postname,
(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState
from Employee";
{
string selectEmployee = "select Employee.ID,Employee.Name emName,Employee.Alias as alias ,Rfid.Name as Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee,Rfid,Post,Post_Employee where Employee.ID=Post_Employee.Employee_ID and Employee.Rfid_ID=Rfid.ID and Post_Employee.Post_ID=Post.ID";
//string selectEmployee = "select Employee.ID,Employee.Name emName,Employee.Alias as alias ,Rfid.Name as Name,Post.Name postName,(select meaning from codes where code=Employee.validstate and purpose='validstate') as ValidState from Employee left join Rfid on Employee.Rfid_ID=Rfid.ID left join Post on Post_Employee.Post_ID=Post.ID left join Post_Employee on Employee.ID=Post_Employee.Employee_ID ";
DataSet ds = SqlHelper.ExecuteDataset(selectEmployee);
this.gridControl1.DataSource = ds.Tables[0];
gridControl1.DataSource = ds.Tables[0];
}
/// <summary>
/// 取消
Expand Down

0 comments on commit 4770ec2

Please sign in to comment.