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

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. public partial class web_pos_c_work : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.     }
  16.     protected void Button1_Click(object sender, EventArgs e)
  17.     { 
  18.     }   
  19.     protected void save(int state)
  20.     {
  21.         if (this.CheckValidate())
  22.         {
  23.             SqlConnection conn = dbConnection.getConnection();
  24.             conn.Open();
  25.             SqlTransaction tx = conn.BeginTransaction();
  26.             string sql = "";
  27.             try
  28.             {
  29.                 int id = 1;
  30.                 SqlCommand cmd = new SqlCommand("select max(id) from OA_WORK_FORM", conn);
  31.                 cmd.Transaction = tx;
  32.                 try
  33.                 {
  34.                     id = Convert.ToInt32(cmd.ExecuteScalar().ToString()) + 1;
  35.                 }
  36.                 catch { }
  37.                 string total_result = "完成";
  38.                 if (state == 2)
  39.                 {
  40.                     total_result = "未送件";
  41.                 }
  42.                 sql = "insert into OA_WORK_FORM(id, form_id, " +
  43.                        "emp_name, department_id,department,emp_position,w_name," +
  44.                     " total_result, finish_date, is_del, apply_date, state) values (" +
  45.                     id + ", '" + TxtFormNo.Text + "','" + EmpId.Value + "', '" + DepartmentId.Value + "','" +              
  46.                     TxtEmpName.Text+"','"+TxtPosition.Text+
  47.                                                                   
  48.                     "0,'" + total_result + "','','N','" + TxtApplyDate.Text + "','" + state + "')";
  49.                 cmd = new SqlCommand(sql, conn);
  50.                 cmd.Transaction = tx;
  51.                 cmd.ExecuteNonQuery();
  52.                 int flow_id = 1;
  53.                 cmd = new SqlCommand("select max(id) from OA_pos_c_FORM_FLOW", conn);
  54.                 cmd.Transaction = tx;
  55.                 try
  56.                 {
  57.                     flow_id = Convert.ToInt32(cmd.ExecuteScalar().ToString()) + 1;
  58.                 }
  59.                 catch { }              
  60.                 
  61.            
  62.                 #region
  63.               
  64.                 #endregion
  65.             }
  66.             catch (Exception ex)
  67.             {
  68.                 Response.Write(ex.Message);
  69.                 try
  70.                 {
  71.                     tx.Rollback();
  72.                 }
  73.                 catch { }
  74.             }
  75.             conn.Close();
  76.         }
  77.     }
  78.     }