deal1_list.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:5k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- 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;
- using System.Data.SqlClient;
- public partial class web_pos_c_deal1_list : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Request.QueryString["dpt_id"] != null || Request.QueryString["t_date"] != null)
- {
- Panel1.Visible = false;
- Panel2.Visible = true;
- PosCList_select.DataKeyNames = new string[] { "id" };
- }
- else
- {
- Panel2.Visible = false;
- Panel1.Visible = true;
- PosCList.DataKeyNames = new string[] { "id"};
- }
- if (Request.QueryString["f_id"] != null || Request.QueryString["f_id"] != "")
- {
- Panel3.Visible = true;
- this.SetData(Request.QueryString["f_id"]);
- }
- else if (Request.QueryString["f_id1"] != null || Request.QueryString["f_id1"] != "")
- {
- Panel3.Visible = true;
- this.SetData(Request.QueryString["f_id1"]);
- }
- else
- {
- Panel3.Visible = false;
- }
- }
- protected void SetData(string id)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- 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 " +
- " oa_employee as c on a.emp_id=c.id where a.id=" + id, conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- TxtFormNo.Text = dr["form_id"].ToString();
- TxtEmpName.Text = dr["emp_name"].ToString();
- TxtEmpNo.Text = dr["emp_no"].ToString();
- TxtPosition.Text = dr["emp_position"].ToString();
- TxtDepartment.Text = dr["name"].ToString();
- //TxtReason.Text = dr["reason"].ToString();
- TxtApplyDate.Text = dr["apply_date"].ToString();
- TextCount.Text = dr["t_count"].ToString();
- TextCount1.Text = dr["t_count1"].ToString();
- TextLv.Text = dr["t_lv"].ToString();
- TextDate1.Text = dr["t_date"].ToString();
- TxtRemark.Text = dr["remark"].ToString();
- }
- dr.Close();
- conn.Close();
- }
- protected void setdata2()
- {
- textArea.SelectedValue=Request.QueryString["dpt_id"];
- textDate.Text=Request.QueryString["t_date"];
- }
- protected void ImageButton2_Click(object sender, EventArgs e)
- {
- if (Calendar2.Visible == true)
- {
- Calendar2.Visible = false;
- Calendar2.Focus();
- }
- else
- {
- Calendar2.Visible = true;
- Calendar2.Focus();
- }
- }
- protected void Calendar2_SelectionChanged(object sender, EventArgs e)
- {
- Calendar2.Visible = false;
- string year = Calendar2.SelectedDate.Year.ToString();
- string month = Calendar2.SelectedDate.Month.ToString();
- if (month.Length == 1)
- {
- month = "0" + month;
- }
- string day = Calendar2.SelectedDate.Day.ToString();
- if (day.Length == 1)
- {
- day = "0" + day;
- }
- textDate.Text = year + "-" + month + "-" + day;
- }
- protected void Btn_ok_Click(object sender, EventArgs e)
- {
- //int dpt_id =Convert.ToInt32(textArea.SelectedValue);
- if (check())
- {
- Response.Redirect("../pos_c/deal1_list.aspx?dpt_id=" + textArea.SelectedValue + "&t_date=" + textDate.Text);
- }
- }
- protected bool check()
- {
- int flg = 0;
- if (textArea.SelectedValue == null ||textArea.SelectedValue == "") {
- Response.Write("<script>alert('請選擇查詢的區域')</script>");
- flg = 1;
- }
- if (textDate.Text == null || textDate.Text == "")
- {
- Response.Write("<script>alert('請選擇查詢的時間')</script>");
- flg = 1;
- }
- if (flg == 0) { return true; }
- else { return false; }
- }
- protected void PosCList_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- //行高亮
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
- e.Row.Attributes.Add("onclick", "location.href='deal1_list.aspx?f_id=" + PosCList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
- }
- }
- protected void PosCList_select_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
- e.Row.Attributes.Add("onclick", "location.href='deal1_list.aspx?f_id1=" + PosCList_select.DataKeys[e.Row.RowIndex].Value.ToString() +
- "&dpt_id=" + Request.QueryString["dpt_id"] + "&t_date=" + Request.QueryString["t_date"]+"'");
- }
- }
- }