Пример #1
0
 public JsonResult DeleteFile(string models)
 {
     JsonResult result = new JsonResult();
     Download bll = new Download();
     List<sd_download> fileList = new List<sd_download>();
     sd_download info = new sd_download();
     if (models != null)
     {
         var t = JsonConvert.DeserializeObject<List<sd_download>>(models);
         if (t.Count > 0)
         {
             bll.Delete(t);
             result.Data = fileList;
         }
     }
     return result;
 }
Пример #2
0
 /// <summary>
 /// Handles the Download event of the Delete control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param>
 protected void Delete_Download(object sender, DataGridCommandEventArgs e)
 {
     try {
         int  artifactId = 0;
         bool isParsed   = int.TryParse(dgDownloads.DataKeys[e.Item.ItemIndex].ToString(), out artifactId);
         if (isParsed)
         {
             Download artifact = new Download(artifactId);
             File.Delete(Server.MapPath(artifact.DownloadFile));
             Download.Delete(artifactId);
         }
         LoadDownloads();
         txtTitle.Text       = string.Empty;
         txtDescriptor.Value = string.Empty;
     }
     catch (Exception ex) {
         Logger.Error(typeof(downloadedit).Name + ".Delete_Download", ex);
         Master.MessageCenter.DisplayCriticalMessage(LocalizationUtility.GetCriticalMessageText(ex.Message));
     }
 }