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

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class web_pos_c_deal1_list : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         
  17.         if (Request.QueryString["dpt_id"] != null || Request.QueryString["t_date"] != null)
  18.         {
  19.             Panel1.Visible = false;
  20.             Panel2.Visible = true;
  21.             PosCList_select.DataKeyNames = new string[] { "id" };
  22.            
  23.             
  24.         }
  25.         else
  26.         {
  27.             Panel2.Visible = false;
  28.             Panel1.Visible = true;
  29.             PosCList.DataKeyNames = new string[] { "id"};
  30.         }
  31.         if (Request.QueryString["f_id"] != null || Request.QueryString["f_id"] != "")
  32.         {
  33.             Panel3.Visible = true;           
  34.             this.SetData(Request.QueryString["f_id"]);
  35.          
  36.         }
  37.         else if (Request.QueryString["f_id1"] != null || Request.QueryString["f_id1"] != "")
  38.         {
  39.             Panel3.Visible = true;
  40.             this.SetData(Request.QueryString["f_id1"]);
  41.          
  42.         }
  43.         else 
  44.         {
  45.             Panel3.Visible = false;
  46.            
  47.         }
  48.       
  49.        
  50.     }
  51.     protected void SetData(string id)
  52.     {
  53.         SqlConnection conn = dbConnection.getConnection();
  54.         conn.Open();
  55.         SqlCommand cmd = new SqlCommand("select * from oa_pos_c_form as a left join oa_department as b on a.department_id=b.id left join " +
  56.             " oa_employee as c on a.emp_id=c.id  where a.id=" + id, conn);
  57.         SqlDataReader dr = cmd.ExecuteReader();
  58.         if (dr.Read())
  59.         {
  60.             TxtFormNo.Text = dr["form_id"].ToString();
  61.             TxtEmpName.Text = dr["emp_name"].ToString();
  62.             TxtEmpNo.Text = dr["emp_no"].ToString();
  63.             TxtPosition.Text = dr["emp_position"].ToString();
  64.             TxtDepartment.Text = dr["name"].ToString();
  65.             //TxtReason.Text = dr["reason"].ToString();
  66.             TxtApplyDate.Text = dr["apply_date"].ToString();
  67.             TextCount.Text = dr["t_count"].ToString();
  68.             TextCount1.Text = dr["t_count1"].ToString();
  69.             TextLv.Text = dr["t_lv"].ToString();
  70.             TextDate1.Text = dr["t_date"].ToString();
  71.             TxtRemark.Text = dr["remark"].ToString();
  72.         }
  73.         dr.Close();
  74.         conn.Close();
  75.     }
  76.     protected void setdata2()
  77.     { 
  78.     textArea.SelectedValue=Request.QueryString["dpt_id"];
  79.     textDate.Text=Request.QueryString["t_date"];
  80.     }
  81.     protected void ImageButton2_Click(object sender, EventArgs e)
  82.     {
  83.         if (Calendar2.Visible == true)
  84.         {
  85.             Calendar2.Visible = false;
  86.             Calendar2.Focus();
  87.         }
  88.         else
  89.         {
  90.             Calendar2.Visible = true;
  91.             Calendar2.Focus();
  92.         }
  93.     }
  94.     protected void Calendar2_SelectionChanged(object sender, EventArgs e)
  95.     {
  96.         Calendar2.Visible = false;
  97.         string year = Calendar2.SelectedDate.Year.ToString();
  98.         string month = Calendar2.SelectedDate.Month.ToString();
  99.         if (month.Length == 1)
  100.         {
  101.             month = "0" + month;
  102.         }
  103.         string day = Calendar2.SelectedDate.Day.ToString();
  104.         if (day.Length == 1)
  105.         {
  106.             day = "0" + day;
  107.         }
  108.         textDate.Text = year + "-" + month + "-" + day;
  109.     
  110.     }
  111.     protected void Btn_ok_Click(object sender, EventArgs e)
  112.     {
  113.         //int dpt_id =Convert.ToInt32(textArea.SelectedValue);
  114.         if (check())
  115.         {
  116.             Response.Redirect("../pos_c/deal1_list.aspx?dpt_id=" + textArea.SelectedValue + "&t_date=" + textDate.Text);
  117.         }
  118.     }
  119.     protected bool check() 
  120.     {
  121.         int flg = 0;
  122.         if (textArea.SelectedValue == null ||textArea.SelectedValue == "") {
  123.             Response.Write("<script>alert('請選擇查詢的區域')</script>");
  124.             flg = 1;
  125.         }
  126.         if (textDate.Text == null || textDate.Text == "")
  127.         {
  128.             Response.Write("<script>alert('請選擇查詢的時間')</script>");
  129.             flg = 1;
  130.         }
  131.         if (flg == 0) { return true; }
  132.         else { return false; }
  133.     }
  134.    
  135.     protected void PosCList_RowDataBound(object sender, GridViewRowEventArgs e)
  136.     {
  137.         //行高亮
  138.         if (e.Row.RowType == DataControlRowType.DataRow)
  139.         {
  140.             e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
  141.             e.Row.Attributes.Add("onclick", "location.href='deal1_list.aspx?f_id=" + PosCList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
  142.         }
  143.     }
  144.     protected void PosCList_select_RowDataBound(object sender, GridViewRowEventArgs e)
  145.     {
  146.         if (e.Row.RowType == DataControlRowType.DataRow)
  147.         {
  148.             e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
  149.             e.Row.Attributes.Add("onclick", "location.href='deal1_list.aspx?f_id1=" + PosCList_select.DataKeys[e.Row.RowIndex].Value.ToString() +
  150.                 "&dpt_id=" + Request.QueryString["dpt_id"] + "&t_date=" + Request.QueryString["t_date"]+"'");
  151.         }
  152.     }
  153. }