deletechengyuan.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 COM.OA.BLL;
  12. using System.Collections.Generic;
  13. using COM.OA.Entity;
  14. using System.Data.SqlClient;
  15. public partial class deletegroup : System.Web.UI.Page
  16. {
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         //取群ID
  20.         string qid = this.Request["qunid"];
  21.         //判断 群ID是否存在 不存在则跳回qunzu.aspx
  22.         if (qid != null)
  23.         {
  24.             //取用户ID
  25.             string id = this.Request["u_id"];
  26.             //判断用户是否为空,如果为空证明是第一次初始化,则显示该组成员。如果不为空则是2次加载,用于删除成员。
  27.             if (id != null)
  28.             {
  29.                 //把string类型转换成int 
  30.                 int idd = Int32.Parse(id);
  31.                 string where = "u_id='{0}'";
  32.                 where = string.Format(where, idd);
  33.                 //查询该用户信息
  34.                 IList<users> ulist = usersBLL.Select(where);
  35.                 //用实体类接受该用户
  36.                 if (ulist.Count != 0)
  37.                 {
  38.                     //取出用户信息 修改其群组属性,默认1为NULL无群组
  39.                     users uu = ulist[0];
  40.                     uu.u_g_id = 1;
  41.                     usersBLL.Update(uu);
  42.                     id = null;
  43.                     this.Response.Write(string.Format(GetRedirect.REDIRECT, "deletechengyuan.aspx?qunid=" + qid));
  44.                 }
  45.                 else
  46.                 {
  47.                     this.Response.Write(string.Format(GetRedirect.WINALERT,"该用户不存在"));
  48.                 }
  49.             }
  50.             else
  51.             {
  52.                 //根据群组ID 查出群内所有成员
  53.                 //string qid = this.Request.Form["Hidqunid"];
  54.                 int qunid = Int32.Parse(qid);
  55.                 //存储过程传参 必调类
  56.                 SqlParameter parambumen = new SqlParameter("@u_g_id", qunid);
  57.                 //调用存储过程并用 集合 接收
  58.                 IList<qunzuchengyuan> lists = BLLGeneric.Select<qunzuchengyuan>(CommandType.StoredProcedure, "qunzuchengyuan", parambumen);
  59.                 //设置GRIDVIEW数据源
  60.                 this.Gidv_qunchengyuan.DataSource = lists;
  61.                 //qunzuchengyuan gg = lists[0];
  62.                 //this.Gidv_qunchengyuan
  63.                 //进行绑定
  64.                 this.Gidv_qunchengyuan.DataBind();
  65.             }
  66.         }
  67.             //如果取不到群组ID则跳回qunzu.aspx
  68.         else
  69.         {
  70.             this.Response.Write(string.Format(GetRedirect.REDIRECT,"qunzu.aspx"));
  71.         }
  72.     }
  73. }