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

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_chuansongwenjian : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.     }
  20.     protected void btBumenQF_Click(object sender, EventArgs e)
  21.     {
  22.         users loginuser = Session["loginuser"] as users;
  23.         if (loginuser == null)
  24.         {
  25.             this.Response.Write(string.Format(GetRedirect.REDIRECT, "../login.aspx"));
  26.         }
  27.         else
  28.         {
  29.             int userId = loginuser.u_id;
  30.         string bumen = this.DropDownList1.Text;
  31.         SqlParameter parambumen = new SqlParameter("@deptid", bumen);
  32.         IList<liandongrenqs> lists = BLLGeneric.Select<liandongrenqs>(CommandType.StoredProcedure, "liandongqs", parambumen);
  33.         //取要传的文件
  34.         //if (this.fluWenJian.FileName.Equals(""))
  35.         //{
  36.         //    this.Response.Write(string.Format(GetRedirect.WINALERT, "请选择要发送的文件"));
  37.         //}
  38.         //else { 
  39.         string name = this.fluWenJian.FileName;
  40.         int startIndex = this.fluWenJian.FileName.LastIndexOf(@"") + 1;
  41.         string fileName = this.fluWenJian.FileName.Substring(startIndex);
  42.         string phyFileName = this.Server.MapPath(@"..qs_wenjian" + "upload") + @"" + fileName;
  43.         this.fluWenJian.SaveAs(phyFileName);
  44.         //取当前时间
  45.         DateTime fsendtiem = DateTime.Now;
  46.         //取当前登陆人名
  47.         
  48.             //string fasongren = "haha";
  49.             //string where1 = "u_username='{0}'";
  50.             //where1 = string.Format(where1, fasongren);
  51.             //IList<users> listuname = usersBLL.Select(where1);
  52.             //users user = listuname[0];
  53.             //int userId = user.u_id;
  54.             //取部门ID
  55.             int bumenid = Int32.Parse(bumen);
  56.             //往消息实体类里存值
  57.             files fs = new files();
  58.             fs.f_filename = name;
  59.             //所有默认归纳为其他类别
  60.             fs.f_ftype_id = 1;
  61.             fs.f_dept_id = bumenid;
  62.             //发送人id
  63.             fs.f_sendu_id = userId;
  64.             //接收人id
  65.             //是否共享 0为否1为是
  66.             fs.f_isshare = 0;
  67.             //备注
  68.             //fs.f_remark = "";
  69.             //是否回执0为否1为是
  70.             fs.f_isreturn = 0;
  71.             //读否
  72.             fs.f_isread = 0;
  73.             //阅读次数
  74.             fs.f_readdegree = 0;
  75.             //阅读时间
  76.             fs.f_releasetime = DateTime.Parse("2008-01-01");
  77.             //状态 
  78.             fs.f_state = 0;
  79.             //循环取接收人
  80.             if (lists.Count > 0)
  81.             {
  82.                 foreach (liandongrenqs jdrqs in lists)
  83.                 {
  84.                     int jieshourenid = jdrqs.U_id;
  85.                     fs.f_takeu_id = jieshourenid;
  86.                     //往数据库里插入数据
  87.                     filesBLL.Insert(fs);
  88.                 }
  89.                 this.Response.Write(string.Format(GetRedirect.WINALERT, "插入成功"));
  90.            
  91.             }
  92.         }
  93.     }
  94. }