Exemplo n.º 1
0
 protected void btnSubmit_OnClick(object sender, EventArgs e)
 {
     Mxm.Model.download mo = new Mxm.Model.download();
     mo.create_time = DateTime.Now;
     mo.name = txtName.Text.Trim();
     mo.remark = txtContent.InnerHtml;
     mo.sort = 0;
     if (fileUp.HasFile)
     {
         string fName = DateTime.Now.Ticks.ToString() + fileUp.FileName;
         string path = Server.MapPath(
             ConfigurationManager.AppSettings["downPath"].ToString()) + fName;
         fileUp.SaveAs(path);
         mo.path = fName;
     }
     if (picUp.HasFile)
     {
         string fName = DateTime.Now.Ticks.ToString() + picUp.FileName;
         string path = Server.MapPath(
             ConfigurationManager.AppSettings["imgPath"].ToString()) + fName;
         picUp.SaveAs(path);
         mo.picture = fName;
     }
     (new Mxm.DAL.download()).Add(mo);
     Mxm.Common.MessageBox.Show(this, "添加成功");
 }
Exemplo n.º 2
0
 private void ShowInfo()
 {
     Mxm.Model.download mo = new Mxm.Model.download();
     mo = new Mxm.DAL.download().GetModel(_id);
     if (mo != null)
     {
         txtName.Text = mo.name;
         txtContent.Value = mo.remark;
         lblFile.Text = mo.path;
         img1.Src = ConfigurationManager.AppSettings["imgPath"] + mo.picture;
     }
 }