Beispiel #1
0
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     try
     {
         Data objdata = new Data(Global.ConnectionSql);
         Img  obj     = new Img();
         obj.DataObject = objdata;
         HttpFileCollection httpFileCollection = Request.Files;
         for (int i = 0; i < httpFileCollection.Count; i++)
         {
             HttpPostedFile httpPostedFile = httpFileCollection[i];
             if (httpPostedFile.ContentLength > 0)
             {
                 obj.Images    = Global.GetConfigKey("uploadproduct") + httpPostedFile.FileName;
                 obj.ProductID = NewsID;
                 obj.Sort      = 1;
                 int iresult = Convert.ToInt32(obj.Add());
                 httpPostedFile.SaveAs(Server.MapPath("~/" + Global.GetConfigKey("uploadproduct")) + "/" + System.IO.Path.GetFileName(httpPostedFile.FileName));
             }
         }
         this.BindingData();
     }
     catch (Exception ex)
     {
         Global.WriteLogError("Update () " + ex);
         lblmessage.Text = "Lỗi xảy ra trong quá trình lưu dữ liệu";
         mpUpload.Show();
     }
 }
Beispiel #2
0
 // public ObservableCollection<Uri> imageuri;
 public void Add_New_Image(Notes n, string imguri)
 {
     if (Img == null)
     {
         Img = new ObservableCollection <string>();
     }
     //var temp = new Uri();
     Img.Add(imguri);
 }