Ejemplo n.º 1
0
 protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_ntkohongtou Hyoa_ntkohongtou = new HyoaClass.Hyoa_ntkohongtou();
     String[] v_uids = this.txtuids.Value.Split(',');
     for (var i = 0; i < v_uids.Length; i++)
     {
         if (v_uids[i] != "")
         {
             //删除附件
             DataTable dt;
             dt = Hyoa_ntkohongtou.Gethongtou(v_uids[i]);
             if (dt.Rows.Count > 0)
             {
                 string ls_filepath = Server.MapPath("~/") + "NTKO/" + dt.Rows[0]["hongtouurl"].ToString();
                 if (File.Exists(ls_filepath))
                 {
                     System.IO.File.Delete(ls_filepath);
                 }
             }
             Hyoa_ntkohongtou.hongtouid = v_uids[i];
             Hyoa_ntkohongtou.Delete();
         }
     }
     this.txtuids.Value = "";
     //DataPlay(1);
     DataPlay(System.Int32.Parse(this.curpage.Text));
 }
Ejemplo n.º 2
0
        //ntko_class db = new ntko_class();//实例ntko_class类
        protected void Page_Load(object sender, EventArgs e)
        {
            //title = db.getdemotitle();
            //attachpath = db.getattachpath();
            if (this.Session["hyuid"].ToString() == "")
                this.Response.Redirect("../login.aspx?url=" + this.Request.RawUrl);

            //加载模板
            HyoaClass.Hyoa_ntkotemplateFile Hyoa_ntkotemplateFile = new HyoaClass.Hyoa_ntkotemplateFile();
            DataTable dt_templateFile = Hyoa_ntkotemplateFile.GettemplateFiles();
            this.templateFile.DataSource = dt_templateFile;
            this.templateFile.DataTextField = "templateFilename";
            this.templateFile.DataValueField = "templateFileurl";
            this.templateFile.DataBind();
            this.templateFile.Items.Insert(0, new ListItem("--请选择模板--", ""));
            this.templateFile.SelectedIndex = 0;

            //加载印章
            HyoaClass.Hyoa_ntkoesp Hyoa_ntkoesp = new HyoaClass.Hyoa_ntkoesp();
            DataTable dt_esp = Hyoa_ntkoesp.Getesps();
            this.SignFileUrl.DataSource = dt_esp;
            this.SignFileUrl.DataTextField = "espname";
            this.SignFileUrl.DataValueField = "espurl";
            this.SignFileUrl.DataBind();
            this.SignFileUrl.Items.Insert(0, new ListItem("--请选择印章--", ""));
            this.SignFileUrl.SelectedIndex = 0;

            //加载红头
            HyoaClass.Hyoa_ntkohongtou Hyoa_ntkohongtou = new HyoaClass.Hyoa_ntkohongtou();
            DataTable dt_hongtou = Hyoa_ntkohongtou.Gethongtous();
            this.redHeadTemplateFile.DataSource = dt_hongtou;
            this.redHeadTemplateFile.DataTextField = "hongtouname";
            this.redHeadTemplateFile.DataValueField = "hongtouurl";
            this.redHeadTemplateFile.DataBind();
            this.redHeadTemplateFile.Items.Insert(0, new ListItem("--请选择红头--", ""));
            this.redHeadTemplateFile.SelectedIndex = 0;

            title = "宁波合益";
            hyusername = this.Session["hyuname"].ToString();
            //设置第一环节是否在痕迹模式下编辑
            tacheByhj = "0";//痕迹模式下编辑
            if (this.Request.QueryString["tacheByhj"] != null)
            {
                if (this.Request.QueryString["tacheByhj"].ToString() == "1")
                {
                    tacheByhj = "1";    //非痕迹模式下编辑
                }
            }
            //是否显示接受修订按钮
            if (this.Request.QueryString["jsxd"] != null)
            {
                if (this.Request.QueryString["jsxd"].ToString() == "1")
                {
                    btnjsxd = "<input id=\"Button2\" type=button style =\"width:70px;height:23px;\" onclick=\"TANGER_OCX_AllRevisions(true);\" runat=\"server\" value=\" 接受修订\"  />";
                }
            }

            newofficetype = Request.QueryString["newofficetype"];
            HyoaClass.Hyoa_ntko Hyoa_ntko = new HyoaClass.Hyoa_ntko();
            if (this.Request.QueryString["fatherid"] != null)
            {
                fatherid = this.Request.QueryString["fatherid"].ToString();

                DataTable dtfatherid = Hyoa_ntko.GetntkofileByfother(fatherid);
                //this.Response.Write("<script>alert('" + dtfatherid.Rows.Count + "');</script>");
                if (dtfatherid.Rows.Count > 0)
                {
                    url = dtfatherid.Rows[0]["fid"].ToString();

                    DataTable dt = Hyoa_ntko.Getntkofile(url);
                    if (dt.Rows.Count > 0)
                    {
                        fileid = dt.Rows[0]["fid"].ToString();
                        filetitle = dt.Rows[0]["ftitle"].ToString();
                        fileother = dt.Rows[0]["fother"].ToString();
                        filename = dt.Rows[0]["fname"].ToString();
                    }
                }
            }

            tableid = "";
            if (this.Request.QueryString["tableid"] != null)
            {
                tableid = Request.QueryString["tableid"].ToString();
            }

            //隐藏控制(根据fatherid)
            string ls_flowid = "";
            string ls_currenttacheid = "";
            HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            string sql = "";
            sql = "select * from hyc_" + tableid + " where DOCID='" + fatherid + "' ";
            DataTable dt_flowmain = Hyoa_global.GetDataTable(sql);
            if (dt_flowmain.Rows.Count > 0)
            {
                ls_flowid = dt_flowmain.Rows[0]["hy_flowid"].ToString();
                ls_currenttacheid = dt_flowmain.Rows[0]["hy_curtacheid"].ToString();
                //根据当前环节ID得到对应的隐藏权限
                DataTable dt_flowtachefield = Hyoa_flowtachefield.Getflowtachefield_gl(ls_flowid, ls_currenttacheid);
                if (dt_flowtachefield.Rows.Count > 0)
                {
                    for (var i = 0; i < dt_flowtachefield.Rows.Count; i++)
                    {
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "选择模板")
                        {
                            xuanzemubangongneng.Visible = true;
                        }
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "界面设置")
                        {
                            jiemianshezhi.Visible = true;
                        }
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "打印控制")
                        {
                            dayinkongzhi.Visible = true;
                        }
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "印章和图片")
                        {
                            yinzhanghetupiangongneng.Visible = true;
                        }
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "套红功能")
                        {
                            taohonggongneng.Visible = true;
                        }
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "接受修订")
                        {
                            jieshouxiuding.Visible = true;
                        }
                        if (dt_flowtachefield.Rows[i]["hy_fieldname"].ToString() == "权限控制")
                        {
                            quanxiankongzhi.Visible = true;
                        }
                    }
                }
            }
            else
            {
                //未找到,则默认权限
                xuanzemubangongneng.Visible = true;
                jiemianshezhi.Visible = true;
                dayinkongzhi.Visible = true;
                yinzhanghetupiangongneng.Visible = true;
                taohonggongneng.Visible = true;
                jieshouxiuding.Visible = true;
                quanxiankongzhi.Visible = true;
            }

            //生成痕迹稿start
            //在接受修订环节,打开文档时生成痕迹稿。
            string lsMapPath="";
            string lsMapPathsdec = "";
            if (this.Request.QueryString["jsxd"] != null)
            {
                if (this.Request.QueryString["jsxd"].ToString() == "1")
                {
                    lsMapPath = Server.MapPath("~/")+"/NTKO/uploadOfficeFile/"+filename;    //虚拟目录的位置
                    if (filename.IndexOf(".doc") > 0)
                    {
                        lsMapPathsdec = Server.MapPath("~/") + "/NTKO/uploadOfficeFile/" + filename.Substring(0, filename.IndexOf(".doc")) + "hjbl" + ".doc";//虚拟目录的位置
                    }
                    if (filename.IndexOf(".wps") > 0)
                    {
                        lsMapPathsdec = Server.MapPath("~/") + "/NTKO/uploadOfficeFile/" + filename.Substring(0, filename.IndexOf(".wps")) + "hjbl" + ".wps";//虚拟目录的位置
                    }
                        //File.Delete(lsMapPathsdec);
                    if (File.Exists(lsMapPathsdec))
                    {
                        //如果文件已经存在了,就不用产生痕迹稿了
                    }
                    else
                    {   //如果没有生成则生成痕迹稿
                        File.Copy(lsMapPath, lsMapPathsdec, false);
                    }

                }
            }
            //生成痕迹稿end
        }
Ejemplo n.º 3
0
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "保存成功!";

        //新文档时
        string ls_attsize = "";
        string str_path = "";
        string lspath = "";
        string lsguid = "";
        string lsurl = "";
        string lsfilename = "";
        string lshy_fatherfield = System.Guid.NewGuid().ToString();
        lsfilename = FileUpload1.FileName;
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_ntkohongtou Hyoa_ntkohongtou = new HyoaClass.Hyoa_ntkohongtou();

        if (this.txtop.Value == "add")
        {
            lsguid = Hyoa_global.GetRandom();
            txtdocid.Value = lsguid;
            if (lsfilename != "")
            {
                string str_filename = Server.HtmlEncode(lsfilename);
                string extension = System.IO.Path.GetExtension(str_filename).ToLower();
                if ((extension != ".doc") && (extension != ".docx"))
                {
                    this.Response.Write("<script language=javascript>alert('请您上传word文档等格式的文件!');</script>");
                    return;
                }

                lshy_fatherfield = "";
                ls_attsize = System.Convert.ToString(System.Convert.ToDouble(System.Convert.ToInt32(System.Convert.ToDouble(FileUpload1.PostedFile.ContentLength.ToString()) / 1024 / 1024 * 1000)) / 1000);//附件的大小
                System.Console.WriteLine(txtdocid.Value);
                //SaveCommon(ls_path, ls_attsize, lsguid);
                //将附件上传到服务器目录下
                lspath = Server.MapPath("~/");//虚拟目录的位置
                lsurl = "NTKO\\hongtou"; //存放的文件夹
                Directory.CreateDirectory(lspath + "\\" + lsurl);
                str_path = lspath + "\\" + lsurl + "\\" + lsguid + extension;
                FileUpload1.SaveAs(str_path);
                //插入数据库
                Hyoa_ntkohongtou.hongtouid = txtdocid.Value;
                Hyoa_ntkohongtou.hongtouname = SignName.Value;
                Hyoa_ntkohongtou.hongtousort = System.Int32.Parse(Sort.Value);
                Hyoa_ntkohongtou.hongtoutype = "发文";
                Hyoa_ntkohongtou.hongtouurl = "hongtou/" + txtdocid.Value + extension;
                Hyoa_ntkohongtou.hongtouuserid = "";
                Hyoa_ntkohongtou.hongtouusername = "";
                Hyoa_ntkohongtou.Insert();
            }
            else
            {
                this.Response.Write("<script>alert('请选择要上传的文件!');</script>");
            }
        }
        else
        {
            if (lsfilename != "")
            {
                string str_filename = Server.HtmlEncode(lsfilename);
                string extension = System.IO.Path.GetExtension(str_filename).ToLower();
                if ((extension != ".doc") && (extension != ".docx"))
                {
                    this.Response.Write("<script language=javascript>alert('请您上传word文档等格式的文件!');</script>");
                    return;
                }

                lshy_fatherfield = "";
                ls_attsize = System.Convert.ToString(System.Convert.ToDouble(System.Convert.ToInt32(System.Convert.ToDouble(FileUpload1.PostedFile.ContentLength.ToString()) / 1024 / 1024 * 1000)) / 1000);//附件的大小
                System.Console.WriteLine(txtdocid.Value);
                //SaveCommon(ls_path, ls_attsize, lsguid);
                //将附件上传到服务器目录下
                lspath = Server.MapPath("~/");//虚拟目录的位置
                lsurl = "NTKO\\hongtou"; //存放的文件夹
                Directory.CreateDirectory(lspath + "\\" + lsurl);
                str_path = lspath + "\\" + lsurl + "\\" + txtdocid.Value + extension;
                FileUpload1.SaveAs(str_path);
            }
            Hyoa_ntkohongtou.hongtouid = this.txtdocid.Value;
            Hyoa_ntkohongtou.hongtouname = SignName.Value;
            Hyoa_ntkohongtou.hongtouuserid = "";
            Hyoa_ntkohongtou.hongtouusername = "";
            Hyoa_ntkohongtou.hongtousort = System.Int32.Parse(Sort.Value);
            Hyoa_ntkohongtou.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>");
        }
    }
Ejemplo n.º 4
0
    private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        string ls_mudelid = "";
        string ls_role = "";
        if (Request.QueryString["mid"] != null)
        {
            ls_mudelid = Request.QueryString["mid"].ToString();
        }
        HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
        DataTable dt_mudel = Hyoa_mudel.Getmudel(ls_mudelid);
        if (dt_mudel.Rows.Count > 0)
        {
            ls_role = dt_mudel.Rows[0]["hy_roleid"].ToString();
        }
        if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
        {
            this.isrole.Value = "1";
            this.tdnewdoc.Visible = true; //新建
            this.tddeldoc.Visible = true; //删除
        }
        else
        {
            this.isrole.Value = "0";
            this.tdnewdoc.Visible = false; //新建
            this.tddeldoc.Visible = false; //删除
        }

        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_ntkohongtou Hyoa_ntkohongtou = new HyoaClass.Hyoa_ntkohongtou();

        DataTable dt;
        dt = Hyoa_ntkohongtou.Gethongtous();

        DataTable tempTable = dt.Clone();
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
Ejemplo n.º 5
0
    private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            //判断当前用户是否有新建删除权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            string ls_mudelid = "Mudelfwgl";
            string ls_role = "";
            HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
            DataTable dt_mudel = Hyoa_mudel.Getmudel(ls_mudelid);
            if (dt_mudel.Rows.Count > 0)
            {
                ls_role = dt_mudel.Rows[0]["hy_roleid"].ToString();
            }
            if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
            {
                btn_submit.Visible = true;
            }

            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改
            this.lbupfile.Text = "无附件!";

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                this.txtdocid.Value = this.Request.QueryString["hongtouid"].ToString();

                HyoaClass.Hyoa_ntkohongtou Hyoa_ntkohongtou = new HyoaClass.Hyoa_ntkohongtou();
                DataTable dt = Hyoa_ntkohongtou.Gethongtou(this.txtdocid.Value);
                string ls_att = "";
                if (dt.Rows.Count > 0)
                {
                    this.SignName.Value = dt.Rows[0]["hongtouname"].ToString();
                    this.Sort.Value = dt.Rows[0]["hongtousort"].ToString();
                    this.txthongtouurl.Value = dt.Rows[0]["hongtouurl"].ToString();
                    if (dt.Rows[0]["hongtouurl"].ToString() != "")
                    {
                        ls_att += "<a href=\"" + dt.Rows[0]["hongtouurl"].ToString() + "\" target=_blank>" + dt.Rows[0]["hongtouname"].ToString() + "</a>";
                    }
                    this.lbupfile.Text = ls_att;
                }
            }
        }
    }