//[WebMethod] //[WebMethod] //[ScriptMethod] public JsonResult BrowsUploadSave(UploadFile type) { PlayersUploaad plays = new PlayersUploaad(); try { string pathname = ""; string _FileName = Path.GetFileName(type.typess.FileName); string _path = Path.Combine(Server.MapPath("~/FileSource/PackagesChargesRecord/"), _FileName); //pathname = "MibFiles/" + _FileName; addres = _path; type.typess.SaveAs(_path); } catch { return(Json(addres)); } string[] lines = addres.Split('\\'); string line_sddres = "~/FileSource/PackagesChargesRecord/"; plays.addres_path = addres; plays.play_name = "/FileSource/PackagesChargesRecord/" + lines[lines.Length - 1]; return(Json(plays)); }
public JsonResult RecordApprove(int card_id, int user_id, string logging_date, PlayersUploaad record_audio, string comment, int status) { DateTimeFormatInfo usDtfi = new CultureInfo("en-US", false).DateTimeFormat; DateTime date_logg = Convert.ToDateTime(logging_date, usDtfi); using (DataContext _db = new DataContext()) { using (DbContextTransaction tran = _db.Database.BeginTransaction(IsolationLevel.Snapshot)) { try { int __user_id = ((User)Session["CurrentUser"]).Id; _db.Loggings.Add(new Logging() { Tdate = DateTime.Now, UserId = __user_id, Type = LogType.Card, Mode = LogMode.Verify, TypeValue = card_id.ToString(), TypeId = card_id }); _db.SaveChanges(); var RecordAudioDelete = _db.RecordAudioFiles.Where(c => c.card_id == card_id && c.Status == (PackagesChargesStatus)status).FirstOrDefault(); if (RecordAudioDelete != null) // განმეორებადი მონაცემების წაშლა { if (System.IO.File.Exists(RecordAudioDelete.audio_name)) { System.IO.File.Delete(RecordAudioDelete.audio_name); } _db.RecordAudioFiles.Remove(RecordAudioDelete); _db.SaveChanges(); } _db.RecordAudioFiles.Add(new RecordAudioFile // ახალი ჩანაწერის დამამტება { card_id = card_id, audio_name = record_audio.addres_path, info = comment, Status = (PackagesChargesStatus)status, verify_status = 1 }); _db.SaveChanges(); tran.Commit(); return(Json(1)); // } } catch (Exception ex) { tran.Rollback(); return(Json(0)); } } } return(Json(0)); }