public bool Save(string version) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { var count = (from m in db.t_actress where m.f_javlib_id == this.JL_Id select m).Count(); t_actress entry; if (count == 0) { entry = new t_actress() { f_javlib_id = this.JL_Id, f_name = this.Name, f_update = DateTime.Now, f_version = version, f_create = DateTime.Now }; db.t_actress.InsertOnSubmit(entry); db.SubmitChanges(); } else { entry = (from m in db.t_actress where m.f_javlib_id == this.JL_Id select m).First(); entry.f_name = this.Name; entry.f_prefix = this.Prefix; entry.f_update = DateTime.Now; entry.f_version = version; db.SubmitChanges(); } } return true; }
public static Video GetActressNotVersion(string version, int thcount, int thindex) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { var entry = (from m in db.t_video where m.f_version != version && m.id % thcount == thindex select m).FirstOrDefault(); if (entry == null) { return null; } Video ret = new Video { Id = entry.id, Code = entry.f_code, Create = entry.f_create, IssueDate = entry.f_issuer_date, JL_Id = entry.f_javlib_id, Length = entry.f_length, Name = entry.f_name, Update = entry.f_update, Version = entry.f_version, Factory = null, Director = null, Issuer = null, Tags = new VideoTag[0] }; if (entry.f_director > 0) { var _d = (from m in db.t_director where m.id == entry.f_director select m).FirstOrDefault(); if (_d != null) { ret.Director = _d.GetModel(); } } if (entry.f_factory > 0) { var _d = (from m in db.t_factory where m.id == entry.f_factory select m).FirstOrDefault(); if (_d != null) { ret.Factory = _d.GetModel(); } } if (entry.f_issuer > 0) { var _d = (from m in db.t_issuer where m.id == entry.f_issuer select m).FirstOrDefault(); if (_d != null) { ret.Issuer = _d.GetModel(); } } ret.Tags = (from m in db.t_tag join n in db.t_tag_video on m.id equals n.f_tag where n.f_video == ret.Id select m.GetModel()).ToArray(); return ret; } }
public bool Save(int video) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { if (this.JL_Id != null && this.Name != null && this.JL_Id != "" && this.Name != "") { var q = (from m in db.t_tag where m.f_javlib_id == JL_Id select m).Count(); t_tag entry; if (q == 0) { entry = new t_tag() { f_javlib_id = this.JL_Id, f_name = this.Name, f_create = DateTime.Now, f_update = DateTime.Now }; db.t_tag.InsertOnSubmit(entry); db.SubmitChanges(); this.Id = entry.id; } else { entry = (from m in db.t_tag where m.f_javlib_id == JL_Id select m).First(); entry.f_javlib_id = JL_Id; entry.f_name = Name; entry.f_update = DateTime.Now; db.SubmitChanges(); this.Id = entry.id; } if (video > 0) { var rcount = (from m in db.t_tag_video where m.f_video == video && m.f_tag == entry.id select m).Count(); if (rcount == 0) { db.t_tag_video.InsertOnSubmit(new t_tag_video() { f_tag = entry.id, f_video = video }); db.SubmitChanges(); } } } } return true; }
public static void Log(LogLevel lv, string version, string msg, int id, string action) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { t_log log = new t_log() { f_datetime = DateTime.Now, f_level = (int)lv, f_msg = msg, f_version = version, f_id = id, f_action = action }; db.t_log.InsertOnSubmit(log); db.SubmitChanges(); } }
public static Actress GetActressNotVersion(string version, bool overwrite, string[] fixture) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { var ret = (from m in db.t_actress where m.f_version != version && fixture.Contains(m.f_prefix) select m).FirstOrDefault(); if (ret == null) { return null; } else { if (overwrite) { ret.f_version = version; db.SubmitChanges(); } return ret.GetModel(); } } }
public bool Save() { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { if (this.JL_Id != null && this.Name != null && this.JL_Id != "" && this.Name != "") { var q = (from m in db.t_director where m.f_javlib_id == JL_Id select m).Count(); t_director entry; if (q == 0) { entry = new t_director() { f_javlib_id = this.JL_Id, f_name = this.Name, f_create = DateTime.Now, f_update = DateTime.Now }; db.t_director.InsertOnSubmit(entry); db.SubmitChanges(); this.Id = entry.id; } else { entry = (from m in db.t_director where m.f_javlib_id == JL_Id select m).First(); entry.f_javlib_id = JL_Id; entry.f_name = Name; entry.f_update = DateTime.Now; db.SubmitChanges(); this.Id = entry.id; } } } return true; }
public static Actress GetActressNotVersion(string version, bool overwrite, int thcount, int thindex) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { var ret = (from m in db.t_actress where m.f_version != version && m.id % thcount == thindex select m).FirstOrDefault(); if (ret == null) { return null; } else { if (overwrite) { ret.f_version = version; ret.f_update = DateTime.Now; db.SubmitChanges(); } return ret.GetModel(); } } }
public bool Save(string version, int actress) { using (SekaiAVDataDataContext db = new SekaiAVDataDataContext()) { var count = (from m in db.t_video where m.f_javlib_id == this.JL_Id select m).Count(); t_video entry; if (count == 0) { entry = new t_video() { f_code = this.Code, f_issuer_date = this.IssueDate, f_javlib_id = this.JL_Id, f_length = this.Length, f_name = this.Name, f_update = DateTime.Now, f_version = version }; if (this.Factory != null) { entry.f_factory = this.Factory.Id; } else { entry.f_factory = -1; } if (this.Issuer != null) { entry.f_issuer = this.Issuer.Id; } else { entry.f_issuer = -1; } if (this.Director != null) { entry.f_director = this.Director.Id; } else { entry.f_director = -1; } db.t_video.InsertOnSubmit(entry); db.SubmitChanges(); var rcount = (from m in db.t_actress_video where m.f_actress == actress && m.f_video == entry.id select m).Count(); if (rcount == 0) { db.t_actress_video.InsertOnSubmit(new t_actress_video() { f_actress = actress, f_video = entry.id }); db.SubmitChanges(); } } else { entry = (from m in db.t_video where m.f_javlib_id == this.JL_Id select m).First(); entry.f_code = this.Code; entry.f_issuer_date = this.IssueDate; entry.f_javlib_id = this.JL_Id; entry.f_length = this.Length; entry.f_name = this.Name; entry.f_update = DateTime.Now; entry.f_version = version; if (this.Factory != null) { entry.f_factory = this.Factory.Id; } else { entry.f_factory = -1; } if (this.Issuer != null) { entry.f_issuer = this.Issuer.Id; } else { entry.f_issuer = -1; } if (this.Director != null) { entry.f_director = this.Director.Id; } else { entry.f_director = -1; } db.SubmitChanges(); var rcount = (from m in db.t_actress_video where m.f_actress == actress && m.f_video == entry.id select m).Count(); if (rcount == 0) { db.t_actress_video.InsertOnSubmit(new t_actress_video() { f_actress = actress, f_video = entry.id }); db.SubmitChanges(); } } } return true; }