paibangbiao.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:4k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Data.SqlClient;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class web_paibangbiao : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- int id = 1;
- int num = 0;
- ArrayList num1 = new ArrayList();
- ArrayList num2 = new ArrayList();
- SqlConnection conn5 = dbConnection.getConnection();
- conn5.Open();
- SqlCommand sqlcomm5 = new SqlCommand("select count(id) as id from dbo.OA_KAOQIN_MD_JL", conn5);
- num = Convert.ToInt16(sqlcomm5.ExecuteScalar());
- if (num != 0)
- {
- SqlCommand sqlcomm4 = new SqlCommand("select max(id) as id from dbo.OA_KAOQIN_MD_JL", conn5);
- id = Convert.ToInt16(sqlcomm4.ExecuteScalar())+1;
- }
- conn5.Close();
- SqlConnection conn1 = dbConnection.getConnection();
- SqlCommand sqlcomm1 = new SqlCommand("select distinct data from dbo.OA_KAOQIN_MD ", conn1);
- conn1.Open();
- SqlDataReader comm1 = sqlcomm1.ExecuteReader();
- while (comm1.Read())
- {
- num1.Add(comm1["data"]);
- }
- comm1.Close();
- conn1.Close();
- SqlConnection conn2 = dbConnection.getConnection();
- SqlCommand sqlcomm2 = new SqlCommand("select distinct card_id from dbo.OA_KAOQIN_MD", conn2);
- conn2.Open();
- SqlDataReader comm2 = sqlcomm2.ExecuteReader();
- while (comm2.Read())
- {
- num2.Add(comm2["card_id"]);
- }
- comm2.Close();
- conn2.Close();
- foreach (decimal i in num1)
- {
- foreach (string j in num2)
- {
- decimal first_time = 0;
- decimal end_time = 0;
- SqlConnection conn3 = dbConnection.getConnection();
- conn3.Open();
- SqlCommand sqlcomm3 = new SqlCommand("select min(card_time) as card_time from dbo.OA_KAOQIN_MD where data=" + i + "and card_id=" + j, conn3);
- SqlDataReader comm3 = sqlcomm3.ExecuteReader();
- while (comm3.Read())
- {
- first_time = Convert.ToInt32(comm3["card_time"]);
- }
- comm3.Close();
- conn3.Close();
- SqlConnection conn6 = dbConnection.getConnection();
- conn6.Open();
- SqlCommand sqlcomm4 = new SqlCommand("select max(card_time) as card_time from dbo.OA_KAOQIN_MD where data=" + i + "and card_id=" + j,conn6);
- SqlDataReader comm4 = sqlcomm4.ExecuteReader();
- while (comm4.Read())
- {
- end_time = Convert.ToInt32(comm4["card_time"]);
- }
- comm4.Close();
- conn6.Close();
- SqlConnection conn4 = dbConnection.getConnection();
- conn4.Open();
- if (first_time != end_time)
- {
- SqlCommand cmd = new SqlCommand("insert into OA_KAOQIN_JL(id ,data,card_id,zao,wan,wuxia,wushang )values('" + id + "','" + i + "','" + j + "','" + first_time + "','" + end_time + "','0','0')", conn4);
- cmd.ExecuteNonQuery();
- id = id + 1;
- }
- else
- {
- SqlCommand cmd = new SqlCommand("insert into OA_KAOQIN_JL(id ,data,card_id,zao,wan,wuxia,wushang )values('" + id + "','" + i + "','" + j + "','" + first_time + "','0','0','0')", conn4);
- cmd.ExecuteNonQuery();
- id = id + 1;
- }
- conn4.Close();
- }
- }
- }
- }