public void add(WxPublicPlatformModel model) { SqlConnection cn = null; SqlTransaction tc = null; try { cn = DbHelperSQL.getConnection(); tc = DbHelperSQL.startTransaction(cn); dal.add(cn, tc, model); DbCacheHelper.UpdateCache<WXTemplateSettingDto>("WXTemplateSettingV", cn, tc); DbHelperSQL.commitTransaction(tc); } catch (SqlException ex) { DbHelperSQL.rollBackTransaction(tc); throw new MakeException(ExpSort.数据库, ex.Message); } finally { DbHelperSQL.closeConnection(cn); } }
public bool updata(SqlConnection cn, SqlTransaction tc, WxPublicPlatformModel model) { return DbHelperSQL.updateModel<WxPublicPlatformModel>(model, "WxPublicPlatform", "Evenid", model.Evenid.ToString(), "'", cn, tc); }
public bool add(SqlConnection cn, SqlTransaction tc, WxPublicPlatformModel model) { return DbHelperSQL.insertModel<WxPublicPlatformModel>(model, "WxPublicPlatform", cn, tc); }
private void getRequestData() { int rowCount = int.Parse(this.RowCount.Value.Trim()); this.wxPublicPlatformDtlInfoList = new List<WxPublicPlatformModel>(); this.upwxPublicPlatformDtlInfoList = new List<WxPublicPlatformModel>(); for (int i = 1; i <= rowCount; i++) { if (MakeUtil.getStringFromRequestByName(Request, "Evenid", i) == "" && MakeUtil.getStringFromRequestByName(Request, "UrlString", i).Length > 0) { WxPublicPlatformModel codm = new WxPublicPlatformModel(); codm = MakeUtil.getRequestDataToModel<WxPublicPlatformModel>(Request, typeof (WxPublicPlatformModel), i); this.wxPublicPlatformDtlInfoList.Add(codm); } else if (MakeUtil.getStringFromRequestByName(Request, "Evenid", i).Length > 0) { WxPublicPlatformModel upcodm = new WxPublicPlatformModel(); upcodm = MakeUtil.getRequestDataToModel<WxPublicPlatformModel>(Request, typeof (WxPublicPlatformModel), i); //upcodm.Evenid = Convert.ToInt32(MakeUtil.getStringFromRequestByName(Request, "Id", i)); this.upwxPublicPlatformDtlInfoList.Add(upcodm); } } }
public void updata(WxPublicPlatformModel model) { SqlConnection cn = null; SqlTransaction tc = null; try { cn = DbHelperSQL.getConnection(); tc = DbHelperSQL.startTransaction(cn); IList<QueryModel> qmlist = new List<QueryModel>(); qmlist.Add(MakeUtil.getQueryModel("Evenid", "'", SqlWhere.WhereOperator.Equal, model.Evenid.ToString())); if (dal.getModel(cn, tc, qmlist).Evenid <= 0) { DbHelperSQL.rollBackTransaction(tc); throw new MakeException(ExpSort.普通, "由于该资料不存在,资料将被忽略"); } dal.updata(cn, tc, model); DbCacheHelper.UpdateCache<WXTemplateSettingDto>("WXTemplateSettingV", cn, tc); DbHelperSQL.commitTransaction(tc); } catch (SqlException ex) { DbHelperSQL.rollBackTransaction(tc); throw new MakeException(ExpSort.数据库, ex.Message); } finally { DbHelperSQL.closeConnection(cn); } }
public WxPublicPlatformModel getModel(IList<QueryModel> qmlist) { SqlConnection cn = null; SqlTransaction tc = null; WxPublicPlatformModel model = new WxPublicPlatformModel(); try { cn = DbHelperSQL.getConnection(); model = dal.getModel(cn, tc, qmlist); } catch (SqlException ex) { throw new MakeException(ExpSort.数据库, ex.Message); } finally { DbHelperSQL.closeConnection(cn); } return model; }