Exemplo n.º 1
0
    void ShowInit()
    {
        if (!string.IsNullOrEmpty(Request.Params["File_Id"]))
        {
            Tunnel.BLL.Tunnel_Cfile   tf = new Tunnel.BLL.Tunnel_Cfile();
            Tunnel.Model.Tunnel_Cfile mf = new Tunnel.Model.Tunnel_Cfile();


            mf           = tf.GetModel(Convert.ToInt32(Request.Params["File_Id"]));
            Label1.Text  = mf.f_title;
            Label2.Text  = mf.f_content;
            ul.UsbnLogin = ul.getUserModel(mf.f_user);
            Label3.Text  = "发布人:" + ul.UsbnLogin.m_name + " 发布时间:" + mf.f_date.ToString();
            file         = getFile(mf.f_file);


            DataSet ds = tc.GetList("c_fid=" + mf.f_id + " order by c_id asc");
            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 上传文件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            //获得所需参数
            string         strTitle = tb_Title.Text.Trim();
            HttpPostedFile hpf      = file1.PostedFile;
            if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
            {
                Response.Write("<script>alert('附件大小不能大于10MB');</script>");

                return;
            }
            else
            {
                CreateMdAndFilePaht(hpf);
            }

            Tunnel.BLL.Tunnel_Cfile   tc = new Tunnel.BLL.Tunnel_Cfile();
            Tunnel.BLL.Tunnel_CView   tv = new Tunnel.BLL.Tunnel_CView();
            Tunnel.Model.Tunnel_Cfile mc = new Tunnel.Model.Tunnel_Cfile();
            Tunnel.Model.Tunnel_CView mv = new Tunnel.Model.Tunnel_CView();
            mc.f_title   = tb_Title.Text.Trim();
            mc.f_type    = Convert.ToInt32(DropDownList1.SelectedValue);
            mc.f_date    = DateTime.Now;
            mc.f_content = tb_content.Value;
            mc.f_file    = filePaht;
            mc.f_user    = ul.LoginID;
            if (!string.IsNullOrEmpty(first_value.Value))
            {
                mc.f_first = Convert.ToInt32(first_value.Value);
            }
            else
            {
                mc.f_first = 0;
            }
            string userlist = m_value.Value;
            mc.f_other = userlist;
            int s = tc.Add(mc);
            if (!string.IsNullOrEmpty(first_value.Value))
            {
                mv.c_fid     = s;
                mv.c_read    = 0;
                mv.c_uid     = Convert.ToInt32(first_value.Value);
                mv.c_content = "";
                tv.Add(mv);
            }
            string[] users = userlist.Split(',');
            foreach (string user in users)
            {
                if (!string.IsNullOrEmpty(user))
                {
                    mv.c_fid     = s;
                    mv.c_read    = 0;
                    mv.c_uid     = Convert.ToInt32(user);
                    mv.c_content = "";
                    tv.Add(mv);
                }
            }
            Tunnel.Common.Message.Show("保存成功");
        }
        catch {
            Tunnel.Common.Message.back("系统故障,请与管理员联系");
        }
    }