示例#1
0
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "保存成功!";

        //新文档时
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_jiaose Hyoa_jiaose = new HyoaClass.Hyoa_jiaose();

        string lsrnd = "";
        if (this.txtop.Value == "add")
        {
            lsrnd = Hyoa_global.GetRandom();
            Hyoa_jiaose.id = lsrnd;
            Hyoa_jiaose.hy_jsname = this.txthy_jsname.Text;
            Hyoa_jiaose.hy_roleids = this.txthy_roleids.Text;
            Hyoa_jiaose.hy_rolenames = this.txthy_rolenames.Text;
            Hyoa_jiaose.hy_flowtacheids = this.txthy_flowtacheids.Text;
            Hyoa_jiaose.hy_flowtachenames = this.txthy_flowtachenames.Text;
            Hyoa_jiaose.hy_sort = float.Parse(this.txthy_sort.Text);
            Hyoa_jiaose.hy_bz = this.txthy_bz.Text;
            Hyoa_jiaose.Insert();
        }
        else
        {
            Hyoa_jiaose.id = this.txtdocid.Value;
            Hyoa_jiaose.hy_jsname = this.txthy_jsname.Text;
            Hyoa_jiaose.hy_roleids = this.txthy_roleids.Text;
            Hyoa_jiaose.hy_rolenames = this.txthy_rolenames.Text;
            Hyoa_jiaose.hy_flowtacheids = this.txthy_flowtacheids.Text;
            Hyoa_jiaose.hy_flowtachenames = this.txthy_flowtachenames.Text;
            Hyoa_jiaose.hy_sort = float.Parse(this.txthy_sort.Text);
            Hyoa_jiaose.hy_bz = this.txthy_bz.Text;
            Hyoa_jiaose.Update();

            //更新对应的ROLE
            //先找出该角色对应的人
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            DataTable dt = Hyoa_user.Getusersbyjiaoseid(this.txtdocid.Value);
            HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser();
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    //将人员+老roleid的先删除
            //    string[] lv_roleid;
            //    lv_roleid = this.txthy_roleids2.Text.Split(',');
            //    for (int j = 0; j < lv_roleid.Length; j++)
            //    {
            //        if (lv_roleid[j] != "")
            //        {
            //            Hyoa_roleuser.Deletebyroleidanduserid(lv_roleid[j], dt.Rows[i]["hy_userid"].ToString());
            //        }
            //    }
            //    //将人员+新roleid的插入
            //    string[] lv_roleidnew;
            //    lv_roleidnew = this.txthy_roleids.Text.Split(',');
            //    for (int j = 0; j < lv_roleidnew.Length; j++)
            //    {
            //        if (lv_roleidnew[j] != "")
            //        {
            //            Hyoa_roleuser.ID = Hyoa_global.GetRandom();
            //            Hyoa_roleuser.hy_roleid = lv_roleidnew[j];
            //            Hyoa_roleuser.hy_userid = dt.Rows[i]["hy_userid"].ToString();
            //            Hyoa_roleuser.Insert();
            //        }
            //    }
            //}

            ////更新对应的flowtache
            ////先找出该角色对应的人
            //HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser();
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    //将人员+老flowtacheid的先删除
            //    string[] lv_flowtacheidid;
            //    lv_flowtacheidid = this.txthy_flowtacheids2.Text.Split(',');
            //    for (int j = 0; j < lv_flowtacheidid.Length; j++)
            //    {
            //        if (lv_flowtacheidid[j] != "")
            //        {
            //            string ls_temp = lv_flowtacheidid[j];
            //            string[] lv_temp = ls_temp.Split('_');
            //            if (lv_temp.Length == 2)
            //            {
            //                string ls_flowid = lv_temp[0];
            //                string ls_tacheid = lv_temp[1];
            //                Hyoa_flowtacheuser.Deletebyroleidtacheiduserid(ls_flowid, ls_tacheid, dt.Rows[i]["hy_userid"].ToString());
            //            }
            //        }
            //    }
            //    //将人员+新flowtacheid的插入
            //    string[] lv_flowtacheididnew;
            //    lv_flowtacheididnew = this.txthy_flowtacheids.Text.Split(',');
            //    for (int j = 0; j < lv_flowtacheididnew.Length; j++)
            //    {
            //        if (lv_flowtacheididnew[j] != "")
            //        {
            //            string ls_temp = lv_flowtacheididnew[j];
            //            string[] lv_temp = ls_temp.Split('_');
            //            if (lv_temp.Length == 2)
            //            {
            //                string ls_flowid = lv_temp[0];
            //                string ls_tacheid = lv_temp[1];
            //                Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom();
            //                Hyoa_flowtacheuser.hy_flowid = ls_flowid;
            //                Hyoa_flowtacheuser.hy_tacheid = ls_tacheid;
            //                Hyoa_flowtacheuser.hy_userid = dt.Rows[i]["hy_userid"].ToString();
            //                Hyoa_flowtacheuser.Insert();
            //            }
            //        }
            //    }
            //}
        }

        //处理完成后的提示及跳转
        if (this.txtifpop.Value == "")
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
        else
        {
            Response.Write("<script>alert('" + ls_tip + "');self.close();</script>");
        }
    }