Beispiel #1
0
    protected void submit_Click(object sender, EventArgs e)
    {
        string str = "select * from nav where id='" + profenlei.SelectedValue + "'";

        Daxu.Entity.nav navInfo = Daxu.BLL.navBll.getInavModel(str);
        if (HiddenField1.Value == "2")
        {
            string fileth = "";
            string fid = MusicUrl.FileName;
            if (file(fid))
            {
                if (PdMusic(Convert.ToString(MusicUrl.FileName)))
                {
                    fid = MusicUrl.FileName;
                    fileth = "~/upload/dowen/" + fid;
                    FileInfo filee = new FileInfo(Server.MapPath(fileth));
                    fileth = "";
                    // fid = MusicUrl.FileName + "[MC:" + DateTime.Now.ToString("yyyyHHmmssfff") + "]";
                    fid = fid.Substring(0, fid.LastIndexOf('.')) + "_MC" + DateTime.Now.ToString("yyyyHHmmssfff") + Path.GetExtension(fid);
                    fileth = "~/upload/dowen/" + fid;

                    DirectoryInfo mydir = new DirectoryInfo(fileth);
                    if (mydir.Exists)
                    {
                        filee.Delete();
                    }
                    MusicUrl.SaveAs(Server.MapPath(fileth));

                }
                else
                {
                    string fileth1 = "~/upload/dowen/" + NameBx.Value;
                    FileInfo filee = new FileInfo(Server.MapPath(fileth1));
                    DirectoryInfo mydir = new DirectoryInfo(fileth1);
                    if (mydir.Exists)
                    {
                        filee.Delete();
                    }
                    fileth1 = "";
                    fileth1 = "~/upload/dowen/" + MusicUrl.FileName;
                    MusicUrl.SaveAs(Server.MapPath(fileth1));
                }
            }
            else
            {
                Response.Write("<script type=\"text/javascript\">alert(\"上传格式错误!\"); window.location='" + Request.RawUrl + "'</script>");
            }

            Daxu.Entity.down downinfo = new Daxu.Entity.down();
            downinfo.name = _name.Text;
            downinfo.namebx = fid;
            downinfo.fenlei = profenlei.SelectedValue;
            downinfo.conter = _conter.Text;
            downinfo.DengJI = Convert.ToString(navInfo.rootpart);

            downinfo.datetime = DateTime.Now.ToString("yyyy年MM月dd日"); ;
            downinfo.id = Convert.ToInt32(Request.QueryString["id"]);
            Daxu.BLL.downBll.UpdateIdown(downinfo);
            Response.Write("<script type=\"text/javascript\">alert(\"上传成功!\");  window.location='" + Request.RawUrl + "'</script>");
        }
        else if (HiddenField1.Value == "1")//添加
        {
            string fileth;
            string fid = MusicUrl.FileName;
            if (file(fid))
            {
                if (PdMusic(fid))
                {
                    fid = fid.Substring(0, fid.LastIndexOf('.')) + "_MC" + DateTime.Now.ToString("yyyyHHmmssfff") + Path.GetExtension(fid);
                }
                fileth = "~/upload/dowen/" + fid;
                string text = Server.MapPath(fileth);
                MusicUrl.SaveAs(text);

                Daxu.Entity.down downinfo = new Daxu.Entity.down();
                downinfo.name = _name.Text;
                downinfo.DengJI = Convert.ToString(navInfo.rootpart);
                downinfo.namebx = fid;
                downinfo.datetime = DateTime.Now.ToString("yyyy年MM月dd日");
                downinfo.fenlei = profenlei.SelectedValue;
                downinfo.conter = _conter.Text;
                Daxu.BLL.downBll.InsertIdown(downinfo);
                Response.Write("<script type=\"text/javascript\">alert(\"上传成功!\");  window.location='" + Request.RawUrl + "'</script>");
            }
            else
            {
                Response.Write("<script type=\"text/javascript\">alert(\"上传格式错误!\"); window.location='" + Request.RawUrl + "'</script>");
            }
        }
    }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        UserHandle.UserHandle.InitModules_Admin("XZGL");
        if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Delete))
        {
            if (HiddenField1.Value == "2")
            {
                string fileth = "";
                string fid = FileUpload1.FileName;
                if (file(fid))
                {
                    string fileth1;
                    fileth1 = "~/upload/dowen/" + FileUpload1.FileName;
                    fileth = "~/upload/dowen/" + Session["lod"] as System.String;
                    FileInfo filee = new FileInfo(Server.MapPath(fileth));

                    FileUpload1.SaveAs(Server.MapPath(fileth1));
                }
                else
                {
                    Response.Write("<script type=\"text/javascript\">alert(\"上传格式错误!!!\"); window.location='../download/downlist.aspx'; </script>");

                }
                Daxu.Entity.down downinfo = new Daxu.Entity.down();
                downinfo.name = _name.Text;
                downinfo.namebx = FileUpload1.FileName;
                downinfo.fenlei = profenlei.SelectedValue;
                downinfo.conter=  _conter.Text;

                downinfo.datetime = DateTime.Now.ToString(); ;
                downinfo.id = Convert.ToInt32(Request.QueryString["id"]);
                Daxu.BLL.downBll.UpdateIdown(downinfo);
                Response.Write("<script type=\"text/javascript\">alert(\"上传成功\"); window.location='../download/downlist.aspx'; </script>");
            }

            if (HiddenField1.Value == "1")
            {
                string fileth;
                string fid = FileUpload1.FileName;
                if (file(fid))
                {
                    fileth = "~/upload/dowen/" + FileUpload1.FileName;
                    FileUpload1.SaveAs(Server.MapPath(fileth));
                    Daxu.Entity.down downinfo = new Daxu.Entity.down();
                    downinfo.name = _name.Text;
                    downinfo.namebx = FileUpload1.FileName;
                    downinfo.datetime = DateTime.Now.ToString();
                    downinfo.fenlei = profenlei.SelectedValue;
                    downinfo.conter = _conter.Text;

                    Daxu.BLL.downBll.InsertIdown(downinfo);
                    Response.Write("<script type=\"text/javascript\">alert(\"上传成功\"); window.location='../download/downlist.aspx'; </script>");

                }
                else
                {

                    Response.Write("<script type=\"text/javascript\">alert(\"上传格式错误!!!\"); window.location='../download/downlist.aspx'; </script>");
                }

            }
        }
        else
        {
            Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>");
        }
    }