Beispiel #1
0
    //输出一个字段
    //li_tdnums_onerow:当前行已输出了几列
    //li_colnums_show:每行显示几列(标准情况下)
    //pi_isnewdoc 0:新文档  1:旧文档
    //ifhavarole:表单上是否有权限  0:lable输出 1:input输出
    //ifflowdoc:是否流程表单 0:非流程 1:流程
    //curtacheid:当前环节ID,用于判断字段是否在当前环节有权限
    public int GetFieldHtml(TableRow tRow, int li_tdnums_onerow, int li_colnums_show, string hy_fieldid, string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid)
    {
        int li_return = li_tdnums_onerow;

        string ls_laborinput = "0";     //输出LABLE还是INPUT    0:LABLE    1:INPUT
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.hy_mudelid.Text, hy_fieldid, this.hy_tableid.Text);

        int li_left = 30;
        int li_right = 70;
        if (dtfield.Rows.Count > 0)
        {
            string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString();     //字段类型
            if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "5")   //如果设置了不显示左侧说明文字,则不加载左侧列
            {
                li_return += 1;
                //插入单元格(左侧)
                TableCell tCell = new TableCell();
                tRow.Cells.Add(tCell);
                tCell.Width = Unit.Percentage((li_left / li_colnums_show));
                tCell.Height = Unit.Pixel(30);
                tCell.CssClass = "Tdcellleft";
                tCell.HorizontalAlign = HorizontalAlign.Center;
                tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString()));
            }
            else
            {
                li_left = 50;
                li_right = 50;
            }
            //插入单元格(右侧)
            TableCell tCell2 = new TableCell();
            tRow.Cells.Add(tCell2);
            tCell2.Width = Unit.Percentage((li_right / li_colnums_show));
            tCell2.Height = Unit.Pixel(30);
            tCell2.CssClass = "Tdcellright";
            if (dtfield.Rows[0]["hy_align"].ToString() == "left")
            {
                tCell2.HorizontalAlign = HorizontalAlign.Left;
            }
            if (dtfield.Rows[0]["hy_align"].ToString() == "center")
            {
                tCell2.HorizontalAlign = HorizontalAlign.Center;
            }
            if (dtfield.Rows[0]["hy_align"].ToString() == "right")
            {
                tCell2.HorizontalAlign = HorizontalAlign.Right;
            }
            tCell2.ColumnSpan = int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString());
            li_return += int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString());

            //赋值(新文档取配置的默认值,旧文档取数据库表中的值)
            string field_docvalue = "";
            if (pi_isnewdoc == "0")     //新文档
            {
                if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "-1")
                {
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0")
                    {
                        field_docvalue = dtfield.Rows[0]["hy_defaultvalue"].ToString();     //手工配置
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1")
                    {
                        DataTable dt_getfieldvalue = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString());
                        field_docvalue = dt_getfieldvalue.Rows[0][0].ToString();     //SQL语句
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2")
                    {
                        field_docvalue = Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString();     //SESSION
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3")
                    {
                        if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                            field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd");     //当前时间
                        else
                            field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");     //当前时间
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4")
                    {
                        //自动生成
                        if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
                        {
                            //得到目前最大的数值,然后+1,未找到则赋值为1
                            DataTable dt_autovalue = Hyoa_global.GetDataTable("select max(hyc_" + hy_fieldid + ") maxint from hyc_" + this.hy_tableid.Text);
                            if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "")
                                field_docvalue += "1";
                            else
                                field_docvalue += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString();
                        }
                        else
                        {
                            field_docvalue += System.Guid.NewGuid().ToString();
                        }
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "5")
                    {
                        field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString();
                    }
                }
            }
            else
            {
                if (field_type == "文本" || field_type == "多行文本" || field_type == "多行文本_TEXT" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器")
                {
                    string ls_sql = "select hyc_" + hy_fieldid + " from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'";
                    DataTable dt_getdocvalue = Hyoa_global.GetDataTable(ls_sql);
                    if (dt_getdocvalue.Rows.Count > 0)
                    {
                        field_docvalue = dt_getdocvalue.Rows[0][0].ToString();
                        if (field_type == "日期")
                        {
                            if (field_docvalue.Length > 8)
                            {
                                if (field_docvalue.Substring(0, 8) == "1900-1-1")
                                {
                                    field_docvalue = " ";
                                }
                                else
                                {
                                    if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                                    {
                                        field_docvalue = System.DateTime.Parse(field_docvalue).ToString("yyyy-MM-dd");
                                    }
                                }
                            }
                        }
                    }
                }
                if (field_type == "说明文字")
                {
                    field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString();
                }
                if (field_type == "意见加按钮")
                {
                    HyoaClass.Hyoa_yj Hyoa_yj = new HyoaClass.Hyoa_yj();
                    DataTable dt_yj = Hyoa_yj.Getyjsbydocidandfieldid_sx(this.txtdocid.Value, hy_fieldid);
                    if (dt_yj.Rows.Count > 0)
                    {
                        field_docvalue = "";
                        for (int ii = 0; ii < dt_yj.Rows.Count; ii++)
                        {
                            field_docvalue += dt_yj.Rows[ii]["hy_yjbody"].ToString() + "(" + dt_yj.Rows[ii]["hy_yjusername"].ToString() + " " + System.DateTime.Parse(dt_yj.Rows[ii]["hy_yjtime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + ")<br/>";
                        }
                    }
                }
            }

            //判断是输出LABL还是INPUT
            if (pi_isnewdoc == "0")     //新文档
            {
                if (ifhavarole == "1")  //有权限
                {
                    //有流程(判断当前环节这个字段是否有权限)
                    HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
                    ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid);
                    if (ls_laborinput == "0")
                    {
                        field_docvalue = "";
                    }
                }
                else
                {
                    field_docvalue = "";
                }
            }
            else     //旧文档
            {
                if (ifhavarole == "1")  //有权限
                {
                    //有流程(判断当前环节这个字段是否有权限)
                    HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
                    ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid);
                    //如果流程结束了,则输出lable
                    if (hy_curtacheid.Text == "**")
                    {
                        ls_laborinput = "0";
                    }
                    if (ls_laborinput == "1")
                    {
                        //如果当前字段中文名为“结束流程按钮”,则这个字段主要用于收文中阅件时,可点击这个按钮结束流程,用于控制这个按钮的隐藏和显示
                        if (dtfield.Rows[0]["hy_fieldname"].ToString() == "结束流程按钮")
                        {
                            td_flowend.Visible = true;
                        }
                    }
                }
                //如果是“可修改所有文档的权限人员”,则可以修改所有的字段
                if (Hyoa_global.isHaveRole("Role9995", Session["hyuid"].ToString()))
                {
                    ls_laborinput = "1";
                }
            }

            //如果是输出LABLE,值为空则赋为&nbsp;不为空时需要转换回车和空格
            if (ls_laborinput == "0")
            {
                if (field_docvalue == "")
                {
                    field_docvalue = "&nbsp;";
                }
                else
                {
                    if (field_type != "编辑器")
                    {
                        field_docvalue = RtfToText(field_docvalue);
                    }
                }
            }

            //单行文本
            if (field_type == "文本")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onfocus"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onblur"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "")
                    {
                        txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString()) / 2).ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "0");
                }
            }
            //多行文本
            if (field_type == "多行文本")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onfocus"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onblur"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "0");
                }
            }
            //多行文本_TEXT
            if (field_type == "多行文本_TEXT")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onfocus"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onblur"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "0");
                }
            }
            //按钮
            if (field_type == "按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = "&nbsp;";
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //一直显示的按钮
            if (field_type == "一直显示的按钮")
            {
                //-----开始输出字段------
                Label txtTextBox = new Label();
                txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                txtTextBox.Text = field_docvalue;
                tCell2.Controls.Add(txtTextBox);
            }
            //日期
            if (field_type == "日期")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onfocus"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onblur"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "1");
                }
            }
            //文本加按钮
            if (field_type == "文本加按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    txtTextBox.Width = Unit.Parse("60%");
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "")
                    {
                        txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString()) / 2).ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "0");
                }
            }
            //多行文本加按钮
            if (field_type == "多行文本加按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "0");
                }
            }
            //意见加按钮
            if (field_type == "意见加按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox_show = new Label();
                    txtTextBox_show.ID = dtfield.Rows[0]["hy_fieldid"].ToString() + "_show";
                    txtTextBox_show.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox_show);
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    //txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" /><input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_cz' value=' 重 置 ' class=btn3 onclick=\"document.getElementById('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "').value='';\" />";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "9");
                }
            }
            //数值
            if (field_type == "数值")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onfocus"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onblur"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString());
                    }
                    //if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "")
                    //{
                    //    txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString())).ToString());
                    //}
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "3");
                }
            }
            //对话框列表(下拉框
            if (field_type == "对话框列表")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    DropDownList ddlDropDownList = new DropDownList();
                    ddlDropDownList.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        ddlDropDownList.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        ddlDropDownList.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        ddlDropDownList.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0")
                    {
                        //手工配置
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#');
                            for (int i = 0; i < lv_options.Length; i++)
                            {
                                ddlDropDownList.Items.Add(lv_options[i].ToString());
                            }
                        }
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1")
                    {
                        //SQL语句
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            //如果SQL语句中含有特殊标示,则需要替换
                            string ls_sql = dtfield.Rows[0]["hy_options"].ToString();
                            if (ls_sql.Contains("用户ID"))
                            {
                                ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'");
                            }
                            if (ls_sql.Contains("用户名"))
                            {
                                ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'");
                            }
                            if (ls_sql.Contains("部门ID"))
                            {
                                ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'");
                            }
                            if (ls_sql.Contains("部门名"))
                            {
                                ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'");
                            }
                            DataTable dt_options = Hyoa_global.GetDataTable(ls_sql);
                            ddlDropDownList.DataSource = dt_options;
                            ddlDropDownList.DataTextField = dt_options.Columns[0].ColumnName;
                            ddlDropDownList.DataValueField = dt_options.Columns[0].ColumnName;
                            ddlDropDownList.DataBind();
                        }
                    }
                    ddlDropDownList.Items.Insert(0, new ListItem("--请选择--", ""));
                    ddlDropDownList.SelectedValue = field_docvalue;
                    tCell2.Controls.Add(ddlDropDownList);
                    //插入字段:共有哪几个查询条件
                    addsavefields(hy_fieldid, "0");
                }
            }
            //复选框(查询时直接显示文本框)
            if (field_type == "复选框")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    CheckBoxList txtTextBox = new CheckBoxList();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0")
                    {
                        //手工配置
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#');
                            for (int i = 0; i < lv_options.Length; i++)
                            {
                                txtTextBox.Items.Add(lv_options[i].ToString());
                            }
                        }
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1")
                    {
                        //SQL语句
                        //如果SQL语句中含有特殊标示,则需要替换
                        string ls_sql = dtfield.Rows[0]["hy_options"].ToString();
                        if (ls_sql.Contains("用户ID"))
                        {
                            ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("用户名"))
                        {
                            ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门ID"))
                        {
                            ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门名"))
                        {
                            ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'");
                        }
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            DataTable dt_options = Hyoa_global.GetDataTable(ls_sql);
                            txtTextBox.DataSource = dt_options;
                            txtTextBox.DataTextField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataValueField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataBind();
                        }
                    }
                    if (field_docvalue != "")
                    {
                        field_docvalue = "," + field_docvalue + ",";
                        foreach (ListItem li in txtTextBox.Items)
                        {
                            if (field_docvalue.Contains(li.Value))
                                li.Selected = true;
                        }
                    }
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "7");
                }
            }
            //单选框(查询时直接显示文本框)
            if (field_type == "单选框")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    RadioButtonList txtTextBox = new RadioButtonList();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0")
                    {
                        //手工配置
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#');
                            for (int i = 0; i < lv_options.Length; i++)
                            {
                                txtTextBox.Items.Add(lv_options[i].ToString());
                            }
                        }
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1")
                    {
                        //SQL语句
                        //如果SQL语句中含有特殊标示,则需要替换
                        string ls_sql = dtfield.Rows[0]["hy_options"].ToString();
                        if (ls_sql.Contains("用户ID"))
                        {
                            ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("用户名"))
                        {
                            ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门ID"))
                        {
                            ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门名"))
                        {
                            ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'");
                        }
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            DataTable dt_options = Hyoa_global.GetDataTable(ls_sql);
                            txtTextBox.DataSource = dt_options;
                            txtTextBox.DataTextField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataValueField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataBind();
                        }
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "8");
                }
            }
            //口令
            if (field_type == "口令")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = "&nbsp;";
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.Password;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onfocus"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onfocus", dtfield.Rows[0]["hy_onfocus"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onblur"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onblur", dtfield.Rows[0]["hy_onblur"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "")
                    {
                        txtTextBox.MaxLength = System.Int32.Parse((System.Int32.Parse(dtfield.Rows[0]["hy_wordlimit"].ToString())).ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "5");
                }
            }
            //附件组件
            if (field_type == "附件组件")
            {
                //读取附件内容
                HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatheridandFatherfield(this.txtdocid.Value, hy_fieldid);
                field_docvalue = "";
                if (dt_fileatt.Rows.Count > 0)
                {
                    for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++)
                    {
                        field_docvalue += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + "</a><br />";
                    }
                }
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (field_docvalue == "")
                    {
                        field_docvalue = "&nbsp;";
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<span id=\"fjinfoshow_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\">" + field_docvalue + "</span>";
                    field_docvalue += "<input type=button id='uploadfile1' value='附件管理' class=btn3 onclick=\"window.open('ggdy/main_fileatt.aspx?fatherid=" + this.txtdocid.Value + "&fatherfield=" + hy_fieldid + "','filewindow','height=350,width=600,top=100,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');\" />";
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //说明文字
            if (field_type == "说明文字")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //编辑器
            if (field_type == "编辑器")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    //隐藏文本框
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    txtTextBox.Style.Value = "display:none";
                    tCell2.Controls.Add(txtTextBox);
                    //编辑器
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<iframe ID=\"eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"system/eWebEditor/ewebeditor.htm?id=" + dtfield.Rows[0]["hy_fieldid"].ToString() + "&style=Portal\" frameborder=0 scrolling=no width=" + dtfield.Rows[0]["hy_width"].ToString() + " height=" + dtfield.Rows[0]["hy_height"].ToString() + "></iframe>";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                    //插入字段:共有哪几个INPUT字段
                    addsavefields(hy_fieldid, "6");
                }
            }
            //痕迹保留
            if (field_type == "痕迹保留")
            {
                string ls_btnname = "";
                HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko();
                DataTable dt_ntko = Hyoa_ntko.GetntkofileByfother(this.txtdocid.Value);
                if (dt_ntko.Rows.Count > 0)
                {
                    ls_btnname = "正文:" + this.hy_bt.Text;
                }
                else
                {
                    ls_btnname = "<span id='ntko_wsc'>未上传正文,请点击上传!</span>";
                }
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                    field_docvalue = "<a href=\"#\" onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\">" + ls_btnname + "</a> ";
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                    field_docvalue = "<a href=\"#\" onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\">" + ls_btnname + "</a> ";
                    //如果是流程模块,则根据环节判断一下
                    if (ifflowdoc == "1")
                    {
                        //判断是否为第一环节
                        HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork();
                        DataTable dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, "*");
                        if (dtflowwork.Rows.Count > 0)
                        {
                            if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == this.hy_curtacheid.Text)
                            {
                                //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                                field_docvalue = "<a href=\"#\" onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\">" + ls_btnname + "</a> ";
                            }
                            else
                            {
                                //判断是否为最后一个环节
                                dtflowwork.Clear();
                                dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, this.hy_curtacheid.Text);
                                if (dtflowwork.Rows.Count > 0)
                                {
                                    if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == "**")
                                    {
                                        //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                                        field_docvalue = "<a href=\"#\" onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\">" + ls_btnname + "</a> ";
                                    }
                                    else
                                    {
                                        //field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='" + ls_btnname + "' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                                        field_docvalue = "<a href=\"#\" onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\">" + ls_btnname + "</a> ";
                                    }
                                }

                            }
                        }
                    }
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //IFRAME列表
            if (field_type == "IFRAME列表")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=1\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //子表信息带链接

            //子表信息不带链接

        }
        return li_return;
    }
Beispiel #2
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("login.aspx");

        string ls_tip = "保存成功!";

        #region 新建时先进行一次保存
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        string sql = "";
        if (this.txtop.Value == "add")
        {
            //处理特殊字符
            this.hy_bt.Text = ReplaceString_Tszf(this.hy_bt.Text);
            if (Session["conntype"].ToString() == "SQL")
            {
                //edited by xf 20140625
                sql = "insert into hyc_" + this.hy_tableid.Text + " (DOCID,hy_mudelid,hy_tableid,hy_flowid,hy_flowname,hy_curtacheid,hy_curtachename,hy_curclrid,hy_curclrname,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_bt,hy_readuserlist,hy_readdatelist,hy_clrylist,hy_cyrylist) values (";
                sql += "'" + this.txtdocid.Value + "','" + this.hy_mudelid.Text + "','" + this.hy_tableid.Text + "','" + this.hy_flowid.Text + "','" + this.hy_flowname.Text + "'";
                sql += ",'" + this.hy_curtacheid.Text + "','" + this.hy_curtachename.Text + "','" + this.hy_curclrid.Text + "','" + this.hy_curclrname.Text + "','" + this.hy_djrid.Text + "'";
                sql += ",'" + this.hy_djrname.Text + "','" + this.hy_djrbmid.Text + "','" + this.hy_djrbmname.Text + "','" + this.hy_djsj.Text + "','" + this.hy_bt.Text + "'";
                sql += ",'','','," + Session["hyuid"].ToString() + ",',',') ";
            }
            if (Session["conntype"].ToString() == "ORACLE")
            {
                //edited by xf 20140625
                sql = "insert into hyc_" + this.hy_tableid.Text + " (DOCID,hy_mudelid,hy_tableid,hy_flowid,hy_flowname,hy_curtacheid,hy_curtachename,hy_curclrid,hy_curclrname,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_bt,hy_readuserlist,hy_readdatelist,hy_clrylist,hy_cyrylist) values (";
                sql += "'" + this.txtdocid.Value + "','" + this.hy_mudelid.Text + "','" + this.hy_tableid.Text + "','" + this.hy_flowid.Text + "','" + this.hy_flowname.Text + "'";
                sql += ",'" + this.hy_curtacheid.Text + "','" + this.hy_curtachename.Text + "','" + this.hy_curclrid.Text + "','" + this.hy_curclrname.Text + "','" + this.hy_djrid.Text + "'";
                sql += ",'" + this.hy_djrname.Text + "','" + this.hy_djrbmid.Text + "','" + this.hy_djrbmname.Text + "',to_date('" + this.hy_djsj.Text + "','YYYY-MM-DD HH24:MI:SS'),'" + this.hy_bt.Text + "'";
                sql += ",'','','," + Session["hyuid"].ToString() + ",',',') ";
            }
            Hyoa_global.ExcuteSQL(sql);

            //调用添加客户名称的方法
            if (this.hy_mudelid.Text == "MudelVODfwxy" && this.hy_tableid.Text == "TableVODfwxy" || this.hy_mudelid.Text == "Mudelffpdfwht" && this.hy_tableid.Text == "Tableffpdfwht"
             || this.hy_mudelid.Text == "Mudeljdhazfwht" && this.hy_tableid.Text == "Tablejdhazfwht" || this.hy_mudelid.Text == "Mudelsyyhfwxy" && this.hy_tableid.Text == "Tablesyyhfwxy"
             || this.hy_mudelid.Text == "MudelDVBazfwdght" && this.hy_tableid.Text == "TableDVBazfwdght" || this.hy_mudelid.Text == "MudelDVBazfwdght" && this.hy_tableid.Text == "TableDVBazfwdght"
             || this.hy_mudelid.Text == "Mudeljwdsjsxy" && this.hy_tableid.Text == "Tablejwdsjsxy" || this.hy_mudelid.Text == "Mudeljwdscsxy" && this.hy_tableid.Text == "Tablejwdscsxy"
             || this.hy_mudelid.Text == "Mudelkdjrht" && this.hy_tableid.Text == "Tablekdjrht" || this.hy_mudelid.Text == "Mudelsjcsfwht" && this.hy_tableid.Text == "Tablesjcsfwht"
             || this.hy_mudelid.Text == "Mudelsjgdcsfwht" && this.hy_tableid.Text == "Tablesjgdcsfwht" || this.hy_mudelid.Text == "Mudelsjtxyyhzxy" && this.hy_tableid.Text == "Tablesjtxyyhzxy"
             || this.hy_mudelid.Text == "Mudelzdyht" && this.hy_tableid.Text == "Tablezdyht")
            {
                Khdaxx();   //添加客户信息内容
                Htblzt();   //添加办理状态表
            }
            //add by zxx 20150305
            if (this.hy_mudelid.Text == "Mudelxjsq" && this.hy_tableid.Text == "Tablexjsq"
             || this.hy_mudelid.Text == "Mudelshd" && this.hy_tableid.Text == "Tableshd" || this.hy_mudelid.Text == "Mudelszds" && this.hy_tableid.Text == "Tableszds")
            {
                Htblzt();   //添加办理状态表
            }

        }
        #endregion
        //更新内容
        sql = "update hyc_" + this.hy_tableid.Text + " set hy_tableid='" + hy_tableid.Text + "',hy_bt='" + hy_bt.Text + "' ";
        #region 根据“需要保存的字段”来进行保存
        if (txtsavefields.Text != "")
        {
            string[] lv_savefields = txtsavefields.Text.Split(',');
            string[] lv_savefields_sx = txtsavefields_sx.Text.Split(',');
            string fielddocvalue = "";
            for (int i = 0; i < lv_savefields.Length; i++)
            {
                if (lv_savefields_sx[i].ToString() == "0")  //文本
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "1")  //日期
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        if (Session["conntype"].ToString() == "SQL")
                        {
                            if (fielddocvalue == "")
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=null";
                            else
                                sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                        }
                        if (Session["conntype"].ToString() == "ORACLE")
                        {
                            if (fielddocvalue == "")
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=null";
                            else
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=to_date('" + fielddocvalue + "','YYYY-MM-DD HH24:MI:SS')";
                        }
                    }
                }
                if (lv_savefields_sx[i].ToString() == "3")  //数值
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        if (fielddocvalue == "")
                            sql += ",hyc_" + lv_savefields[i].ToString() + "=0";
                        else
                            sql += ",hyc_" + lv_savefields[i].ToString() + "=" + fielddocvalue;
                    }
                }
                if (lv_savefields_sx[i].ToString() == "5")  //口令
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "6")  //编辑器
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "7")  //复选框
                {
                    string s = "";
                    CheckBoxList txfs = (CheckBoxList)this.FindControl(lv_savefields[i].ToString());
                    foreach (ListItem li in txfs.Items)
                    {
                        if (li.Selected)
                        {
                            if (li.Selected) s += li.Value + ",";
                        }
                    }
                    s = s.TrimEnd(',');
                    s = ReplaceString_Tszf(s);
                    sql += ",hyc_" + lv_savefields[i].ToString() + "='" + s + "'";
                }
                if (lv_savefields_sx[i].ToString() == "8")  //单选框
                {
                    string s = "";
                    RadioButtonList txfs = (RadioButtonList)this.FindControl(lv_savefields[i].ToString());
                    foreach (ListItem li in txfs.Items)
                    {
                        if (li.Selected)
                        {
                            if (li.Selected) s += li.Value + ",";
                        }
                    }
                    s = s.TrimEnd(',');
                    s = ReplaceString_Tszf(s);
                    sql += ",hyc_" + lv_savefields[i].ToString() + "='" + s + "'";
                }
                if (lv_savefields_sx[i].ToString() == "9")  //意见
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        if (fielddocvalue != "")
                        {
                            HyoaClass.Hyoa_yj Hyoa_yj = new HyoaClass.Hyoa_yj();
                            Hyoa_yj.yjid = Hyoa_global.GetRandom();
                            Hyoa_yj.hy_tableid = this.hy_tableid.Text;
                            Hyoa_yj.hy_fatherid = this.txtdocid.Value;
                            Hyoa_yj.hy_fieldid = lv_savefields[i].ToString();
                            Hyoa_yj.hy_yjuserid = Session["hyuid"].ToString();
                            Hyoa_yj.hy_yjusername = Session["hyuname"].ToString();
                            Hyoa_yj.hy_yjdeptid = Session["hydeptid"].ToString();
                            Hyoa_yj.hy_yjdeptname = Session["hydeptname"].ToString();
                            Hyoa_yj.hy_yjtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            Hyoa_yj.hy_yjbody = fielddocvalue;
                            Hyoa_yj.hy_yjip = HttpContext.Current.Request.UserHostAddress;
                            Hyoa_yj.hy_yjifshow = "";
                            Hyoa_yj.Insert();
                        }
                    }
                }
            }
        }
        #endregion

        #region 保存
        if (this.txtwhichoperation.Value == "1")
        {
            sql += hylcbctscl();  //特殊处理
        }
        #endregion

        #region 完成
        if (this.txtwc.Text == "1")
        {
            Htblztwc();  //特殊处理
        }
        #endregion

        #region 已办理
        if (this.txtwhichoperation.Value == "333")
        {
            //将待办事宜中置为“已办”
            sql = "update hyt_dbsy set hy_ifyb='1' wehre DOCID='" + this.Request.QueryString["docid"] + "' ";
            Hyoa_global.ExcuteSQL(sql);

        }
        #endregion

        #region 确认
        if (this.txtwhichoperation.Value == "111")
        {
            sql += ",hy_ifconfirm='1'";
        }
        #endregion

        #region 取消确认
        if (this.txtwhichoperation.Value == "112")
        {
            sql += ",hy_ifconfirm='0'";
        }
        #endregion

        #region 在主表单内嵌列表的功能中,保存、提交和确认子表单时,需要将父文档的DOCID保存到当前记录的hy_motherid中
        //ADD BY XF 2011-11-17
        if (this.txtwhichoperation.Value == "1" || this.txtwhichoperation.Value == "2" || this.txtwhichoperation.Value == "111")
        {
            if (Request.QueryString["op"] != null)
            {
                if (Request.QueryString["op"].ToString() != "")
                {
                    if (Request.QueryString["motherid"] != null)
                    {
                        if (Request.QueryString["motherid"].ToString() != "")
                        {
                            sql += ",hy_motherid='" + Request.QueryString["motherid"].ToString() + "'";
                        }
                    }
                }
            }
        }
        #endregion

        sql += " where DOCID='" + this.txtdocid.Value + "'";
        Hyoa_global.ExcuteSQL(sql);
        if (this.txtop.Value == "add")
        {
            string slbh_sql = "SELECT TOP 1 * FROM hyc_Tableslbhwh ORDER BY hyc_pxh";
            string update_sql = "";
            DataTable dt_slbh = Hyoa_global.GetDataTable(slbh_sql);
            if (dt_slbh.Rows.Count > 0)
            {
                int bh = Convert.ToInt32(dt_slbh.Rows[0]["hyc_slbh"].ToString());
                bh = bh + 1;
                string docid = dt_slbh.Rows[0]["DOCID"].ToString();
                update_sql = "UPDATE hyc_Tableslbhwh SET hyc_slbh = '" + bh + "' WHERE DOCID = '" + docid + "'";
            }
            Hyoa_global.ExcuteSQL(update_sql);
        }
        // add by wjs 20141029 end
        if (this.hy_tableid.Text == "Tabletjjzr")
        {
            Zbtjkz();
        }

        #region 处理完成后的提示及跳转(增加刷新附件功能)
        if (this.hy_mudelid.Text == "Mudelfp" && this.hy_tableid.Text == "Tablefpbd")
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='list_flc_fk.aspx?mid=Mudelfp&tableid=Tablefpbd&listid=6b07b57d-2906-4f5b-bc47-a8c7754ea5bf&rnd=56605fc0-3bde-450f-8f99-eb4e250a9183'</script>");
        }

        else
        {
            if (this.txtifsxfj.Text == "1")
            {

                Response.Write("<script>window.location='main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&url=" + this.txturl.Value + "'</script>");
            }
            else
            {
                if (this.txtifpop.Value == "")
                {

                    Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
                }
                else
                {

                    Response.Write("<script>alert('" + ls_tip + "');try{window.opener.location.reload();}catch(err){}self.close();</script>");
                }
            }
        }
        #endregion
    }
Beispiel #3
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("login.aspx");

        string ls_tip = "保存成功!";

        #region 新建时先进行一次保存
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        string sql = "";
        if (this.txtop.Value == "add")
        {
            //处理特殊字符
            this.hy_bt.Text = ReplaceString_Tszf(this.hy_bt.Text);
            if (Session["conntype"].ToString() == "SQL")
            {
                //edited by xf 20140625
                sql = "insert into hyc_" + this.hy_tableid.Text + " (DOCID,hy_mudelid,hy_tableid,hy_flowid,hy_flowname,hy_curtacheid,hy_curtachename,hy_curclrid,hy_curclrname,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_bt,hy_readuserlist,hy_readdatelist,hy_clrylist,hy_cyrylist) values (";
                sql += "'" + this.txtdocid.Value + "','" + this.hy_mudelid.Text + "','" + this.hy_tableid.Text + "','" + this.hy_flowid.Text + "','" + this.hy_flowname.Text + "'";
                sql += ",'" + this.hy_curtacheid.Text + "','" + this.hy_curtachename.Text + "','" + this.hy_curclrid.Text + "','" + this.hy_curclrname.Text + "','" + this.hy_djrid.Text + "'";
                sql += ",'" + this.hy_djrname.Text + "','" + this.hy_djrbmid.Text + "','" + this.hy_djrbmname.Text + "','" + this.hy_djsj.Text + "','" + this.hy_bt.Text + "'";
                sql += ",'','','," + Session["hyuid"].ToString() + ",',',') ";
            }
            if (Session["conntype"].ToString() == "ORACLE")
            {
                //edited by xf 20140625
                sql = "insert into hyc_" + this.hy_tableid.Text + " (DOCID,hy_mudelid,hy_tableid,hy_flowid,hy_flowname,hy_curtacheid,hy_curtachename,hy_curclrid,hy_curclrname,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_bt,hy_readuserlist,hy_readdatelist,hy_clrylist,hy_cyrylist) values (";
                sql += "'" + this.txtdocid.Value + "','" + this.hy_mudelid.Text + "','" + this.hy_tableid.Text + "','" + this.hy_flowid.Text + "','" + this.hy_flowname.Text + "'";
                sql += ",'" + this.hy_curtacheid.Text + "','" + this.hy_curtachename.Text + "','" + this.hy_curclrid.Text + "','" + this.hy_curclrname.Text + "','" + this.hy_djrid.Text + "'";
                sql += ",'" + this.hy_djrname.Text + "','" + this.hy_djrbmid.Text + "','" + this.hy_djrbmname.Text + "',to_date('" + this.hy_djsj.Text + "','YYYY-MM-DD HH24:MI:SS'),'" + this.hy_bt.Text + "'";
                sql += ",'','','," + Session["hyuid"].ToString() + ",',',') ";
            }
            Hyoa_global.ExcuteSQL(sql);

            //插入历史处理表
            Hyoa_global.Saveflowhistoryinfo_cl_global(this.txtdocid.Value, this.hy_flowid.Text, this.hy_flowname.Text, this.hy_curtacheid.Text, this.hy_curtachename.Text, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "", "", "", this.hy_djsj.Text, "");
        }
        #endregion

        //更新内容
        sql = "update hyc_" + this.hy_tableid.Text + " set hy_tableid='" + hy_tableid.Text + "',hy_bt='" + hy_bt.Text + "' ";

        #region 根据“需要保存的字段”来进行保存
        if (txtsavefields.Text != "")
        {
            string[] lv_savefields = txtsavefields.Text.Split(',');
            string[] lv_savefields_sx = txtsavefields_sx.Text.Split(',');
            string fielddocvalue = "";
            for (int i = 0; i < lv_savefields.Length; i++)
            {
                if (lv_savefields_sx[i].ToString() == "0")  //文本
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "1")  //日期
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        if (Session["conntype"].ToString() == "SQL")
                        {
                            if (fielddocvalue == "")
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=null";
                            else
                                sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                        }
                        if (Session["conntype"].ToString() == "ORACLE")
                        {
                            if (fielddocvalue == "")
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=null";
                            else
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=to_date('" + fielddocvalue + "','YYYY-MM-DD HH24:MI:SS')";
                        }
                    }
                }
                if (lv_savefields_sx[i].ToString() == "3")  //数值
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        if (fielddocvalue == "")
                            sql += ",hyc_" + lv_savefields[i].ToString() + "=0";
                        else
                            sql += ",hyc_" + lv_savefields[i].ToString() + "=" + fielddocvalue;
                    }
                }
                if (lv_savefields_sx[i].ToString() == "5")  //口令
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "6")  //编辑器
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "7")  //复选框
                {
                    string s = "";
                    CheckBoxList txfs = (CheckBoxList)this.FindControl(lv_savefields[i].ToString());
                    foreach (ListItem li in txfs.Items)
                    {
                        if (li.Selected)
                        {
                            if (li.Selected) s += li.Value + ",";
                        }
                    }
                    s = s.TrimEnd(',');
                    s = ReplaceString_Tszf(s);
                    sql += ",hyc_" + lv_savefields[i].ToString() + "='" + s + "'";
                }
                if (lv_savefields_sx[i].ToString() == "8")  //单选框
                {
                    string s = "";
                    RadioButtonList txfs = (RadioButtonList)this.FindControl(lv_savefields[i].ToString());
                    foreach (ListItem li in txfs.Items)
                    {
                        if (li.Selected)
                        {
                            if (li.Selected) s += li.Value + ",";
                        }
                    }
                    s = s.TrimEnd(',');
                    s = ReplaceString_Tszf(s);
                    sql += ",hyc_" + lv_savefields[i].ToString() + "='" + s + "'";
                }
                if (lv_savefields_sx[i].ToString() == "9")  //意见
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        if (fielddocvalue != "")
                        {
                            HyoaClass.Hyoa_yj Hyoa_yj = new HyoaClass.Hyoa_yj();
                            Hyoa_yj.yjid = Hyoa_global.GetRandom();
                            Hyoa_yj.hy_tableid = this.hy_tableid.Text;
                            Hyoa_yj.hy_fatherid = this.txtdocid.Value;
                            Hyoa_yj.hy_fieldid = lv_savefields[i].ToString();
                            Hyoa_yj.hy_yjuserid = Session["hyuid"].ToString();
                            Hyoa_yj.hy_yjusername = Session["hyuname"].ToString();
                            Hyoa_yj.hy_yjdeptid = Session["hydeptid"].ToString();
                            Hyoa_yj.hy_yjdeptname = Session["hydeptname"].ToString();
                            Hyoa_yj.hy_yjtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            Hyoa_yj.hy_yjbody = fielddocvalue;
                            Hyoa_yj.hy_yjip = HttpContext.Current.Request.UserHostAddress;
                            Hyoa_yj.hy_yjifshow = "";
                            Hyoa_yj.Insert();
                        }
                    }
                }
            }
        }
        #endregion

        #region 保存
        if (this.txtwhichoperation.Value == "1")
        {
            sql += hylcbctscl();  //特殊处理
        }
        #endregion

        #region 提交
        if (this.txtwhichoperation.Value == "2")
        {
            //更新主文档
            sql += ",hy_curtacheid='" + this.txtnexttacheid.Value + "'";
            sql += ",hy_curtachename='" + this.txtnexttachename.Value + "'";
            sql += ",hy_curclrid='" + this.txtnextclrid.Value + "'";
            sql += ",hy_curclrname='" + this.txtnextclrname.Value + "'";

            //---- 添加当前环节的处理时间 ---- start
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocidtacheid(this.txtdocid.Value, this.hy_curtacheid.Text);
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                {
                    Hyoa_flowhistoryinfo_cl.hy_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    Hyoa_flowhistoryinfo_cl.hy_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                Hyoa_flowhistoryinfo_cl.Update();
            }
            //---- 添加当前环节的处理时间 ---- end

            ////////////////////如果后续环节选择了“结束”,则不需要发待办事宜和短消息 start//////////////////////
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            if (this.txtnexttacheid.Value != "**")
            {
                //---  创建后续处理的处理记录+建立处理人待办事宜 ---- start
                Hyoa_global.Saveflowhistoryinfo_cl_global(this.txtdocid.Value, this.hy_flowid.Text, this.hy_flowname.Text, this.txtnexttacheid.Value, this.txtnexttachename.Value, this.txtnextclrid.Value, this.txtnextclrname.Value, "", this.txtnextcyrid.Value, this.txtnextcyrname.Value, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "");

                //待办事宜、短信、即时消息
                string[] lv_dbrid = this.txtnextclrid.Value.Split(new Char[] { ',' });
                string[] lv_dbrname = this.txtnextclrname.Value.Split(new Char[] { ',' });
                for (var i = 0; i < lv_dbrid.Length; i++)
                {
                    if (lv_dbrid[i].ToString() != "")
                    {
                        //得到当前用户手机号
                        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                        string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                        //得到后续处理人手机号
                        string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());

                        //给后续处理人发送一个新的待办事宜(提醒)
                        Hyoa_global.Senddbsy_global(this.txtdocid.Value, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&pop=1", "待办", this.hy_mudelid.Text, "待办箱", "一般", this.hy_bt.Text, "请办理", 0, this.hy_flowid.Text, this.txtnexttacheid.Value, this.hy_tableid.Text);
                        //给后续处理人发送即时消息(提醒)
                        if (this.txtisSendjstx_clr.Value == "1")
                        {
                            Hyoa_global.Sendjstx_global(this.txtdocid.Value, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), this.hy_mudelid.Text, this.hy_bt.Text, 0, this.hy_tableid.Text);
                        }
                        //给后续处理人发送短信(提醒)
                        if (this.txtisSendsms_clr.Value == "1")
                        {
                            Hyoa_global.Sendsms_global(this.txtdocid.Value, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, this.hy_mudelid.Text, this.hy_bt.Text, 1, "", "", 0, this.hy_tableid.Text);
                        }
                    }

                }
                //--- 创建后续处理的处理记录+建立处理人待办事宜 ---- end

                //--- 创建后续传阅记录+建立待办事宜 ---- start
                string[] lv_cyrid = this.txtnextcyrid.Value.Split(new Char[] { ',' });
                string[] lv_cyrname = this.txtnextcyrname.Value.Split(new Char[] { ',' });
                for (var i = 0; i < lv_cyrid.Length; i++)
                {
                    if (lv_cyrid[i].ToString() != "")
                    {
                        //建立传阅数据
                        Hyoa_global.Saveflowhistoryinfo_cy_global(this.txtdocid.Value, this.hy_flowid.Text, this.hy_flowname.Text, this.txtnexttacheid.Value, this.txtnexttachename.Value, lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), "", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                        //待办事宜、短信、即时消息
                        //得到当前用户手机号
                        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                        string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                        //得到后续传阅人手机号
                        string cb_cyrsjh = Hyoa_user.GetMobilebyuserid(lv_cyrid[i].ToString());

                        //给后续处理人发送一个新的待办事宜(提醒)
                        Hyoa_global.Senddbsy_global(this.txtdocid.Value, lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&pop=1", "待阅", this.hy_mudelid.Text, "待办箱", "一般", this.hy_bt.Text, "请阅读", 0, this.hy_flowid.Text, this.txtnexttacheid.Value, this.hy_tableid.Text);
                        //给后续处理人发送即时消息(提醒)
                        if (this.txtisSendjstx_cyr.Value == "1")
                        {
                            Hyoa_global.Sendjstx_global(this.txtdocid.Value, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), this.hy_mudelid.Text, this.hy_bt.Text, 0, this.hy_tableid.Text);
                        }
                        //给后续处理人发送短信(提醒)
                        if (this.txtisSendsms_cyr.Value == "1")
                        {
                            Hyoa_global.Sendsms_global(this.txtdocid.Value, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), cb_fsrsjh, lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), cb_cyrsjh, this.hy_mudelid.Text, this.hy_bt.Text, 1, "", "", 0, this.hy_tableid.Text);
                        }

                    }
                }
                //--- 创建后续传阅记录+建立待办事宜 ---- end
            }
            ////////////////////如果后续环节选择了“结束”,则不需要发待办事宜和短消息 start//////////////////////

            //--- 当前处理人的待办事宜转已办 ---- start
            Hyoa_dbsy.Dbsytoybbydocidtacheiduserid(this.txtdocid.Value, this.hy_curtacheid.Text, this.Session["hyuid"].ToString());
            //--- 当前处理人的待办事宜转已办 ---- end
            ls_tip = "文档已成功发送到[" + this.txtnexttachename.Value + "]环节";
            sql += hylcclcylist();  //更新hy_clrylist hy_cyrylist edited by xf 20140625
            sql += hylctjtscl();//特殊处理

            //调用添加客户名称的方法
            if (this.hy_mudelid.Text == "MudelVODfwxy" && this.hy_tableid.Text == "TableVODfwxy" || this.hy_mudelid.Text == "Mudelffpdfwht" && this.hy_tableid.Text == "Tableffpdfwht"
             || this.hy_mudelid.Text == "Mudeljdhazfwht" && this.hy_tableid.Text == "Tablejdhazfwht" || this.hy_mudelid.Text == "Mudelsyyhfwxy" && this.hy_tableid.Text == "Tablesyyhfwxy"
             || this.hy_mudelid.Text == "MudelDVBazfwdght" && this.hy_tableid.Text == "TableDVBazfwdght" || this.hy_mudelid.Text == "MudelDVBazfwdght" && this.hy_tableid.Text == "TableDVBazfwdght"
             || this.hy_mudelid.Text == "Mudeljwdsjsxy" && this.hy_tableid.Text == "Tablejwdsjsxy" || this.hy_mudelid.Text == "Mudeljwdscsxy" && this.hy_tableid.Text == "Tablejwdscsxy"
             || this.hy_mudelid.Text == "Mudelkdjrht" && this.hy_tableid.Text == "Tablekdjrht" || this.hy_mudelid.Text == "Mudelsjcsfwht" && this.hy_tableid.Text == "Tablesjcsfwht"
             || this.hy_mudelid.Text == "Mudelsjgdcsfwht" && this.hy_tableid.Text == "Tablesjgdcsfwht" || this.hy_mudelid.Text == "Mudelsjtxyyhzxy" && this.hy_tableid.Text == "Tablesjtxyyhzxy"
             || this.hy_mudelid.Text == "Mudelzdyht" && this.hy_tableid.Text == "Tablezdyht")
            {
                if (this.txtop.Value == "add")
                {
                    Khdaxx();
                }
            }
        }
        #endregion

        #region 收回
        if (this.txtwhichoperation.Value == "3")
        {
            //得到上个环节处理人
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(this.txtdocid.Value);
            if (dt_clinfo.Rows.Count > 1)
            {
                //删除当前处理人员的待办事宜
                HyoaClass.Hyoa_dbsy Hyoa_dbsy_sh = new HyoaClass.Hyoa_dbsy();
                //edited by xf 20140625
                string[] lv_temp = dt_clinfo.Rows[0]["hy_clrid"].ToString().Split(',');
                for (int xf = 0; xf < lv_temp.Length; xf++)
                {
                    Hyoa_dbsy_sh.DeleteByDocid_flowid_tacheid_userid(this.txtdocid.Value, dt_clinfo.Rows[0]["hy_flowid"].ToString(), dt_clinfo.Rows[0]["hy_tacheid"].ToString(), lv_temp[xf]);
                }

                string ls_lastclrid = dt_clinfo.Rows[1]["hy_clrid"].ToString();         //上个环节处理人ID
                string ls_lastclrname = dt_clinfo.Rows[1]["hy_clrname"].ToString();     //上个环节处理人中文名
                string ls_lastcldoc = dt_clinfo.Rows[1]["ID"].ToString();               //上个环节处理的记录ID
                string ls_lasttacheid = dt_clinfo.Rows[1]["hy_tacheid"].ToString();     //上个环节处理环节ID
                string ls_lasttachename = dt_clinfo.Rows[1]["hy_tachename"].ToString(); //上个环节处理环节名称
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                dt_clinfo.Clear();

                //删除当前处理的记录
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.Delete();
                //清空上个环节处理时间,更新创建时间
                Hyoa_flowhistoryinfo_cl.ID = ls_lastcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = "";
                Hyoa_flowhistoryinfo_cl.hy_createtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Hyoa_flowhistoryinfo_cl.Update_sh();
                //更新主文档中的当前环节ID、当前环节名称、当前处理人ID和中文名
                sql += ",hy_curtacheid='" + ls_lasttacheid + "'";
                sql += ",hy_curtachename='" + ls_lasttachename + "'";
                sql += ",hy_curclrid='" + ls_lastclrid + "'";
                sql += ",hy_curclrname='" + ls_lastclrname + "'";
                ls_tip = "文档已成功收回到[" + ls_lasttachename + "]环节";
                sql += hylcclcylist();  //更新hy_clrylist hy_cyrylist edited by xf 20140625
                sql += hylcshtscl();//特殊处理
            }
        }
        #endregion

        #region 退回
        if (this.txtwhichoperation.Value == "4")
        {
            //更新主文档
            sql += ",hy_curtacheid='" + this.txtnexttacheid.Value + "'";
            sql += ",hy_curtachename='" + this.txtnexttachename.Value + "'";
            sql += ",hy_curclrid='" + this.txtnextclrid.Value + "'";
            sql += ",hy_curclrname='" + this.txtnextclrname.Value + "'";

            //处理历史处理记录
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(this.txtdocid.Value);
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                string ls_clsj = "";                                                    //当前处理的记录处理时间
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                    ls_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                else
                    ls_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                dt_clinfo.Clear();
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = ls_clsj;
                Hyoa_flowhistoryinfo_cl.Update();
            }
            //新建一条处理记录
            Hyoa_global.Saveflowhistoryinfo_cl_global(this.txtdocid.Value, this.hy_flowid.Text, this.hy_flowname.Text, this.txtnexttacheid.Value, this.txtnexttachename.Value, this.txtnextclrid.Value, this.txtnextclrname.Value, "", "", "", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "是");

            //处理待办事宜
            //转已办-当前处理人的待办事宜
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            Hyoa_dbsy.Dbsytoybbydociduserid(this.txtdocid.Value, this.Session["hyuid"].ToString());

            //得到发送人手机号
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());

            //(考虑多人的情况)
            string[] lv_dbrid = this.txtnextclrid.Value.Split(new Char[] { ',' });
            string[] lv_dbrname = this.txtnextclrname.Value.Split(new Char[] { ',' });

            for (var i = 0; i < lv_dbrid.Length; i++)
            {
                if (lv_dbrid[i].ToString() != "")
                {
                    //得到接收人手机号
                    string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());
                    HyoaClass.Hyoa_global Hyoa_global2 = new HyoaClass.Hyoa_global();

                    //给退回到的处理人发送一个新的待办事宜(提醒)
                    Hyoa_global2.Senddbsy_global(this.txtdocid.Value, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&pop=1", "待办", this.hy_mudelid.Text, "待办箱", "一般", this.hy_bt.Text, "请办理", 0, this.hy_flowid.Text, this.txtnexttacheid.Value, this.hy_tableid.Text);
                    //给退回到的处理人发送即时消息(提醒)
                    if (this.txtisSendjstx.Value == "1")
                    {
                        Hyoa_global.Sendjstx_global(this.txtdocid.Value, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), this.hy_mudelid.Text, this.hy_bt.Text, 0, this.hy_tableid.Text);
                    }
                    //给退回到的处理人发送短信(提醒)
                    if (this.txtisSendsms.Value == "1")
                    {
                        Hyoa_global.Sendsms_global(this.txtdocid.Value, this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, this.hy_mudelid.Text, this.hy_bt.Text, 1, "", "", 0, this.hy_tableid.Text);
                    }
                }
            }
            ls_tip = "已成功退回到[" + this.txtnexttachename.Value + "]环节";
            sql += hylcthtscl();//特殊处理
        }
        #endregion

        #region 多人处理
        if (this.txtwhichoperation.Value == "5")
        {
            //更新主文档
            string ls_newclrid = Hyoa_global.MoveOneString_dh(this.hy_curclrid.Text, this.Session["hyuid"].ToString());
            string ls_newclrname = Hyoa_global.MoveOneString_dh(this.hy_curclrname.Text, this.Session["hyuname"].ToString());
            sql += ",hy_curclrid='" + ls_newclrid + "'";
            sql += ",hy_curclrname='" + ls_newclrname + "'";
            //处理当前记录
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = new DataTable();
            dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(this.txtdocid.Value);
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                string ls_clsj = "";                                                    //当前处理的记录处理时间
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                    ls_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                else
                    ls_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                dt_clinfo.Clear();
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = ls_clsj;
                Hyoa_flowhistoryinfo_cl.Update();
            }
            //处理待办事宜
            //转已办-当前处理人的待办事宜
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            Hyoa_dbsy.Dbsytoybbydociduserid(this.txtdocid.Value, this.Session["hyuid"].ToString());
            ls_tip = "提交成功,当前环节还需要[" + ls_newclrname + "]进行办理";
            sql += hylcdrcltscl();//特殊处理
        }
        #endregion

        #region 催办
        if (this.txtwhichoperation.Value == "6")
        {
            string cb_docid = this.txtdocid.Value;
            string cb_dbrid = this.hy_curclrid.Text;
            string cb_dbrname = this.hy_curclrname.Text;
            string cb_fsrid = this.Session["hyuid"].ToString();
            string cb_fsrname = this.Session["hyuname"].ToString();
            string cb_url = "main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&pop=1";
            string cb_property = "催办";
            string cb_mudelid = this.hy_mudelid.Text;
            string cb_foldername = "待办箱";
            string cb_hj = "一般";
            string cb_bt = this.txtcbideas.Value + "-" + this.hy_bt.Text;
            string cb_subbt = "请阅读";
            float cb_ifyb = 0;
            string cb_flowid = this.hy_flowid.Text;
            string cb_tacheid = this.hy_curtacheid.Text;
            string cb_from = this.hy_mudelid.Text;

            //得到发送人手机号
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(cb_fsrid);
            //得到接收人手机号
            string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(cb_dbrid);

            //给当前处理人发送一个新的待办事宜(提醒)
            Hyoa_global.Senddbsy_global(cb_docid, cb_dbrid, cb_dbrname, cb_fsrid, cb_fsrname, cb_url, cb_property, cb_mudelid, cb_foldername, cb_hj, cb_bt, cb_subbt, cb_ifyb, cb_flowid, cb_tacheid, this.hy_tableid.Text);
            //给当前处理人发送即时消息(提醒)
            if (this.txtisSendjstx.Value == "1")
            {
                Hyoa_global.Sendjstx_global(cb_docid, cb_fsrid, cb_fsrname, cb_dbrid, cb_dbrname, cb_from, cb_bt, 0, this.hy_tableid.Text);
            }
            //给当前处理人发送短信(提醒)
            if (this.txtisSendsms.Value == "1")
            {
                Hyoa_global.Sendsms_global(cb_docid, cb_fsrid, cb_fsrname, cb_fsrsjh, cb_dbrid, cb_dbrname, cb_jsrsjh, cb_from, cb_bt, 1, "", "", 0, this.hy_tableid.Text);
            }

            ls_tip = "催办成功!";
            sql += hylccbtscl();//特殊处理
        }
        #endregion

        #region 流程结束时的提交
        if (this.txtwhichoperation.Value == "7")
        {
            //更新主文档
            sql += ",hy_curtacheid='**'";
            sql += ",hy_curtachename='结束'";
            sql += ",hy_curclrid=''";
            sql += ",hy_curclrname=''";
            //更新处理表
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(this.txtdocid.Value);
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                string ls_clsj = "";                                                    //当前处理的记录处理时间
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                    ls_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                else
                    ls_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                dt_clinfo.Clear();
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = ls_clsj;
                Hyoa_flowhistoryinfo_cl.Update();

                //开票流程中开票在流程结束时付款处理。
                if (this.hy_tableid.Text == "Tablefpbd")
                {
                    htfk();
                }
            }
            ////流程结束时删除所有该文档对应的待办事宜
            //HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            //Hyoa_dbsy.Deletebydocid(this.txtdocid.Value);

            //处理待办事宜
            //转已办-当前处理人的待办事宜
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            Hyoa_dbsy.Dbsytoybbydociduserid(this.txtdocid.Value, this.Session["hyuid"].ToString());

            ls_tip = "流程结束!";
            sql += hylcjstscl();//特殊处理
        }

        #endregion

        #region 收文阅件分发
        if (this.txtwhichoperation.Value == "8")
        {
            string cb_docid = this.txtdocid.Value;
            string cb_dbrid = this.hy_curclrid.Text;
            string cb_dbrname = this.hy_curclrname.Text;
            string cb_fsrid = this.Session["hyuid"].ToString();
            string cb_fsrname = this.Session["hyuname"].ToString();
            string cb_url = "main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&pop=1";
            string cb_property = "待阅";
            string cb_mudelid = this.hy_mudelid.Text;
            string cb_foldername = "待办箱";
            string cb_hj = "一般";
            string cb_bt = this.hy_bt.Text;
            string cb_subbt = "请阅读";
            float cb_ifyb = 0;
            string cb_flowid = this.hy_flowid.Text;
            string cb_tacheid = this.hy_curtacheid.Text;
            string cb_from = this.hy_mudelid.Text;

            string[] lv_dbrid = this.txtswly_dbsy_userids.Text.Split(new Char[] { '+' });
            string[] lv_dbrname = this.txtswly_dbsy_usernames.Text.Split(new Char[] { '+' });
            for (var i = 0; i < lv_dbrid.Length; i++)
            {
                if (lv_dbrid[i].ToString() != "")
                {
                    //得到当前用户手机号
                    HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                    string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                    //得到后续处理人手机号
                    string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());

                    //给后续处理人发送一个新的待办事宜(提醒)
                    Hyoa_global.Senddbsy_global(cb_docid, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_fsrid, cb_fsrname, cb_url, cb_property, cb_mudelid, cb_foldername, cb_hj, cb_bt, cb_subbt, 0, cb_flowid, cb_tacheid, this.hy_tableid.Text);
                    //给后续处理人发送即时消息(提醒)
                    Hyoa_global.Sendjstx_global(cb_docid, cb_fsrid, cb_fsrname, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_mudelid, cb_bt, 0, this.hy_tableid.Text);
                    //给后续处理人发送短信(提醒)
                    Hyoa_global.Sendsms_global(cb_docid, cb_fsrid, cb_fsrname, cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, cb_mudelid, cb_bt, 1, "", "", 0, this.hy_tableid.Text);

                    //在hyp_flowhistoryinfo_cy中添加传阅信息
                    string sql_cy = "select * from hyp_flowhistoryinfo_cy where DOCID='" + this.txtdocid.Value + "' and hy_cyrid='" + lv_dbrid[i] + "' order by hy_createtime DESC ";
                    DataTable dt_cy = Hyoa_global.GetDataTable(sql_cy);
                    if (dt_cy.Rows.Count > 0)
                    {
                    }
                    else
                    {
                        HyoaClass.Hyoa_flowhistoryinfo_cy Hyoa_flowhistoryinfo_cy = new HyoaClass.Hyoa_flowhistoryinfo_cy();
                        Hyoa_flowhistoryinfo_cy.ID = Hyoa_global.GetRandom();
                        Hyoa_flowhistoryinfo_cy.DOCID = this.txtdocid.Value;
                        Hyoa_flowhistoryinfo_cy.hy_flowid = this.hy_flowid.Text;
                        Hyoa_flowhistoryinfo_cy.hy_flowname = this.hy_flowname.Text;
                        Hyoa_flowhistoryinfo_cy.hy_tacheid = this.hy_curtacheid.Text;
                        Hyoa_flowhistoryinfo_cy.hy_tachename = this.hy_curtachename.Text;
                        Hyoa_flowhistoryinfo_cy.hy_cyrid = lv_dbrid[i];
                        Hyoa_flowhistoryinfo_cy.hy_cyrname = lv_dbrname[i];
                        Hyoa_flowhistoryinfo_cy.hy_ydsj = "";
                        Hyoa_flowhistoryinfo_cy.hy_createtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        Hyoa_flowhistoryinfo_cy.Insert();
                    }
                }
            }
            //在当前环节处理的记录中添加传阅信息,主要用于列表的显示控制
            string sql_cl = "select * from hyp_flowhistoryinfo_cl where DOCID='" + this.txtdocid.Value + "' order by hy_createtime DESC ";
            DataTable dt_cl = Hyoa_global.GetDataTable(sql_cl);
            if (dt_cl.Rows.Count > 0)
            {
                if (dt_cl.Rows[0]["hy_cyrid"].ToString() == "")
                {
                    sql_cl = "update hyp_flowhistoryinfo_cl set hy_cyrid='" + this.txtswly_dbsy_userids.Text.Replace("+", ",") + "',hy_cyrname='" + this.txtswly_dbsy_usernames.Text.Replace("+", ",") + "' where ID='" + dt_cl.Rows[0]["ID"].ToString() + "'";
                    Hyoa_global.ExcuteSQL(sql_cl);
                }
                else
                {
                    if (Session["conntype"].ToString() == "SQL")
                    {
                        sql_cl = "update hyp_flowhistoryinfo_cl set hy_cyrid=hy_cyrid+'," + this.txtswly_dbsy_userids.Text.Replace("+", ",") + "',hy_cyrname=hy_cyrname+'," + this.txtswly_dbsy_usernames.Text.Replace("+", ",") + "' where ID='" + dt_cl.Rows[0]["ID"].ToString() + "'";
                    }
                    if (Session["conntype"].ToString() == "ORACLE")
                    {
                        sql_cl = "update hyp_flowhistoryinfo_cl set hy_cyrid=CONCAT(hy_cyrid,'," + this.txtswly_dbsy_userids.Text.Replace("+", ",") + "'),hy_cyrname=CONCAT(hy_cyrname,'," + this.txtswly_dbsy_usernames.Text.Replace("+", ",") + ")' where ID='" + dt_cl.Rows[0]["ID"].ToString() + "'";
                    }
                    Hyoa_global.ExcuteSQL(sql_cl);
                }
            }
            ls_tip = "阅件分发成功!";
            sql += hylcclcylist();  //更新hy_clrylist hy_cyrylist edited by xf 20140625
        }
        #endregion

        //20140809 hjadd start
        #region 收发文分发
        if (this.txtwhichoperation.Value == "11")
        {
            string cb_docid = this.txtdocid.Value;
            string cb_dbrid = this.hy_curclrid.Text;
            string cb_dbrname = this.hy_curclrname.Text;
            string cb_fsrid = this.Session["hyuid"].ToString();
            string cb_fsrname = this.Session["hyuname"].ToString();
            string cb_url = "main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&pop=1";
            string cb_property = "待阅";
            string cb_mudelid = this.hy_mudelid.Text;
            string cb_foldername = "待办箱";
            string cb_hj = "一般";
            string cb_bt = this.hy_bt.Text;
            string cb_subbt = "请阅读";
            float cb_ifyb = 0;
            string cb_flowid = this.hy_flowid.Text;
            string cb_tacheid = this.hy_curtacheid.Text;
            string cb_from = this.hy_mudelid.Text;

            string[] lv_dbrid = this.txtffly_dbsy_userids.Text.Split(new Char[] { '+' });
            string[] lv_dbrname = this.txtffly_dbsy_usernames.Text.Split(new Char[] { '+' });
            for (var i = 0; i < lv_dbrid.Length; i++)
            {
                if (lv_dbrid[i].ToString() != "")
                {
                    //得到当前用户手机号
                    HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                    string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                    //得到后续处理人手机号
                    string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());

                    //给后续处理人发送一个新的待办事宜(提醒)
                    Hyoa_global.Senddbsy_global(cb_docid, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_fsrid, cb_fsrname, cb_url, cb_property, cb_mudelid, cb_foldername, cb_hj, cb_bt, cb_subbt, 0, cb_flowid, cb_tacheid, this.hy_tableid.Text);
                    //给后续处理人发送即时消息(提醒)
                    Hyoa_global.Sendjstx_global(cb_docid, cb_fsrid, cb_fsrname, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_mudelid, cb_bt, 0, this.hy_tableid.Text);
                    //给后续处理人发送短信(提醒)
                    Hyoa_global.Sendsms_global(cb_docid, cb_fsrid, cb_fsrname, cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, cb_mudelid, cb_bt, 1, "", "", 0, this.hy_tableid.Text);

                    //在hyp_flowhistoryinfo_cy中添加传阅信息
                    string sql_cy = "select * from hyp_flowhistoryinfo_cy where DOCID='" + this.txtdocid.Value + "' and hy_cyrid='" + lv_dbrid[i] + "' order by hy_createtime DESC ";
                    DataTable dt_cy = Hyoa_global.GetDataTable(sql_cy);
                    if (dt_cy.Rows.Count > 0)
                    {
                    }
                    else
                    {
                        HyoaClass.Hyoa_flowhistoryinfo_cy Hyoa_flowhistoryinfo_cy = new HyoaClass.Hyoa_flowhistoryinfo_cy();
                        Hyoa_flowhistoryinfo_cy.ID = Hyoa_global.GetRandom();
                        Hyoa_flowhistoryinfo_cy.DOCID = this.txtdocid.Value;
                        Hyoa_flowhistoryinfo_cy.hy_flowid = this.hy_flowid.Text;
                        Hyoa_flowhistoryinfo_cy.hy_flowname = this.hy_flowname.Text;
                        Hyoa_flowhistoryinfo_cy.hy_tacheid = this.hy_curtacheid.Text;
                        Hyoa_flowhistoryinfo_cy.hy_tachename = this.hy_curtachename.Text;
                        Hyoa_flowhistoryinfo_cy.hy_cyrid = lv_dbrid[i];
                        Hyoa_flowhistoryinfo_cy.hy_cyrname = lv_dbrname[i];
                        Hyoa_flowhistoryinfo_cy.hy_ydsj = "";
                        Hyoa_flowhistoryinfo_cy.hy_createtime = System.DateTime.Now.ToString();
                        Hyoa_flowhistoryinfo_cy.Insert();
                    }
                }
            }

            ls_tip = "分发成功!";
        }
        #endregion
        //20140809 hj add end

        #region 在主表单内嵌列表的功能中,保存、提交和确认子表单时,需要将父文档的DOCID保存到当前记录的hy_motherid中
        //ADD BY XF 2011-11-17
        if (this.txtwhichoperation.Value == "1" || this.txtwhichoperation.Value == "2" || this.txtwhichoperation.Value == "111")
        {
            if (Request.QueryString["op"] != null)
            {
                if (Request.QueryString["op"].ToString() != "")
                {
                    if (Request.QueryString["motherid"] != null)
                    {
                        if (Request.QueryString["motherid"].ToString() != "")
                        {
                            sql += ",hy_motherid='" + Request.QueryString["motherid"].ToString() + "'";
                        }
                    }
                }
            }
        }
        #endregion

        sql += " where DOCID='" + this.txtdocid.Value + "'";
        Hyoa_global.ExcuteSQL(sql);

        #region 处理完成后的提示及跳转(增加刷新附件功能)
        if (this.txtifsxfj.Text == "1")
        {
            Response.Write("<script>window.location='main.aspx?op=modify&mid=" + this.hy_mudelid.Text + "&tableid=" + this.hy_tableid.Text + "&docid=" + this.txtdocid.Value + "&url=" + this.txturl.Value + "'</script>");
        }
        else
        {

            if (this.txturl.Value == "2")
            {

                Response.Write("<script>alert('" + ls_tip + "');try{window.opener.location.reload();}catch(err){}self.close();parent.location.reload();</script>");
            }
            else
                if (this.txtifpop.Value == "")
            {
                if (this.hy_tableid.Text == "Tablefpbd")
                {
                    Response.Write("<script>alert('" + ls_tip + "');window.location='list_myadd.aspx?mid=Mudelfp&tableid=Tablefpbd&listid=6b07b57d-2906-4f5b-bc47-a8c7754ea5bf&rnd=afc25663-de8a-43ba-bc48-db224b3e5c92'</script>");
                }
                else
                {
                    Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('" + ls_tip + "');try{window.opener.location.reload();}catch(err){}self.close();</script>");
            }
        }
        #endregion
    }
Beispiel #4
0
    //保存
    private void DataPlay()
    {
        //hy_json = "{\"success\":true,\"total\":\"60\",\"rows\":[{\"hy_mudelid\":\"111\",\"hy_mudelname\":\"1111\",\"hy_roleid\":\"111111\",\"hy_qqroleid\":\"111111\",\"hy_isenabled\":\"111111\"}]}";
        string hy_json = "";
        string ls_success = "true";    //调用方法成功
        string ls_flag = "0";   //失败
        string ls_tip = "保存成功!";
        string txtop = "";
        if (Request.Form["txtop"] != null)
            txtop = Request.Form["txtop"].ToString();

        string hy_bt = "";
        if (Request.Form["hy_bt"] != null)
            hy_bt = Request.Form["hy_bt"].ToString();

        //新文档时
        //新建时先进行一次保存
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        string sql = "";
        if (txtop == "add")
        {
            //处理特殊字符
            hy_bt = ReplaceString_Tszf(hy_bt);
            if (Session["conntype"].ToString() == "SQL")
            {
                //edited by xf 20140625
                sql = "insert into hyc_" + Request.Form["hy_tableid"].ToString() + " (DOCID,hy_mudelid,hy_tableid,hy_flowid,hy_flowname,hy_curtacheid,hy_curtachename,hy_curclrid,hy_curclrname,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_bt,hy_readuserlist,hy_readdatelist,hy_clrylist,hy_cyrylist) values (";
                sql += "'" + Request.Form["txtdocid"].ToString() + "','" + Request.Form["hy_mudelid"].ToString() + "','" + Request.Form["hy_tableid"].ToString() + "','" + Request.Form["hy_flowid"].ToString() + "','" + Request.Form["hy_flowname"].ToString() + "'";
                sql += ",'" + Request.Form["hy_curtacheid"].ToString() + "','" + Request.Form["hy_curtachename"].ToString() + "','" + Request.Form["hy_curclrid"].ToString() + "','" + Request.Form["hy_curclrname"].ToString() + "','" + Request.Form["hy_djrid"].ToString() + "'";
                sql += ",'" + Request.Form["hy_djrname"].ToString() + "','" + Request.Form["hy_djrbmid"].ToString() + "','" + Request.Form["hy_djrbmname"].ToString() + "','" + Request.Form["hy_djsj"].ToString() + "','" + Request.Form["hy_bt"].ToString() + "'";
                sql += ",'','','," + Session["hyuid"].ToString() + ",',',') ";
            }
            if (Session["conntype"].ToString() == "ORACLE")
            {
                //edited by xf 20140625
                sql = "insert into hyc_" + Request.Form["hy_tableid"].ToString() + " (DOCID,hy_mudelid,hy_tableid,hy_flowid,hy_flowname,hy_curtacheid,hy_curtachename,hy_curclrid,hy_curclrname,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj,hy_bt,hy_readuserlist,hy_readdatelist,hy_clrylist,hy_cyrylist) values (";
                sql += "'" + Request.Form["txtdocid"].ToString() + "','" + Request.Form["hy_mudelid"].ToString() + "','" + Request.Form["hy_tableid"].ToString() + "','" + Request.Form["hy_flowid"].ToString() + "','" + Request.Form["hy_flowname"].ToString() + "'";
                sql += ",'" + Request.Form["hy_curtacheid"].ToString() + "','" + Request.Form["hy_curtachename"].ToString() + "','" + Request.Form["hy_curclrid"].ToString() + "','" + Request.Form["hy_curclrname"].ToString() + "','" + Request.Form["hy_djrid"].ToString() + "'";
                sql += ",'" + Request.Form["hy_djrname"].ToString() + "','" + Request.Form["hy_djrbmid"].ToString() + "','" + Request.Form["hy_djrbmname"].ToString() + "',to_date('" + Request.Form["hy_djsj"].ToString() + "','YYYY-MM-DD HH24:MI:SS'),'" + Request.Form["hy_bt"].ToString() + "'";
                sql += ",'','','," + Session["hyuid"].ToString() + ",',',') ";
            }
            Hyoa_global.ExcuteSQL(sql);

            //插入历史处理表(如果是流程文档)
            if (Request.Form["txtifhaveflow"].ToString() == "是")
            {
                Hyoa_global.Saveflowhistoryinfo_cl_global(Request.Form["txtdocid"].ToString(), Request.Form["hy_flowid"].ToString(), Request.Form["hy_flowname"].ToString(), Request.Form["hy_curtacheid"].ToString(), Request.Form["hy_curtachename"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "", "", "", Request.Form["hy_djsj"].ToString(), "");
            }
        }
        //更新内容
        sql = "update hyc_" + Request.Form["hy_tableid"].ToString() + " set hy_tableid='" + Request.Form["hy_tableid"].ToString() + "',hy_bt='" + Request.Form["hy_bt"].ToString() + "' ";
        //根据“需要保存的字段”来进行保存
        if (Request.Form["txtsavefields"].ToString() != "")
        {
            string[] lv_savefields = Request.Form["txtsavefields"].ToString().Split(',');
            string[] lv_savefields_sx = Request.Form["txtsavefields_sx"].ToString().Split(',');
            string fielddocvalue = "";
            for (int i = 0; i < lv_savefields.Length; i++)
            {
                if (lv_savefields_sx[i].ToString() == "0")  //文本
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "1")  //日期
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        if (Session["conntype"].ToString() == "SQL")
                        {
                            if (fielddocvalue == "")
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=null";
                            else
                                sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                        }
                        if (Session["conntype"].ToString() == "ORACLE")
                        {
                            if (fielddocvalue == "")
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=null";
                            else
                                sql += ",hyc_" + lv_savefields[i].ToString() + "=to_date('" + fielddocvalue + "','YYYY-MM-DD HH24:MI:SS')";
                        }
                    }
                }
                if (lv_savefields_sx[i].ToString() == "3")  //数值
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        if (fielddocvalue == "")
                            sql += ",hyc_" + lv_savefields[i].ToString() + "=0";
                        else
                            sql += ",hyc_" + lv_savefields[i].ToString() + "=" + fielddocvalue;
                    }
                }
                if (lv_savefields_sx[i].ToString() == "5")  //口令
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "6")  //编辑器
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "7")  //复选框
                {
                    //string s = "";
                    //CheckBoxList txfs = (CheckBoxList)this.FindControl(lv_savefields[i].ToString());
                    //foreach (ListItem li in txfs.Items)
                    //{
                    //    if (li.Selected)
                    //    {
                    //        if (li.Selected) s += li.Value + ",";
                    //    }
                    //}
                    //s = s.TrimEnd(',');
                    //s = ReplaceString_Tszf(s);
                    //sql += ",hyc_" + lv_savefields[i].ToString() + "='" + s + "'";
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "8")  //单选框
                {
                    //string s = "";
                    //RadioButtonList txfs = (RadioButtonList)this.FindControl(lv_savefields[i].ToString());
                    //foreach (ListItem li in txfs.Items)
                    //{
                    //    if (li.Selected)
                    //    {
                    //        if (li.Selected) s += li.Value + ",";
                    //    }
                    //}
                    //s = s.TrimEnd(',');
                    //s = ReplaceString_Tszf(s);
                    //sql += ",hyc_" + lv_savefields[i].ToString() + "='" + s + "'";
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        sql += ",hyc_" + lv_savefields[i].ToString() + "='" + fielddocvalue + "'";
                    }
                }
                if (lv_savefields_sx[i].ToString() == "9")  //意见
                {
                    if (this.Request.Form[lv_savefields[i].ToString()] != null)
                    {
                        fielddocvalue = this.Request.Form[lv_savefields[i].ToString()].ToString();
                        fielddocvalue = ReplaceString_Tszf(fielddocvalue);
                        if (fielddocvalue != "")
                        {
                            HyoaClass.Hyoa_yj Hyoa_yj = new HyoaClass.Hyoa_yj();
                            Hyoa_yj.yjid = Hyoa_global.GetRandom();
                            Hyoa_yj.hy_tableid = Request.Form["hy_tableid"].ToString();
                            Hyoa_yj.hy_fatherid = Request.Form["txtdocid"].ToString();
                            Hyoa_yj.hy_fieldid = lv_savefields[i].ToString();
                            Hyoa_yj.hy_yjuserid = Session["hyuid"].ToString();
                            Hyoa_yj.hy_yjusername = Session["hyuname"].ToString();
                            Hyoa_yj.hy_yjdeptid = Session["hydeptid"].ToString();
                            Hyoa_yj.hy_yjdeptname = Session["hydeptname"].ToString();
                            Hyoa_yj.hy_yjtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            Hyoa_yj.hy_yjbody = fielddocvalue;
                            Hyoa_yj.hy_yjip = HttpContext.Current.Request.UserHostAddress;
                            Hyoa_yj.hy_yjifshow = "";
                            Hyoa_yj.Insert();
                        }
                    }
                }
            }
        }

        //保存
        if (Request.Form["txtwhichoperation"].ToString() == "1")
        {
            hylcbctscl(sql);  //特殊处理
        }

        //确认
        if (Request.Form["txtwhichoperation"].ToString() == "111")
        {
            sql += ",hy_ifconfirm='1'";
        }

        //取消确认
        if (Request.Form["txtwhichoperation"].ToString() == "112")
        {
            sql += ",hy_ifconfirm='0'";
        }
        //提交
        if (Request.Form["txtwhichoperation"].ToString() == "2")
        {
            //更新主文档
            sql += ",hy_curtacheid='" + Request.Form["txtnexttacheid"].ToString() + "'";
            sql += ",hy_curtachename='" + Request.Form["txtnexttachename"].ToString() + "'";
            sql += ",hy_curclrid='" + Request.Form["txtnextclrid"].ToString() + "'";
            sql += ",hy_curclrname='" + Request.Form["txtnextclrname"].ToString() + "'";

            //---- 添加当前环节的处理时间 ---- start
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocidtacheid(Request.Form["txtdocid"].ToString(), Request.Form["hy_curtacheid"].ToString());
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                {
                    Hyoa_flowhistoryinfo_cl.hy_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    Hyoa_flowhistoryinfo_cl.hy_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                Hyoa_flowhistoryinfo_cl.Update();
            }
            //---- 添加当前环节的处理时间 ---- end

            ////////////////////如果后续环节选择了“结束”,则不需要发待办事宜和短消息 start//////////////////////
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            if (Request.Form["txtnexttacheid"].ToString() != "**")
            {
                //---  创建后续处理的处理记录+建立处理人待办事宜 ---- start
                Hyoa_global.Saveflowhistoryinfo_cl_global(Request.Form["txtdocid"].ToString(), Request.Form["hy_flowid"].ToString(), Request.Form["hy_flowname"].ToString(), Request.Form["txtnexttacheid"].ToString(), Request.Form["txtnexttachename"].ToString(), Request.Form["txtnextclrid"].ToString(), Request.Form["txtnextclrname"].ToString(), "", Request.Form["txtnextcyrid"].ToString(), Request.Form["txtnextcyrname"].ToString(), System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "");

                //待办事宜、短信、即时消息
                string[] lv_dbrid = Request.Form["txtnextclrid"].ToString().Split(new Char[] { ',' });
                string[] lv_dbrname = Request.Form["txtnextclrname"].ToString().Split(new Char[] { ',' });
                for (var i = 0; i < lv_dbrid.Length; i++)
                {
                    if (lv_dbrid[i].ToString() != "")
                    {
                        //得到当前用户手机号
                        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                        string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                        //得到后续处理人手机号
                        string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());

                        //给后续处理人发送一个新的待办事宜(提醒)
                        Hyoa_global.Senddbsy_global(Request.Form["txtdocid"].ToString(), lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "main.aspx?op=modify&mid=" + Request.Form["hy_mudelid"].ToString() + "&tableid=" + Request.Form["hy_tableid"].ToString() + "&docid=" + Request.Form["txtdocid"].ToString() + "&pop=1", "待办", Request.Form["hy_mudelid"].ToString(), "待办箱", "一般", Request.Form["hy_bt"].ToString(), "请办理", 0, Request.Form["hy_flowid"].ToString(), Request.Form["txtnexttacheid"].ToString(), Request.Form["hy_tableid"].ToString());
                        //给后续处理人发送即时消息(提醒)
                        if (Request.Form["txtisSendjstx_clr"].ToString() == "1")
                        {
                            Hyoa_global.Sendjstx_global(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), Request.Form["hy_mudelid"].ToString(), Request.Form["hy_bt"].ToString(), 0, Request.Form["hy_tableid"].ToString());
                        }
                        //给后续处理人发送短信(提醒)
                        if (Request.Form["txtisSendsms_clr"].ToString() == "1")
                        {
                            Hyoa_global.Sendsms_global(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, Request.Form["hy_mudelid"].ToString(), Request.Form["hy_bt"].ToString(), 1, "", "", 0, Request.Form["hy_tableid"].ToString());
                        }
                    }
                }
                //--- 创建后续处理的处理记录+建立处理人待办事宜 ---- end

                //--- 创建后续传阅记录+建立待办事宜 ---- start
                string[] lv_cyrid = Request.Form["txtnextcyrid"].ToString().Split(new Char[] { ',' });
                string[] lv_cyrname = Request.Form["txtnextcyrname"].ToString().Split(new Char[] { ',' });
                for (var i = 0; i < lv_cyrid.Length; i++)
                {
                    if (lv_cyrid[i].ToString() != "")
                    {
                        //建立传阅数据
                        Hyoa_global.Saveflowhistoryinfo_cy_global(Request.Form["txtdocid"].ToString(), Request.Form["hy_flowid"].ToString(), Request.Form["hy_flowname"].ToString(), Request.Form["txtnexttacheid"].ToString(), Request.Form["txtnexttachename"].ToString(), lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), "", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                        //待办事宜、短信、即时消息
                        //得到当前用户手机号
                        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                        string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                        //得到后续传阅人手机号
                        string cb_cyrsjh = Hyoa_user.GetMobilebyuserid(lv_cyrid[i].ToString());

                        //给后续处理人发送一个新的待办事宜(提醒)
                        Hyoa_global.Senddbsy_global(Request.Form["txtdocid"].ToString(), lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "main.aspx?op=modify&mid=" + Request.Form["hy_mudelid"].ToString() + "&tableid=" + Request.Form["hy_tableid"].ToString() + "&docid=" + Request.Form["txtdocid"].ToString() + "&pop=1", "待阅", Request.Form["hy_mudelid"].ToString(), "待办箱", "一般", Request.Form["hy_bt"].ToString(), "请阅读", 0, Request.Form["hy_flowid"].ToString(), Request.Form["txtnexttacheid"].ToString(), Request.Form["hy_tableid"].ToString());
                        //给后续处理人发送即时消息(提醒)
                        if (Request.Form["txtisSendjstx_cyr"].ToString() == "1")
                        {
                            Hyoa_global.Sendjstx_global(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), Request.Form["hy_mudelid"].ToString(), Request.Form["hy_bt"].ToString(), 0, Request.Form["hy_tableid"].ToString());
                        }
                        //给后续处理人发送短信(提醒)
                        if (Request.Form["txtisSendsms_cyr"].ToString() == "1")
                        {
                            Hyoa_global.Sendsms_global(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), cb_fsrsjh, lv_cyrid[i].ToString(), lv_cyrname[i].ToString(), cb_cyrsjh, Request.Form["hy_mudelid"].ToString(), Request.Form["hy_bt"].ToString(), 1, "", "", 0, Request.Form["hy_tableid"].ToString());
                        }

                    }
                }
                //--- 创建后续传阅记录+建立待办事宜 ---- end
            }
            ////////////////////如果后续环节选择了“结束”,则不需要发待办事宜和短消息 start//////////////////////

            //--- 当前处理人的待办事宜转已办 ---- start
            Hyoa_dbsy.Dbsytoybbydocidtacheiduserid(Request.Form["txtdocid"].ToString(), Request.Form["hy_curtacheid"].ToString(), this.Session["hyuid"].ToString());
            //--- 当前处理人的待办事宜转已办 ---- end
            ls_tip = "文档已成功发送到[" + Request.Form["txtnexttachename"].ToString() + "]环节";
            hylctjtscl(sql);//特殊处理
        }

        //收回
        if (Request.Form["txtwhichoperation"].ToString() == "3")
        {
            //得到上个环节处理人
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(Request.Form["txtdocid"].ToString());
            if (dt_clinfo.Rows.Count > 1)
            {
                //删除当前处理人员的待办事宜
                HyoaClass.Hyoa_dbsy Hyoa_dbsy_sh = new HyoaClass.Hyoa_dbsy();
                Hyoa_dbsy_sh.DeleteByDocid_flowid_tacheid_userid(Request.Form["txtdocid"].ToString(), dt_clinfo.Rows[0]["hy_flowid"].ToString(), dt_clinfo.Rows[0]["hy_tacheid"].ToString(), dt_clinfo.Rows[0]["hy_clrid"].ToString());

                string ls_lastclrid = dt_clinfo.Rows[1]["hy_clrid"].ToString();         //上个环节处理人ID
                string ls_lastclrname = dt_clinfo.Rows[1]["hy_clrname"].ToString();     //上个环节处理人中文名
                string ls_lastcldoc = dt_clinfo.Rows[1]["ID"].ToString();               //上个环节处理的记录ID
                string ls_lasttacheid = dt_clinfo.Rows[1]["hy_tacheid"].ToString();     //上个环节处理环节ID
                string ls_lasttachename = dt_clinfo.Rows[1]["hy_tachename"].ToString(); //上个环节处理环节名称
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                dt_clinfo.Clear();

                //删除当前处理的记录
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.Delete();
                //清空上个环节处理时间,更新创建时间
                Hyoa_flowhistoryinfo_cl.ID = ls_lastcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = "";
                Hyoa_flowhistoryinfo_cl.hy_createtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Hyoa_flowhistoryinfo_cl.Update_sh();
                //更新主文档中的当前环节ID、当前环节名称、当前处理人ID和中文名
                sql += ",hy_curtacheid='" + ls_lasttacheid + "'";
                sql += ",hy_curtachename='" + ls_lasttachename + "'";
                sql += ",hy_curclrid='" + ls_lastclrid + "'";
                sql += ",hy_curclrname='" + ls_lastclrname + "'";
                ls_tip = "文档已成功收回到[" + ls_lasttachename + "]环节";
                hylcshtscl(sql);//特殊处理
            }
        }

        //退回
        if (Request.Form["txtwhichoperation"].ToString() == "4")
        {
            //更新主文档
            sql += ",hy_curtacheid='" + Request.Form["txtnexttacheid"].ToString() + "'";
            sql += ",hy_curtachename='" + Request.Form["txtnexttachename"].ToString() + "'";
            sql += ",hy_curclrid='" + Request.Form["txtnextclrid"].ToString() + "'";
            sql += ",hy_curclrname='" + Request.Form["txtnextclrname"].ToString() + "'";

            //处理历史处理记录
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(Request.Form["txtdocid"].ToString());
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                string ls_clsj = "";                                                    //当前处理的记录处理时间
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                    ls_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                else
                    ls_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                dt_clinfo.Clear();
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = ls_clsj;
                Hyoa_flowhistoryinfo_cl.Update();
            }
            //新建一条处理记录
            Hyoa_global.Saveflowhistoryinfo_cl_global(Request.Form["txtdocid"].ToString(), Request.Form["hy_flowid"].ToString(), Request.Form["hy_flowname"].ToString(), Request.Form["txtnexttacheid"].ToString(), Request.Form["txtnexttachename"].ToString(), Request.Form["txtnextclrid"].ToString(), Request.Form["txtnextclrname"].ToString(), "", "", "", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "是");

            //处理待办事宜
            //转已办-当前处理人的待办事宜
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            Hyoa_dbsy.Dbsytoybbydociduserid(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString());

            //得到发送人手机号
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());

            //(考虑多人的情况)
            string[] lv_dbrid = Request.Form["txtnextclrid"].ToString().Split(new Char[] { ',' });
            string[] lv_dbrname = Request.Form["txtnextclrname"].ToString().Split(new Char[] { ',' });

            for (var i = 0; i < lv_dbrid.Length; i++)
            {
                if (lv_dbrid[i].ToString() != "")
                {
                    //得到接收人手机号
                    string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());
                    HyoaClass.Hyoa_global Hyoa_global2 = new HyoaClass.Hyoa_global();

                    //给退回到的处理人发送一个新的待办事宜(提醒)
                    Hyoa_global2.Senddbsy_global(Request.Form["txtdocid"].ToString(), lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), "main.aspx?op=modify&mid=" + Request.Form["hy_mudelid"].ToString() + "&tableid=" + Request.Form["hy_tableid"].ToString() + "&docid=" + Request.Form["txtdocid"].ToString() + "&pop=1", "待办", Request.Form["hy_mudelid"].ToString(), "待办箱", "一般", Request.Form["hy_bt"].ToString(), "请办理", 0, Request.Form["hy_flowid"].ToString(), Request.Form["txtnexttacheid"].ToString(), Request.Form["hy_tableid"].ToString());
                    //给退回到的处理人发送即时消息(提醒)
                    if (Request.Form["txtisSendjstx"].ToString() == "1")
                    {
                        Hyoa_global.Sendjstx_global(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), Request.Form["hy_mudelid"].ToString(), Request.Form["hy_bt"].ToString(), 0, Request.Form["hy_tableid"].ToString());
                    }
                    //给退回到的处理人发送短信(提醒)
                    if (Request.Form["txtisSendsms"].ToString() == "1")
                    {
                        Hyoa_global.Sendsms_global(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, Request.Form["hy_mudelid"].ToString(), Request.Form["hy_bt"].ToString(), 1, "", "", 0, Request.Form["hy_tableid"].ToString());
                    }
                }
            }
            ls_tip = "已成功退回到[" + Request.Form["txtnexttachename"].ToString() + "]环节";
            hylcthtscl(sql);//特殊处理
        }

        //多人处理
        if (Request.Form["txtwhichoperation"].ToString() == "5")
        {
            //更新主文档
            string ls_newclrid = Hyoa_global.MoveOneString_dh(Request.Form["hy_curclrid"].ToString(), this.Session["hyuid"].ToString());
            string ls_newclrname = Hyoa_global.MoveOneString_dh(Request.Form["hy_curclrname"].ToString(), this.Session["hyuname"].ToString());
            sql += ",hy_curclrid='" + ls_newclrid + "'";
            sql += ",hy_curclrname='" + ls_newclrname + "'";
            //处理处理记录
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(Request.Form["txtdocid"].ToString());
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                string ls_clsj = "";                                                    //当前处理的记录处理时间
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                    ls_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                else
                    ls_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                dt_clinfo.Clear();
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = ls_clsj;
                Hyoa_flowhistoryinfo_cl.Update();
            }
            //处理待办事宜
            //转已办-当前处理人的待办事宜
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            Hyoa_dbsy.Dbsytoybbydociduserid(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString());

            ls_tip = "提交成功,当前环节还需要[" + ls_newclrname + "]进行办理";
            hylcdrcltscl(sql);//特殊处理
        }

        //催办
        if (Request.Form["txtwhichoperation"].ToString() == "6")
        {
            string cb_docid = Request.Form["txtdocid"].ToString();
            string cb_dbrid = Request.Form["hy_curclrid"].ToString();
            string cb_dbrname = Request.Form["hy_curclrname"].ToString();
            string cb_fsrid = this.Session["hyuid"].ToString();
            string cb_fsrname = this.Session["hyuname"].ToString();
            string cb_url = "main.aspx?op=modify&mid=" + Request.Form["hy_mudelid"].ToString() + "&tableid=" + Request.Form["hy_tableid"].ToString() + "&docid=" + Request.Form["txtdocid"].ToString() + "&pop=1";
            string cb_property = "催办";
            string cb_mudelid = Request.Form["hy_mudelid"].ToString();
            string cb_foldername = "待办箱";
            string cb_hj = "一般";
            string cb_bt = Request.Form["txtcbideas"].ToString() + "-" + Request.Form["hy_bt"].ToString();
            string cb_subbt = "请阅读";
            float cb_ifyb = 0;
            string cb_flowid = Request.Form["hy_flowid"].ToString();
            string cb_tacheid = Request.Form["hy_curtacheid"].ToString();
            string cb_from = Request.Form["hy_mudelid"].ToString();

            //得到发送人手机号
            HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
            string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(cb_fsrid);
            //得到接收人手机号
            string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(cb_dbrid);

            //给当前处理人发送一个新的待办事宜(提醒)
            Hyoa_global.Senddbsy_global(cb_docid, cb_dbrid, cb_dbrname, cb_fsrid, cb_fsrname, cb_url, cb_property, cb_mudelid, cb_foldername, cb_hj, cb_bt, cb_subbt, cb_ifyb, cb_flowid, cb_tacheid, Request.Form["hy_tableid"].ToString());
            //给当前处理人发送即时消息(提醒)
            if (Request.Form["txtisSendjstx"].ToString() == "1")
            {
                Hyoa_global.Sendjstx_global(cb_docid, cb_fsrid, cb_fsrname, cb_dbrid, cb_dbrname, cb_from, cb_bt, 0, Request.Form["hy_tableid"].ToString());
            }
            //给当前处理人发送短信(提醒)
            if (Request.Form["txtisSendsms"].ToString() == "1")
            {
                Hyoa_global.Sendsms_global(cb_docid, cb_fsrid, cb_fsrname, cb_fsrsjh, cb_dbrid, cb_dbrname, cb_jsrsjh, cb_from, cb_bt, 1, "", "", 0, Request.Form["hy_tableid"].ToString());
            }

            ls_tip = "催办成功!";
            hylccbtscl(sql);//特殊处理
        }

        //流程结束时的提交
        if (Request.Form["txtwhichoperation"].ToString() == "7")
        {
            //更新主文档
            sql += ",hy_curtacheid='**'";
            sql += ",hy_curtachename='结束'";
            sql += ",hy_curclrid=''";
            sql += ",hy_curclrname=''";
            //更新处理表
            HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl();
            DataTable dt_clinfo = Hyoa_flowhistoryinfo_cl.Getflowhistoryinfo_clsbydocid(Request.Form["txtdocid"].ToString());
            if (dt_clinfo.Rows.Count > 0)
            {
                string ls_curcldoc = dt_clinfo.Rows[0]["ID"].ToString();                //当前处理的记录ID
                string ls_clsj = "";                                                    //当前处理的记录处理时间
                if (dt_clinfo.Rows[0]["hy_clsj"].ToString() == "")
                    ls_clsj = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                else
                    ls_clsj = dt_clinfo.Rows[0]["hy_clsj"].ToString() + "," + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                dt_clinfo.Clear();
                Hyoa_flowhistoryinfo_cl.ID = ls_curcldoc;
                Hyoa_flowhistoryinfo_cl.hy_clsj = ls_clsj;
                Hyoa_flowhistoryinfo_cl.Update();
            }
            ////流程结束时删除所有该文档对应的待办事宜
            //HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            //Hyoa_dbsy.Deletebydocid(Request.Form["txtdocid"].ToString());

            //处理待办事宜
            //转已办-当前处理人的待办事宜
            HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
            Hyoa_dbsy.Dbsytoybbydociduserid(Request.Form["txtdocid"].ToString(), this.Session["hyuid"].ToString());

            ls_tip = "流程结束!";
            hylcjstscl(sql);//特殊处理
        }

        //收文阅件分发
        if (Request.Form["txtwhichoperation"].ToString() == "8")
        {
            string cb_docid = Request.Form["txtdocid"].ToString();
            string cb_dbrid = Request.Form["hy_curclrid"].ToString();
            string cb_dbrname = Request.Form["hy_curclrname"].ToString();
            string cb_fsrid = this.Session["hyuid"].ToString();
            string cb_fsrname = this.Session["hyuname"].ToString();
            string cb_url = "main.aspx?op=modify&mid=" + Request.Form["hy_mudelid"].ToString() + "&tableid=" + Request.Form["hy_tableid"].ToString() + "&docid=" + Request.Form["txtdocid"].ToString() + "&pop=1";
            string cb_property = "待阅";
            string cb_mudelid = Request.Form["hy_mudelid"].ToString();
            string cb_foldername = "待办箱";
            string cb_hj = "一般";
            string cb_bt = Request.Form["hy_bt"].ToString();
            string cb_subbt = "请阅读";
            float cb_ifyb = 0;
            string cb_flowid = Request.Form["hy_flowid"].ToString();
            string cb_tacheid = Request.Form["hy_curtacheid"].ToString();
            string cb_from = Request.Form["hy_mudelid"].ToString();

            string[] lv_dbrid = Request.Form["txtswly_dbsy_userids"].ToString().Split(new Char[] { '+' });
            string[] lv_dbrname = Request.Form["txtswly_dbsy_usernames"].ToString().Split(new Char[] { '+' });
            for (var i = 0; i < lv_dbrid.Length; i++)
            {
                if (lv_dbrid[i].ToString() != "")
                {
                    //得到当前用户手机号
                    HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                    string cb_fsrsjh = Hyoa_user.GetMobilebyuserid(this.Session["hyuid"].ToString());
                    //得到后续处理人手机号
                    string cb_jsrsjh = Hyoa_user.GetMobilebyuserid(lv_dbrid[i].ToString());

                    //给后续处理人发送一个新的待办事宜(提醒)
                    Hyoa_global.Senddbsy_global(cb_docid, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_fsrid, cb_fsrname, cb_url, cb_property, cb_mudelid, cb_foldername, cb_hj, cb_bt, cb_subbt, 0, cb_flowid, cb_tacheid, Request.Form["hy_tableid"].ToString());
                    //给后续处理人发送即时消息(提醒)
                    Hyoa_global.Sendjstx_global(cb_docid, cb_fsrid, cb_fsrname, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_mudelid, cb_bt, 0, Request.Form["hy_tableid"].ToString());
                    //给后续处理人发送短信(提醒)
                    Hyoa_global.Sendsms_global(cb_docid, cb_fsrid, cb_fsrname, cb_fsrsjh, lv_dbrid[i].ToString(), lv_dbrname[i].ToString(), cb_jsrsjh, cb_mudelid, cb_bt, 1, "", "", 0, Request.Form["hy_tableid"].ToString());

                    //在hyp_flowhistoryinfo_cy中添加传阅信息
                    string sql_cy = "select * from hyp_flowhistoryinfo_cy where DOCID='" + Request.Form["txtdocid"].ToString() + "' and hy_cyrid='" + lv_dbrid[i] + "' order by hy_createtime DESC ";
                    DataTable dt_cy = Hyoa_global.GetDataTable(sql_cy);
                    if (dt_cy.Rows.Count > 0)
                    {
                    }
                    else
                    {
                        HyoaClass.Hyoa_flowhistoryinfo_cy Hyoa_flowhistoryinfo_cy = new HyoaClass.Hyoa_flowhistoryinfo_cy();
                        Hyoa_flowhistoryinfo_cy.ID = Hyoa_global.GetRandom();
                        Hyoa_flowhistoryinfo_cy.DOCID = Request.Form["txtdocid"].ToString();
                        Hyoa_flowhistoryinfo_cy.hy_flowid = Request.Form["hy_flowid"].ToString();
                        Hyoa_flowhistoryinfo_cy.hy_flowname = Request.Form["hy_flowname"].ToString();
                        Hyoa_flowhistoryinfo_cy.hy_tacheid = Request.Form["hy_curtacheid"].ToString();
                        Hyoa_flowhistoryinfo_cy.hy_tachename = Request.Form["hy_curtachename"].ToString();
                        Hyoa_flowhistoryinfo_cy.hy_cyrid = lv_dbrid[i];
                        Hyoa_flowhistoryinfo_cy.hy_cyrname = lv_dbrname[i];
                        Hyoa_flowhistoryinfo_cy.hy_ydsj = "";
                        Hyoa_flowhistoryinfo_cy.hy_createtime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        Hyoa_flowhistoryinfo_cy.Insert();
                    }
                }
            }
            //在当前环节处理的记录中添加传阅信息,主要用于列表的显示控制
            string sql_cl = "select * from hyp_flowhistoryinfo_cl where DOCID='" + Request.Form["txtdocid"].ToString() + "' order by hy_createtime DESC ";
            DataTable dt_cl = Hyoa_global.GetDataTable(sql_cl);
            if (dt_cl.Rows.Count > 0)
            {
                if (dt_cl.Rows[0]["hy_cyrid"].ToString() == "")
                {
                    sql_cl = "update hyp_flowhistoryinfo_cl set hy_cyrid='" + Request.Form["txtswly_dbsy_userids"].ToString().Replace("+", ",") + "',hy_cyrname='" + Request.Form["txtswly_dbsy_usernames"].ToString().Replace("+", ",") + "' where ID='" + dt_cl.Rows[0]["ID"].ToString() + "'";
                    Hyoa_global.ExcuteSQL(sql_cl);
                }
                else
                {
                    if (Session["conntype"].ToString() == "SQL")
                    {
                        sql_cl = "update hyp_flowhistoryinfo_cl set hy_cyrid=hy_cyrid+'," + Request.Form["txtswly_dbsy_userids"].ToString().Replace("+", ",") + "',hy_cyrname=hy_cyrname+'," + Request.Form["txtswly_dbsy_usernames"].ToString().Replace("+", ",") + "' where ID='" + dt_cl.Rows[0]["ID"].ToString() + "'";
                    }
                    if (Session["conntype"].ToString() == "ORACLE")
                    {
                        sql_cl = "update hyp_flowhistoryinfo_cl set hy_cyrid=CONCAT(hy_cyrid,'," + Request.Form["txtswly_dbsy_userids"].ToString().Replace("+", ",") + "'),hy_cyrname=CONCAT(hy_cyrname,'," + Request.Form["txtswly_dbsy_usernames"].ToString().Replace("+", ",") + ")' where ID='" + dt_cl.Rows[0]["ID"].ToString() + "'";
                    }
                    Hyoa_global.ExcuteSQL(sql_cl);
                }
            }
            ls_tip = "阅件分发成功!";
        }

        //在主表单内嵌列表的功能中,保存、提交和确认子表单时,需要将父文档的DOCID保存到当前记录的hy_motherid中
        //ADD BY XF 2011-11-17
        if (Request.Form["txtwhichoperation"].ToString() == "1" || Request.Form["txtwhichoperation"].ToString() == "2" || Request.Form["txtwhichoperation"].ToString() == "111")
        {
            if (Request.QueryString["op"] != null)
            {
                if (Request.QueryString["op"].ToString() != "")
                {
                    if (Request.QueryString["motherid"] != null)
                    {
                        if (Request.QueryString["motherid"].ToString() != "")
                        {
                            sql += ",hy_motherid='" + Request.QueryString["motherid"].ToString() + "'";
                        }
                    }
                }
            }
        }

        sql += " where DOCID='" + Request.Form["txtdocid"].ToString() + "'";
        Hyoa_global.ExcuteSQL(sql);
        ls_flag = "1";
        hy_json = "{\"success\":" + ls_success + ",\"flag\":\"" + ls_flag + "\"}";
        Response.Write(hy_json);

        ////处理完成后的提示及跳转(增加刷新附件功能)
        //if (Request.Form["txtifsxfj"].ToString() == "1")
        //{
        //    //Response.Write("<script>window.location='main.aspx?op=modify&mid=" + Request.Form["hy_mudelid"].ToString() + "&tableid=" + Request.Form["hy_tableid"].ToString() + "&docid=" + Request.Form["txtdocid"].ToString() + "&url=" + Request.Form["txturl"].ToString() + "'</script>");
        //}
        //else
        //{
        //    //if (Request.Form["txtifpop"].ToString() == "")
        //    //{
        //    //    //Response.Write("<script>alert('" + ls_tip + "');window.location='" + Request.Form["txturl"].ToString() + "'</script>");
        //    //}
        //    //else
        //    //{
        //    //    Response.Write("<script>alert('" + ls_tip + "');try{window.opener.location.reload();}catch(err){}self.close();</script>");
        //    //}
        //    Response.Write("<div data-role=\"dialog\">");
        //    Response.Write("<div data-role=\"header\" data-theme=\"d\">");
        //    Response.Write("<h1>");
        //    Response.Write("消息窗口</h1>");
        //    Response.Write("</div>");
        //    Response.Write("<div data-role=\"content\" style=\"text-align: center\">");
        //    Response.Write("<h1>");
        //    Response.Write(ls_tip + "</h1>");
        //    Response.Write("<a href=\"" + Request.Form["txturl"].ToString() + "\" data-icon=\"gear\" data-role=\"button\" data-theme=\"b\" data-transition=\"flip\">确  定</a>");
        //    Response.Write("</div>");
        //    Response.Write("</div>");
        //}
    }