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

        string ls_tip = "保存成功!";

        //新文档时
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_gwk Hyoa_gwk = new HyoaClass.Hyoa_gwk();
        if (this.txtop.Value == "add")
        {
            Hyoa_gwk.ID = this.txtdocid.Value;
            Hyoa_gwk.hy_djrid = this.Session["hyuid"].ToString();
            Hyoa_gwk.hy_djrname = this.Session["hyuname"].ToString();
            Hyoa_gwk.hy_djbmid = this.Session["hydeptid"].ToString();
            Hyoa_gwk.hy_djbmname = this.Session["hydeptname"].ToString();;
            Hyoa_gwk.hy_bt = this.txthy_bt.Value;
            Hyoa_gwk.hy_wh = this.txthy_wh.Value;
            Hyoa_gwk.hy_lwwh = "";
            Hyoa_gwk.hy_djsj = System.DateTime.Now.ToString();
            Hyoa_gwk.hy_fatherid = "";
            Hyoa_gwk.hy_typeid = this.txttypeid.Value;
            Hyoa_gwk.hy_typename = this.txthy_typename.Value;
            Hyoa_gwk.Insert();
        }
        else
        {
            Hyoa_gwk.ID = this.txtdocid.Value;
            Hyoa_gwk.hy_djrid = this.Session["hyuid"].ToString();
            Hyoa_gwk.hy_djrname = this.Session["hyuname"].ToString();
            Hyoa_gwk.hy_djbmid = this.Session["hydeptid"].ToString();
            Hyoa_gwk.hy_djbmname = this.Session["hydeptname"].ToString();
            Hyoa_gwk.hy_bt = this.txthy_bt.Value;
            Hyoa_gwk.hy_wh = this.txthy_wh.Value;
            Hyoa_gwk.hy_lwwh = "";
            Hyoa_gwk.hy_djsj = System.DateTime.Now.ToString();
            Hyoa_gwk.hy_fatherid = "";
            Hyoa_gwk.hy_typeid = this.txttypeid.Value;
            Hyoa_gwk.hy_typename = this.txthy_typename.Value;
            Hyoa_gwk.Update();
        }

        //处理完成后的提示及跳转
        if (this.txtifpop.Value == "")
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
        else
        {
            Response.Write("<script>alert('" + ls_tip + "');self.close();</script>");
        }
    }
Exemple #2
0
 protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_gwk Hyoa_gwk = new HyoaClass.Hyoa_gwk();
     HyoaClass.Hyoa_gwksc Hyoa_gwksc = new HyoaClass.Hyoa_gwksc();
     String[] v_uids = this.txtuids.Value.Split(',');
     for (var i = 0; i < v_uids.Length; i++)
     {
         if (v_uids[i] != "")
         {
             Hyoa_gwk.ID = v_uids[i];
             Hyoa_gwk.Delete();
             //删除公文的同时删除我的收藏中对应的公文记录
             Hyoa_gwksc.gwk_id = v_uids[i];
             Hyoa_gwksc.DeleteBygwkid();
             //删除当前记录对应的附件(公文库中新增的附件)
             HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
             DataTable dtfileatt = Hyoa_fileatt.GetfileattByFatherid(v_uids[i]);
             if (dtfileatt.Rows.Count > 0)
             {
                 string ls_filepath = "";
                 for (int k = 0; k < dtfileatt.Rows.Count; k++)
                 {
                     ls_filepath = Server.MapPath("~/") + dtfileatt.Rows[k]["hy_filepath"].ToString();
                     if (File.Exists(ls_filepath))
                     {
                         System.IO.File.Delete(ls_filepath);
                     }
                     Hyoa_fileatt.ID = dtfileatt.Rows[k]["ID"].ToString();
                     Hyoa_fileatt.Delete();
                 }
             }
         }
     }
     this.txtuids.Value = "";
     DataPlay(System.Int32.Parse(this.curpage.Text));
 }
    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 #4
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();
                }
            }
        }
    }