Example #1
0
 protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept();
         String[] v_uids = this.txtuids.Value.Split(',');
         for(var i=0;i<v_uids.Length;i++)
         {
             if (v_uids[i] != "")
             {
                 //this.Response.Write("<script>alert('aaa')</script>");
                 Hyoa_dept.hy_deptid = v_uids[i];
                 Hyoa_dept.Delete();
             }
         }
         this.txtuids.Value = "";
         //DataPlay(1);
         DataPlay(System.Int32.Parse(this.curpage.Text));
 }
Example #2
0
    protected void btndelinfo_Click(object sender, EventArgs e)
    {
        HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept();
        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
        String[] v_uids = this.txtuids.Value.Split(',');
        for(var i=0;i<v_uids.Length;i++)
        {
            if (v_uids[i] != "")
            {
                //this.Response.Write("<script>alert('aaa')</script>");
                //判断是否有人员
                DataTable dt_dept = Hyoa_dept.Getdept(v_uids[i]);
                DataTable dt_user = Hyoa_user.Getusersbydeptid(v_uids[i]);
                if (dt_user.Rows.Count > 0)
                {
                    Response.Write("<script>alert('" + dt_dept.Rows[0]["hy_deptname"].ToString() + "下存在人员,不能进行删除!');</script>");
                    return;
                }
                //判断是否有子部门
                DataTable dt_subdept = Hyoa_dept.GetSubDepts(v_uids[i]);
                if (dt_subdept.Rows.Count > 0)
                {
                    Response.Write("<script>alert('" + dt_dept.Rows[0]["hy_deptname"].ToString() + "下存在子部门,不能进行删除!');</script>");
                    return;
                }

                //写删除部门系统日志start
                HyoaClass.Hyoa_log Hyoa_log = new HyoaClass.Hyoa_log();
                Hyoa_log.ID = System.Guid.NewGuid().ToString();
                Hyoa_log.hy_createtime = System.DateTime.Now.ToString();
                string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (userip == null || userip == "")
                {
                    userip = Request.ServerVariables["REMOTE_ADDR"];
                }
                Hyoa_log.hy_oppip = userip;
                Hyoa_log.hy_opptype = "删除";
                Hyoa_log.hy_oppcontent = "删除部门:" + dt_dept.Rows[0]["hy_deptname"].ToString();
                Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString();
                Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString();
                Hyoa_log.Insert();

                Hyoa_dept.hy_deptid = v_uids[i];
                Hyoa_dept.Delete();
            }
        }
        this.txtuids.Value = "";
        //DataPlay(1);
        DataPlay(System.Int32.Parse(this.curpage.Text));
    }