Default.aspx.cs
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:6k
源码类别:

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Text;
  3. using System.Data;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Data.SqlClient;
  7. using System.Web;
  8. using System.Web.Security;
  9. using System.Web.UI;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Web.UI.HtmlControls;
  13. public partial class web_Default : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.     }
  18.     protected void Button1_Click(object sender, EventArgs e)
  19.     {
  20.         int id = 1;
  21.         ArrayList num1 = new ArrayList();
  22.         ArrayList num2 = new ArrayList();
  23.         decimal T1 = 113000;
  24.         decimal T2 = 130000;
  25.         decimal T3 = 150000;
  26.         decimal T4 = 173000;
  27.         SqlConnection conn1 = dbConnection.getConnection();
  28.         System.Data.SqlClient.SqlCommand sqlcomm1 = new SqlCommand("select distinct data from dbo.OA_KAOQIN ", conn1);
  29.         conn1.Open();
  30.         System.Data.SqlClient.SqlDataReader comm1 = sqlcomm1.ExecuteReader();
  31.         while (comm1.Read())
  32.         {
  33.             num1.Add(comm1["data"]);
  34.         }
  35.         comm1.Close();
  36.         conn1.Close();
  37.             // num1.Add(comm1["data"]);
  38.             SqlConnection conn6 = dbConnection.getConnection();
  39.             System.Data.SqlClient.SqlCommand sqlcomm6 = new SqlCommand("select   card_id from dbo.OA_KAOQIN", conn6);
  40.             conn6.Open();
  41.             System.Data.SqlClient.SqlDataReader comm6 = sqlcomm6.ExecuteReader();
  42.             while (comm6.Read())
  43.             {
  44.                 num2.Add(comm6["card_id"]);
  45.             }
  46.             comm6.Close();
  47.             conn6.Close();
  48.             foreach (decimal i in num1)
  49.             {
  50.                 foreach (string  j in num2)
  51.                 {
  52.                     string time1 = null;
  53.                     string time2 = null;
  54.                     string time3 = null;
  55.                     string time4 = null;
  56.                     SqlConnection conn2 = dbConnection.getConnection();
  57.                     System.Data.SqlClient.SqlCommand sqlcomm2 = new SqlCommand("select min(card_time) as card_time from dbo.OA_KAOQIN where data = " + i + " and card_id = " +j + " and card_time <" + T1, conn2);
  58.                     conn2.Open();
  59.                     System.Data.SqlClient.SqlDataReader comm2 = sqlcomm2.ExecuteReader();
  60.                     while (comm2.Read())
  61.                     {
  62.                         time1 = Convert.ToString(comm2["card_time"]);
  63.                     }
  64.                     comm2.Close();
  65.                     conn2.Close();
  66.                     SqlConnection conn3 = dbConnection.getConnection();
  67.                     System.Data.SqlClient.SqlCommand sqlcomm3 = new SqlCommand("select min(card_time) as card_time from dbo.OA_KAOQIN where data = " + i + "and card_id = " + j + "and card_time >" + T1 + "and card_time<" + T2, conn3);
  68.                     conn3.Open();
  69.                     System.Data.SqlClient.SqlDataReader comm3 = sqlcomm3.ExecuteReader();
  70.                     while (comm3.Read())
  71.                     {
  72.                         time2 = Convert.ToString(comm3["card_time"]);
  73.                     }
  74.                     comm3.Close();
  75.                     conn3.Close();
  76.                     SqlConnection conn4 = dbConnection.getConnection();
  77.                     System.Data.SqlClient.SqlCommand sqlcomm4 = new SqlCommand("select max(card_time) as card_time from dbo.OA_KAOQIN where data = " + i + "and card_id = " + j + "and card_time >" + T1 + "and card_time <" + T3, conn4);
  78.                     conn4.Open();
  79.                     System.Data.SqlClient.SqlDataReader comm4 = sqlcomm4.ExecuteReader();
  80.                     while (comm4.Read())
  81.                     {
  82.                         time3 = Convert.ToString(comm4["card_time"]);
  83.                     }
  84.                     comm4.Close();
  85.                     conn4.Close();
  86.                     SqlConnection conn5 = dbConnection.getConnection();
  87.                     System.Data.SqlClient.SqlCommand sqlcomm5 = new SqlCommand("select max(card_time) as card_time from dbo.OA_KAOQIN where data = " + i+ "and card_id = " + j + "and card_time > " + T3 + "and card_time < " + T4, conn5);
  88.                     conn5.Open();
  89.                     System.Data.SqlClient.SqlDataReader comm5 = sqlcomm5.ExecuteReader();
  90.                     while (comm5.Read())
  91.                     {
  92.                         time4 = Convert.ToString(comm5["card_time"]);
  93.                     }
  94.                     comm5.Close();
  95.                     conn5.Close();
  96.                     SqlConnection conn7 = dbConnection.getConnection();
  97.                     conn7.Open();
  98.                     SqlCommand cmd = new SqlCommand("insert into OA_KAOQIN_JL(id ,data ,1, card_id,zao, wan, wuxia,wushang )values('" + id + "','" + i + "','" + j + "','" + time1 + "','" + time4 + "','" + time2 + "','" + time3 + "')", conn7);
  99.                     id = id + 1;                    
  100.                     cmd.ExecuteNonQuery();
  101.                     Response.Write(i);
  102.                     Response.Write("  " );
  103.                     Response.Write(j);
  104.                     Response.Write("  ");
  105.                     Response.Write(time1);
  106.                     Response.Write("  " );
  107.                     Response.Write(time2);
  108.                     Response.Write( " " );
  109.                     Response.Write(time3);
  110.                     Response.Write( " " );
  111.                     Response.Write(time4);
  112.                     conn7.Close();
  113.                     
  114.                 }
  115.             }
  116.     
  117.     }
  118. }