public string DeleteData(string id,string userid) { var tran = Utility.Database.BeginDbTransaction(); try { B_EmailDocument b_EmailDocument = new B_EmailDocument(); b_EmailDocument.Condition.Add("id = " + id);//设置查询条件,条件为当前用户ID Utility.Database.Delete(b_EmailDocument, tran); Utility.Database.Commit(tran); return JsonConvert.SerializeObject( UpdateData(userid)); } catch (Exception ex) { Utility.Database.Rollback(tran); ComBase.Logger(ex);//写日专到本地文件 return Utility.JsonMsg(false, "删除失败:" + ex.Message); } }
public object SaveEmailDocument(string documentName, string userid) { var tran = Utility.Database.BeginDbTransaction(); StringBuilder strSql = new StringBuilder(); try { string id = ComClass.GetGuid(); B_EmailDocument emailDocucment = new B_EmailDocument(); emailDocucment.createManId = userid; emailDocucment.documentName = documentName; emailDocucment.id = id; Utility.Database.Insert<B_EmailDocument>(emailDocucment); Utility.Database.Commit(tran); return Utility.JsonMsg(true, "保存成功"); } catch (Exception e) { Utility.Database.Rollback(tran); ComBase.Logger(e.Message); throw (new Exception("保存失败!", e)); } }
public string SaveEmailDocument(string documentName, string userid) { var tran = Utility.Database.BeginDbTransaction(); StringBuilder strSql = new StringBuilder(); try { string id = ComClass.GetGuid(); B_EmailDocument emailDocucment = new B_EmailDocument(); emailDocucment.createManId = userid; emailDocucment.documentName = documentName; emailDocucment.id = id; Utility.Database.Insert<B_EmailDocument>(emailDocucment); Utility.Database.Commit(tran); return Utility.JsonResult(true, "保存成功"); } catch (Exception ex) { ComBase.Logger(ex.Message); return Utility.JsonResult(false, ex.Message, null); } }