Exemplo n.º 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_wjcd Hyoa_wjcd = new HyoaClass.Hyoa_wjcd();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        string ls_insert = "";
        string ls_update = "";
        //取提醒方式
        string ls_txfs = "";
        CheckBoxList txfs = (CheckBoxList)this.FindControl("txfs");
        foreach (ListItem li in txfs.Items)
        {
            if (li.Selected)
            {
                if (li.Selected) ls_txfs += li.Value + ",";
            }
        }
        ls_txfs = ls_txfs.TrimEnd(',');

        //发送
        if (this.txtwhichoperation.Value == "1")
        {
            string[] lv_jsrid = this.txthy_jsrid.Text.Split('+');
            string[] lv_jsrname = this.txthy_jsrname.Value.Split('+');
            for (var i = 0; i < lv_jsrid.Length; i++)
            {
                if (lv_jsrid[i] != "")
                {
                    string ls_id = Hyoa_global.GetRandom();
                    ls_insert = "insert into hyp_wjcd (ID,DOCID,hy_type,hy_foldername,hy_fsrid,hy_fsrname,hy_jsrid,hy_jsrname";
                    ls_insert += ",hy_title,hy_body,hy_datetime,hy_ifsavetofjx,hy_yxj,hy_yjbg,hy_zycd,hy_hz,hy_status,hy_jzsj";
                    ls_insert += ",hy_txfs,hy_ifyhf,hy_txstatus) values ('" + ls_id + "','" + this.txtdocid.Value + "','收件','" + this.ddlhy_foldername.Text + "'";
                    ls_insert += ",'" + this.lblhy_fsrid.Text + "','" + this.lblhy_fsrname.Text + "','" + lv_jsrid[i].ToString() + "'";
                    ls_insert += ",'" + lv_jsrname[i].ToString() + "','" + this.txthy_title.Text + "','" + this.hy_content1.Value + "'";
                    ls_insert += ",'" + System.DateTime.Now.ToString() + "','','','','','','已发送','" + this.jzsj.Value + "','" + ls_txfs + "','0','0')";
                    Hyoa_global.ExcuteSQL(ls_insert);
                    //发送待办事宜提醒
                    HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
                    Hyoa_global.Senddbsy_global(ls_id, lv_jsrid[i].ToString(), lv_jsrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "wjcd/main_read.aspx?id=" + ls_id + "&pop=1", "待阅", "Mudelwjcd", "待办箱", "一般", this.txthy_title.Text, "请阅读", 0, "", "", "");
                    //发送即时通讯提醒
                    Hyoa_global.Sendjstx_global(ls_id, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_jsrid[i].ToString(), lv_jsrname[i].ToString(), "Mudelwjcd", this.txthy_title.Text, 0, "");
                }
            }
            //发送的同时,则保存一份
            if (this.txtop.Value == "add")
            {
                ls_insert = "insert into hyp_wjcd (ID,DOCID,hy_type,hy_foldername,hy_fsrid,hy_fsrname,hy_jsrid,hy_jsrname";
                ls_insert += ",hy_title,hy_body,hy_datetime,hy_ifsavetofjx,hy_yxj,hy_yjbg,hy_zycd,hy_hz,hy_status,hy_jzsj";
                ls_insert += ",hy_txfs,hy_ifyhf,hy_txstatus) values ('" + Hyoa_global.GetRandom() + "','" + this.txtdocid.Value + "','发件','" + this.ddlhy_foldername.Text + "'";
                ls_insert += ",'" + this.lblhy_fsrid.Text + "','" + this.lblhy_fsrname.Text + "','" + this.txthy_jsrid.Text + "'";
                ls_insert += ",'" + this.txthy_jsrname.Value + "','" + this.txthy_title.Text + "','" + this.hy_content1.Value + "'";
                ls_insert += ",'" + System.DateTime.Now.ToString() + "','" + this.ddlifsavetofjx.SelectedValue + "','','','',''";
                ls_insert += ",'已发送','" + this.jzsj.Value + "','" + ls_txfs + "','0','0')";
                Hyoa_global.ExcuteSQL(ls_insert);
            }
            else
            {
                string ls_id = this.txtid.Value;
                Hyoa_wjcd.ID = ls_id;
                this.txtid.Value = ls_id;

                ls_update = "update hyp_wjcd set DOCID='" + this.txtdocid.Value + "',hy_type='发件',hy_foldername='" + this.ddlhy_foldername.Text + "'";
                ls_update += ",hy_fsrid='" + this.lblhy_fsrid.Text + "',hy_fsrname='" + this.lblhy_fsrname.Text + "',hy_jsrid='" + this.txthy_jsrid.Text + "'";
                ls_update += ",hy_jsrname='" + this.txthy_jsrname.Value + "',hy_title='" + this.txthy_title.Text + "',hy_body='" + this.hy_content1.Value + "'";
                ls_update += ",hy_datetime='" + System.DateTime.Now.ToString() + "',hy_ifsavetofjx='" + this.ddlifsavetofjx.SelectedValue + "',hy_status='已发送'";
                ls_update += ",hy_jzsj='" + this.jzsj.Value + "',hy_txfs='" + ls_txfs + "' where ID= '" + ls_id + "' ";
                Hyoa_global.ExcuteSQL(ls_update);
                ls_tip = "保存成功!";
            }

            this.txturl.Value = "list_wjcd_yfs.aspx?mid=" + this.txtmudelid.Value + "&tableid=";     //返回URL
        }

        //保存
        if (this.txtwhichoperation.Value == "2")
        {
            if (this.txtop.Value == "add")
            {
                string ls_id = this.txtdocid.Value;
                Hyoa_wjcd.ID = ls_id;
                this.txtid.Value = ls_id;
                Hyoa_wjcd.DOCID = this.txtdocid.Value;
                Hyoa_wjcd.hy_type = "发件";
                Hyoa_wjcd.hy_foldername = this.ddlhy_foldername.Text;
                Hyoa_wjcd.hy_fsrid = this.lblhy_fsrid.Text;
                Hyoa_wjcd.hy_fsrname = this.lblhy_fsrname.Text;
                Hyoa_wjcd.hy_jsrid = this.txthy_jsrid.Text;
                Hyoa_wjcd.hy_jsrname = this.txthy_jsrname.Value;
                Hyoa_wjcd.hy_title = this.txthy_title.Text;
                Hyoa_wjcd.hy_body = this.hy_content1.Value;
                Hyoa_wjcd.hy_datetime = System.DateTime.Now.ToString();
                Hyoa_wjcd.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue;
                Hyoa_wjcd.hy_yxj = "";
                Hyoa_wjcd.hy_yjbg = "";
                Hyoa_wjcd.hy_zycd = "";
                Hyoa_wjcd.hy_hz = "";
                Hyoa_wjcd.hy_status = "未发送";
                Hyoa_wjcd.Insert();
                ls_tip = "保存成功!";
            }
            else
            {
                string ls_id = this.txtid.Value;
                Hyoa_wjcd.ID = ls_id;
                this.txtid.Value = ls_id;
                Hyoa_wjcd.DOCID = this.txtdocid.Value;
                Hyoa_wjcd.hy_type = "发件";
                Hyoa_wjcd.hy_foldername = this.ddlhy_foldername.Text;
                Hyoa_wjcd.hy_fsrid = this.lblhy_fsrid.Text;
                Hyoa_wjcd.hy_fsrname = this.lblhy_fsrname.Text;
                Hyoa_wjcd.hy_jsrid = this.txthy_jsrid.Text;
                Hyoa_wjcd.hy_jsrname = this.txthy_jsrname.Value;
                Hyoa_wjcd.hy_title = this.txthy_title.Text;
                Hyoa_wjcd.hy_body = this.hy_content1.Value;
                Hyoa_wjcd.hy_datetime = System.DateTime.Now.ToString();
                Hyoa_wjcd.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue;
                Hyoa_wjcd.hy_yxj = "";
                Hyoa_wjcd.hy_yjbg = "";
                Hyoa_wjcd.hy_zycd = "";
                Hyoa_wjcd.hy_hz = "";
                Hyoa_wjcd.hy_status = "未发送";
                Hyoa_wjcd.Update();
                ls_tip = "保存成功!";
            }
            this.txturl.Value = "list_wjcd_wfs.aspx?mid=" + this.txtmudelid.Value + "&tableid=";     //返回URL
        }

        //处理完成后的提示及跳转(增加刷新附件功能)
        if (this.txtifsxfj.Text == "1")
        {
            Response.Write("<script>window.location='main_wjcd.aspx?op=modify&mid=" + this.txtmudelid.Value + "&id=" + this.txtid.Value + "&url=" + this.txturl.Value + "'</script>");
        }
        else
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
    }
Exemplo n.º 2
0
    protected void btnsendinfo_Click(object sender, EventArgs e)
    {
        HyoaClass.Hyoa_wjcd Hyoa_wjcd = new HyoaClass.Hyoa_wjcd();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        String[] v_uids = this.txtuids.Value.Split(',');
        for (var i = 0; i < v_uids.Length; i++)
        {
            if (v_uids[i] != "")
            {
                DataTable dt = Hyoa_wjcd.Getdoc(v_uids[i]);
                if (dt.Rows.Count > 0)
                {
                    //考虑多人情况
                    String[] v_jsrids = dt.Rows[0]["hy_jsrid"].ToString().Split('+');
                    String[] v_jsrnames = dt.Rows[0]["hy_jsrname"].ToString().Split('+');
                    for (var j = 0; j < v_jsrids.Length; j++)
                    {
                        if (v_jsrids[j] != "")
                        {
                            //发送
                            Hyoa_wjcd.ID = Hyoa_global.GetRandom();
                            Hyoa_wjcd.DOCID = dt.Rows[0]["ID"].ToString();
                            Hyoa_wjcd.hy_type = "收件";
                            Hyoa_wjcd.hy_foldername = dt.Rows[0]["hy_foldername"].ToString();
                            Hyoa_wjcd.hy_fsrid = Session["hyuid"].ToString();
                            Hyoa_wjcd.hy_fsrname = Session["hyuname"].ToString();
                            Hyoa_wjcd.hy_jsrid = v_jsrids[j];
                            Hyoa_wjcd.hy_jsrname = v_jsrnames[j];
                            Hyoa_wjcd.hy_title = dt.Rows[0]["hy_title"].ToString();
                            Hyoa_wjcd.hy_body = dt.Rows[0]["hy_body"].ToString();
                            Hyoa_wjcd.hy_datetime = System.DateTime.Now.ToString();
                            Hyoa_wjcd.hy_ifsavetofjx = "";
                            Hyoa_wjcd.hy_yxj = "";
                            Hyoa_wjcd.hy_yjbg = "";
                            Hyoa_wjcd.hy_zycd = "";
                            Hyoa_wjcd.hy_hz = "";
                            Hyoa_wjcd.hy_status = "已发送";
                            Hyoa_wjcd.Insert();
                        }
                    }
                }
                //置为已发送
                Hyoa_wjcd.ID = v_uids[i];
                Hyoa_wjcd.hy_status = "已发送";
                Hyoa_wjcd.Updatestatus();

            }
        }
        this.txtuids.Value = "";
        //DataPlay(1);
        Response.Write("<script>alert('发送成功!');</script>");
        DataPlay(System.Int32.Parse(this.curpage.Text));
    }