public static JsResultObject Remove <T>(int[] arrayIds, string proName) { JsResultObject result = new JsResultObject(); int re = 0; using (ISession ise = DataBiz.CreateSession()) { try { ITransaction itx = ise.BeginTransaction(); foreach (object id in arrayIds) { try { object temp = ise.Load(typeof(T), id); ise.Delete(temp); re++; result.rowNum += 1; } catch (Exception ex) { } } itx.Commit(); result = ResultUtil.RemoveSuccess(re, proName); } catch (Exception ex) { result = ResultUtil.RemoveError("", ex.InnerException.ToString()); } } return(result); }
public static DataBiz GetInstant() { if (Instant == null) { lock (lockHelper) { if (Instant == null) { Instant = new DataBiz(); } } } return(Instant); }
public static DataBiz GetInstant() { if (Instant == null) { lock (lockHelper) { if (Instant == null) { Instant = new DataBiz(); } } } return Instant; }
public static JsResultObject Save(BaseModel obj, string proName) { JsResultObject result = new JsResultObject(); using (ISession ise = DataBiz.CreateSession()) { try { ITransaction itx = ise.BeginTransaction(); ise.Save(obj); itx.Commit(); result = ResultUtil.SaveSuccess(1, proName); result.rowNum += 1; } catch (Exception ex) { result = ResultUtil.SaveError("", ex.InnerException.ToString()); } } return(result); }
public static JsResultObject Delete(BaseModel model, string proName) { JsResultObject result = new JsResultObject(); int re = 0; using (ISession ise = DataBiz.CreateSession()) { try { ITransaction itx = ise.BeginTransaction(); ise.Delete(model); re++; itx.Commit(); result = ResultUtil.RemoveSuccess(re, proName); result.rowNum += 1; } catch (Exception ex) { result = ResultUtil.RemoveError("", ex.InnerException.ToString()); } } return(result); }