public void Save(IDbSession sess, TextbookTdm textbook) { if (textbook.Id == 0) { textbook.Id = sess.GetNextSequence("atb_textbook__id__seq"); } SqlInsert ss = new SqlInsert(sess); ss.Sql = "atb_textbook_t"; ss.Set("sz_oid", textbook.OId) .Set("sz_caption", textbook.Caption) .Set("ng_edition_id", textbook.EditionId) .Set("ng_subject_id", textbook.SubjectId) .Set("ng_publish_id", textbook.PublishId) .Set("ng_grade_id", textbook.GradeId) .Set("sz_src_store", textbook.SrcStore) .Set("sz_src_md5", textbook.SrcMd5) .Set("ng_src_size", textbook.SrcSize) .Set("sz_dst_store", textbook.DstStore) .Set("sz_dst_md5", textbook.DstMd5) .Set("ng_dst_size", textbook.DstSize) .Set("nt_state", textbook.State) .Set("ng_editor_id", textbook.EditorId) .Set("ng_ctor_id", textbook.CreatorId) .Set("ng_uper_id", textbook.UpdaterId); ss.ExecuteNonQuery(); }
public ActionResult UploadForm(TextbookTdm textbook) { //接收数据并存入数据库 textBookService.Save(textbook); //返回信息 return(Ok(new { msg = "ok" })); }
//public UserTdm FindByUsername(string uname) //{ // return DbSessionManager.Execute<UserTdm>((IDbSession sess)=>{ // return userWorker.FindByUserName(sess,uname); // }); //} public void Save(TextbookTdm textbook) { DbSessionManager.Execute <int>((IDbSession sess) => { textBookWorker.Save(sess, textbook); return(0); }); }
public void Delete(IDbSession sess, TextbookTdm textbook) { var ss = new SqlUpdate(sess); ss.Sql = "atb_textbook_t"; ss.Where = "ng_id=@ng_id"; ss.Set("nt_r_state", 0) .AddParam("ng_id", textbook.Id); ss.ExecuteNonQuery(); }
public void Update(IDbSession sess, TextbookTdm textbook) { var ss = new SqlUpdate(sess); ss.Sql = "atb_textbook_t"; ss.Where = "ng_id=@ng_id"; ss.Set("ng_editor_id", textbook.EditorId) .Set("nt_state", textbook.State) .Set("sz_dst_store", textbook.DstStore) .Set("sz_dst_md5", textbook.DstMd5) .Set("ng_dst_size", textbook.DstSize) .Set("ng_uper_id", textbook.UpdaterId) .AddParam("ng_id", textbook.Id); ss.ExecuteNonQuery(); }