wenjianchuansong.aspx.cs
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:5k
源码类别:

OA系统

开发平台:

C#

  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. using System.Collections.Generic;
  13. using COM.OA.Entity;
  14. using COM.OA.BLL;
  15. public partial class qs_wenjian_jiqunchuansong : System.Web.UI.Page
  16. {
  17.    
  18. protected void Page_Load(object sender, EventArgs e)
  19.     {
  20.        
  21.     }
  22.     //部门连动出员工
  23.     protected void ddl_bumen_SelectedIndexChanged(object sender, EventArgs e)
  24.     {
  25.         String bumen = this.ddl_bumen.Text;
  26.         // String where = "em_dept_id='{0}'";
  27.         //  where = string.Format(where,bumen);
  28.         //   IList<employee> list = employeeBLL.Select(where);
  29.         SqlParameter parambumen = new SqlParameter("@deptid", bumen);
  30.         IList<liandongrenqs> lists = BLLGeneric.Select<liandongrenqs>(CommandType.StoredProcedure, "liandongqs", parambumen);
  31.         this.ddl_duixiang.DataSource = lists;
  32.         this.ddl_duixiang.DataTextField = "u_username";
  33.         this.ddl_duixiang.DataValueField = "u_username";
  34.         //this.ddl_duixiang.DataValueField = "Em_id";
  35.         this.ddl_duixiang.DataBind();
  36.     }
  37.     //清除
  38.     protected void Button4_Click(object sender, EventArgs e)
  39.     {
  40.         this.txt_jieshouren.Text = "";
  41.     }
  42.     //增加按钮
  43.     protected void Button1_Click(object sender, EventArgs e)
  44.     {
  45.         string duixiang = this.ddl_duixiang.Text;
  46.         this.txt_jieshouren.Text = duixiang;
  47.     }
  48.     protected void btQingKong_Click(object sender, EventArgs e)
  49.     {
  50.         this.ddl_bumen.Text = "0";
  51.         this.ddl_duixiang.Text = "0";
  52.       
  53.         this.txt_jieshouren.Text = "";
  54.       
  55.         
  56.     }
  57.     protected void btChuanZiJi_Click(object sender, EventArgs e)
  58.     {
  59.         //当前登陆人
  60.         users loginuser = Session["loginuser"] as users;
  61.         if (loginuser == null)
  62.         {
  63.             this.Response.Write(string.Format(GetRedirect.REDIRECT, "../login.aspx"));
  64.         }
  65.         else
  66.         {
  67.             int bumenid = loginuser.u_dept_id;
  68.             string bumenId = bumenid.ToString();
  69.             string myname = loginuser.u_username;
  70.             this.txt_jieshouren.Text = myname;
  71.             this.ddl_bumen.Text = bumenId;
  72.             
  73.             
  74.         }
  75.     }
  76.     protected void btFaSong_Click(object sender, EventArgs e)
  77.     {
  78.         //登陆人的名字转成ID
  79.         users loginuser = Session["loginuser"] as users;
  80.         if (loginuser == null)
  81.         {
  82.             this.Response.Write(string.Format(GetRedirect.REDIRECT, "../login.aspx"));
  83.         }
  84.         else
  85.         {
  86.             int userId = loginuser.u_id;
  87.             //string fasongren = "haha";
  88.             //string where1 = "u_username='{0}'";
  89.             //where1 = string.Format(where1, fasongren);
  90.             //IList<users> listuname = usersBLL.Select(where1);
  91.             //users user = listuname[0];
  92.             //int userId = user.u_id;
  93.             //取部门ID
  94.             
  95.             int bumenid =Int32.Parse( this.ddl_bumen.Text);
  96.             //取上传文件名
  97.             string name = this.fluWenJian.FileName;
  98.             int startIndex = this.fluWenJian.FileName.LastIndexOf(@"") + 1;
  99.             string fileName = this.fluWenJian.FileName.Substring(startIndex);
  100.             string phyFileName = this.Server.MapPath(@"..gxxz" + "upload") + @"" + fileName;
  101.             this.fluWenJian.SaveAs(phyFileName);
  102.             //取接收人姓名转成ID封装
  103.             string jieshourenming = this.txt_jieshouren.Text;
  104.             string where2 = "u_username='{0}'";
  105.             where2 = string.Format(where2, jieshourenming);
  106.             IList<users> listuname2 = usersBLL.Select(where2);
  107.             users users = listuname2[0];
  108.             int userId2 = users.u_id;
  109.             DateTime fsendtiem = DateTime.Now;
  110.             files fs = new files();
  111.             fs.f_filename = name;
  112.             //所有默认归纳为其他类别
  113.             fs.f_ftype_id = 1;
  114.             fs.f_dept_id = bumenid;
  115.             //发送人id
  116.             fs.f_sendu_id = userId;
  117.             //接收人id
  118.             fs.f_takeu_id = userId2;
  119.             //是否共享 0为否1为是
  120.             fs.f_isshare = 0;
  121.             //备注
  122.             //fs.f_remark = "";
  123.             //是否回执0为否1为是
  124.             fs.f_isreturn = 0;
  125.             //读否
  126.             fs.f_isread = 0;
  127.             //阅读次数
  128.             fs.f_readdegree = 0;
  129.             //阅读时间
  130.             fs.f_releasetime = DateTime.Now;
  131.             //状态 
  132.             fs.f_state = 0;
  133.             filesBLL.Insert(fs);
  134.             this.Response.Write(string.Format(GetRedirect.WINALERT, "发送成功"));
  135.         }
  136.     }
  137.     
  138. }