private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //判断当前用户是否有保存的权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            string ls_role = "Rolegwk";

            if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
            {
                this.btn_submit.Visible = true; //保存
            }
            else
            {
                this.btn_submit.Visible = false; //保存
            }

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                uploadhy_field2.Visible = false;
                if (this.Request.QueryString["id"] != null)
                {
                    //根据id得到信息
                    this.txtdocid.Value = this.Request.QueryString["id"].ToString();
                    HyoaClass.Hyoa_gwk Hyoa_gwk = new HyoaClass.Hyoa_gwk();
                    DataTable dt = Hyoa_gwk.Getgwkbyid(this.txtdocid.Value);
                    if (dt.Rows.Count > 0)
                    {
                        this.txthy_djrname.Value = dt.Rows[0]["hy_djrname"].ToString();
                        this.txthy_djbmname.Value = dt.Rows[0]["hy_djbmname"].ToString();
                        this.txthy_bt.Value = dt.Rows[0]["hy_bt"].ToString();
                        this.txthy_wh.Value = dt.Rows[0]["hy_wh"].ToString();
                        //this.txthy_lwwh.Value = dt.Rows[0]["hy_lwwh"].ToString();
                        this.txthy_djsj.Value = dt.Rows[0]["hy_djsj"].ToString();
                        this.txthy_typename.Value = dt.Rows[0]["hy_typename"].ToString();
                        this.txttypeid.Value = dt.Rows[0]["hy_typeid"].ToString();
                        this.txtdjrid.Value = dt.Rows[0]["hy_djrid"].ToString();
                        this.txtdjrbmid.Value = dt.Rows[0]["hy_djbmid"].ToString();
                        this.txtfatherid.Value = dt.Rows[0]["hy_fatherid"].ToString();

                        //附件
                        string ls_temp = "";
                        if (dt.Rows[0]["hy_mudelid"].ToString() == "Mudelfwgl")
                        {
                            string lssqlfwglfile;
                            lssqlfwglfile = "select * from files where fother = '" + dt.Rows[0]["hy_fatherid"].ToString() + "'";
                            DataTable dtfwglfile = Hyoa_global.GetDataTable(lssqlfwglfile);
                            if (dtfwglfile.Rows.Count > 0)
                            {
                                for (int jfile = 0; jfile < dtfwglfile.Rows.Count; jfile++)
                                {
                                    if (ls_temp == "")
                                    {
                                        ls_temp = "<a href='../NTKO/" + dtfwglfile.Rows[jfile]["fpath"].ToString() + "/" + dtfwglfile.Rows[jfile]["fname"].ToString() + "' target=_blank>正文</a>";
                                    }
                                    else
                                    {
                                        ls_temp += "<br>" + "<a href='../NTKO/" + dtfwglfile.Rows[jfile]["fpath"].ToString() + "/" + dtfwglfile.Rows[jfile]["fname"].ToString() + "' target=_blank>正文</a>";
                                    }
                                }
                            }

                        }

                        HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                        DataTable dt_fileatt = new DataTable();
                        if (this.txtfatherid.Value == "")
                        {
                            dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(this.txtdocid.Value);
                        }
                        else
                        {
                            dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(this.txtfatherid.Value);
                        }
                        if (dt_fileatt.Rows.Count > 0)
                        {
                            for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                            {
                                if (ls_temp == "")
                                {
                                    ls_temp += "<a href='/" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target='_blank'>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a><br />";
                                }
                                else
                                {
                                    ls_temp += "<br /><a href='/" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target='_blank'>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a><br />";
                                }
                            }
                            this.lblhy_field2.Text = ls_temp;

                        }
                    }
                    dt.Clear();
                }
            }
            else
            {

                this.txtdocid.Value = Hyoa_global.GetRandom();
                this.txthy_djrname.Value = this.Session["hyuname"].ToString();
                this.txtdjrid.Value = this.Session["hyuid"].ToString();
                this.txthy_djbmname.Value = this.Session["hydeptname"].ToString();
                this.txtdjrbmid.Value = this.Session["hydeptid"].ToString();
                this.txthy_djsj.Value = System.DateTime.Now.ToString();
            }
        }
    }
Exemple #2
0
    private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["gwkid"] != null)
                {
                    //根据id得到信息
                    this.txtdocid.Value = this.Request.QueryString["gwkid"].ToString();
                    HyoaClass.Hyoa_gwk Hyoa_gwk = new HyoaClass.Hyoa_gwk();
                    DataTable dt = Hyoa_gwk.Getgwkbyid(this.txtdocid.Value);
                    if (dt.Rows.Count > 0)
                    {
                        this.txthy_djrname.Text = dt.Rows[0]["hy_djrname"].ToString();
                        this.txthy_djbmname.Text = dt.Rows[0]["hy_djbmname"].ToString();
                        this.txthy_bt.Text = dt.Rows[0]["hy_bt"].ToString();
                        this.txthy_djsj.Text = dt.Rows[0]["hy_djsj"].ToString();
                        this.txthy_typename.Text = dt.Rows[0]["hy_typename"].ToString();
                        this.txttypeid.Value = dt.Rows[0]["hy_typeid"].ToString();
                        this.txtdjrid.Value = dt.Rows[0]["hy_djrid"].ToString();
                        this.txtdjrbmid.Value = dt.Rows[0]["hy_djbmid"].ToString();
                        this.txtfatherid.Value = dt.Rows[0]["hy_fatherid"].ToString();
                    }
                    int tt = 0;
                    string ls_temp = "";
                    HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
                    HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                    //发文
                    if (dt.Rows[0]["hy_mudelid"].ToString() == "Mudelfwgl")
                    {
                        string lssqlfwglfile;
                        lssqlfwglfile = "select * from files where fother = '" + dt.Rows[0]["hy_fatherid"].ToString() + "'";
                        DataTable dtfwglfile = Hyoa_global.GetDataTable(lssqlfwglfile);
                        if (dtfwglfile.Rows.Count > 0)
                        {
                            for (int jfile = 0; jfile < dtfwglfile.Rows.Count; jfile++)
                            {
                                tt += 1;
                                if (ls_temp == "")
                                {
                                    ls_temp = tt.ToString() + "、<a href='../NTKO/" + dtfwglfile.Rows[jfile]["fpath"].ToString() + "/" + dtfwglfile.Rows[jfile]["fname"].ToString() + "' target=_blank>正文</a>";
                                }
                                else
                                {
                                    ls_temp += "<br>" + tt.ToString() + "、<a href='../NTKO/" + dtfwglfile.Rows[jfile]["fpath"].ToString() + "/" + dtfwglfile.Rows[jfile]["fname"].ToString() + "' target=_blank>正文</a>";
                                }
                            }
                        }
                    }
                    //收发文中上传的附件
                    DataTable dt_fileatt = new DataTable();
                    if (dt.Rows[0]["hy_fatherid"].ToString() != "")
                    {
                        dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(dt.Rows[0]["hy_fatherid"].ToString());
                        if (dt_fileatt.Rows.Count > 0)
                        {
                            for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                            {
                                tt += 1;
                                if (ls_temp == "")
                                {
                                    ls_temp = tt.ToString() + "、<a href='../" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target=_blank>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a>";
                                }
                                else
                                {
                                    ls_temp += "<br>" + tt.ToString() + "、<a href='../" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target=_blank>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a>";
                                }
                            }
                        }
                    }
                    //附件
                    dt_fileatt.Clear();
                    dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(this.txtdocid.Value);
                    if (dt_fileatt.Rows.Count > 0)
                    {
                        for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                        {
                            tt += 1;
                            if (ls_temp == "")
                            {
                                ls_temp = tt.ToString() + "、<a href='../" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target=_blank>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a>";
                            }
                            else
                            {
                                ls_temp += "<br>" + tt.ToString() + "、<a href='../" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target=_blank>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a>";
                            }
                        }
                    }
                    this.lblhy_field2.Text = ls_temp;
                    dt.Clear();
                }
            }
        }
    }