public object GetEmailMarkByUserid(string JsonData, string userid) { var tran = Utility.Database.BeginDbTransaction(); StringBuilder strSql = new StringBuilder(); try { B_OA_Email_Mark emailMark = new B_OA_Email_Mark(); emailMark.Condition.Add("userid=" + userid); strSql.AppendFormat("select * from B_OA_Email_Mark where userid='{0}'", userid); DataSet MailDataSet = Utility.Database.ExcuteDataSet(strSql.ToString(), tran); string jsonData = JsonConvert.SerializeObject(MailDataSet.Tables[0]); List<B_OA_Email_Mark> markList = (List<B_OA_Email_Mark>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_OA_Email_Mark>)); Utility.Database.Commit(tran); return JsonConvert.SerializeObject(markList);//将对象转为json字符串并返回到客户端 } catch (Exception e) { Utility.Database.Rollback(tran); ComBase.Logger(e.Message); throw (new Exception("保存失败!", e)); } }
public string DeleteEmailMark(string id, string userid) { var tran = Utility.Database.BeginDbTransaction(); try { B_OA_Email_Mark mark = new B_OA_Email_Mark(); mark.Condition.Add("id = " + id); Utility.Database.Delete(mark, tran); Utility.Database.Commit(tran); return Utility.JsonMsg(true, "删除成功");//将对象转为json字符串并返回到客户端 } catch (Exception ex) { ComBase.Logger(ex.Message); return Utility.JsonMsg(false, ex.Message); } }
public object DeleteEmailMark(string id, string userid) { var tran = Utility.Database.BeginDbTransaction(); try { B_OA_Email_Mark mark = new B_OA_Email_Mark(); mark.Condition.Add("id = " + id); Utility.Database.Delete(mark, tran); Utility.Database.Commit(tran); return Utility.JsonMsg(true, "删除成功");//将对象转为json字符串并返回到客户端 } catch (Exception e) { Utility.Database.Rollback(tran); ComBase.Logger(e.Message); throw (new Exception("删除失败!", e)); } }
public string GetEmailMarkByUserid(string JsonData, string userid) { var tran = Utility.Database.BeginDbTransaction(); StringBuilder strSql = new StringBuilder(); try { B_OA_Email_Mark emailMark = new B_OA_Email_Mark(); emailMark.Condition.Add("userid=" + userid); strSql.AppendFormat("select * from B_OA_Email_Mark where userid='{0}'", userid); DataSet MailDataSet = Utility.Database.ExcuteDataSet(strSql.ToString(), tran); string jsonData = JsonConvert.SerializeObject(MailDataSet.Tables[0]); List<B_OA_Email_Mark> markList = (List<B_OA_Email_Mark>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_OA_Email_Mark>)); Utility.Database.Commit(tran); return Utility.JsonResult(true, "数据加载成功", markList);//将对象转为json字符串并返回到客户端 } catch (Exception ex) { ComBase.Logger(ex.Message); return Utility.JsonResult(false, ex.Message, null); } }