private UserInfo userInfoAudit(UserInfo u) { u.Auidt(); int id = u.Id; Hashtable ht = new Hashtable(); ht["id"] = u.Id; IList <iBatisStatement> il = new List <iBatisStatement>(); il.Add(new iBatisStatement { StatementName = "UserInfo.update_UserInfoOne", ParameterObject = u, Type = SqlExecuteType.UPDATE }); il.Add(new iBatisStatement { StatementName = "UserInfo.auditSP", ParameterObject = ht, Type = SqlExecuteType.INSERT }); try { BuilderFactory.Default().ExecuteBatch(il); //SqlAdapter.ExecuteBatch(il); } catch (Exception ex) { throw ex; } return(u); }
public int PostUser(UserInfo userInfo) { Hashtable ht = new Hashtable(); ht["DjName"] = "userinfo"; ht["DjLsh"] = 0; this.GetDjlsh(ht); userInfo.Id = (int)ht["DjLsh"]; IList <iBatisStatement> il = new List <iBatisStatement>(); il.Add(new iBatisStatement { StatementName = "UserInfo.insert_UserInfoOne", ParameterObject = userInfo, Type = SqlExecuteType.INSERT }); for (int i = 0; i < userInfo.Cards.Count; i++) { il.Add(new iBatisStatement { StatementName = "Card.insert_CardOne", ParameterObject = userInfo.Cards[i], Type = SqlExecuteType.INSERT }); } ; try { BuilderFactory.Default().ExecuteBatch(il); //SqlAdapter.ExecuteBatch(il); } catch (Exception ex) { throw ex; } return(1); }
public void UserInfoItemInsertOne(UserInfoItem userInfoItem) { IList <iBatisStatement> il = new List <iBatisStatement>(); il.Add(new iBatisStatement { StatementName = "UserInfoItem.insert_UserInfoItem", ParameterObject = userInfoItem, Type = SqlExecuteType.INSERT }); BuilderFactory.Default().ExecuteBatch(il); //SqlAdapter.ExecuteBatch(il); }
public UserInfo UserInfoEdit(UserInfo userInfo) { //Object obj = Mapper.GetMaper.Insert("UserInfo.insert_UserInfoOne", userInfo); //****转SqlAdapter调用,不直接调用Mapper IList <iBatisStatement> il = new List <iBatisStatement>(); Hashtable ht = new Hashtable(); ht["DjName"] = "userinfo"; ht["DjLsh"] = 0; if (userInfo.Id == 0) { this.GetDjlsh(ht); userInfo.Id = (int)ht["DjLsh"]; il.Add(new iBatisStatement { StatementName = "UserInfo.insert_UserInfoOne", ParameterObject = userInfo, Type = SqlExecuteType.INSERT }); } else { ht["DjLsh"] = userInfo.Id; il.Add(new iBatisStatement { StatementName = "UserInfo.update_UserInfoOne", ParameterObject = userInfo, Type = SqlExecuteType.UPDATE }); il.Add(new iBatisStatement { StatementName = "Card.deleteCardBysUserid", ParameterObject = userInfo, Type = SqlExecuteType.DELETE }); } for (int i = 0; i < userInfo.Cards.Count; i++) { il.Add(new iBatisStatement { StatementName = "Card.insert_CardOne", ParameterObject = userInfo.Cards[i], Type = SqlExecuteType.INSERT }); } ; try { BuilderFactory.Default().ExecuteBatch(il); //SqlAdapter.ExecuteBatch(il); } catch (Exception ex) { throw ex; } //return (int)ht["DjLsh"] int id = (int)ht["DjLsh"]; return(this.GetUserInfo2(id)); }
public void UserInsert(UserInfo userInfo) { Card card1 = new Card(); card1.CardName = "card1"; Card card2 = new Card(); card2.CardName = "card2"; List <Card> cards = new List <Card>() { card1, card2 }; Hashtable ht = new Hashtable(); ht["DjName"] = "userinfo"; ht["DjLsh"] = 0; uss.GetDjlsh(ht);//调用sp产生 djlsh IList <iBatisStatement> ibs = new List <iBatisStatement>(); ibs.Add(new iBatisStatement() { StatementName = "UserInfo.insert_UserInfoOne", ParameterObject = userInfo, Type = SqlExecuteType.INSERT }); ibs.Add(new iBatisStatement { StatementName = "Card.insert_CardOne", ParameterObject = card1, Type = SqlExecuteType.INSERT }); ibs.Add(new iBatisStatement { StatementName = "Card.insert_CardOne", ParameterObject = card2, Type = SqlExecuteType.INSERT }); BuilderFactory.Default().ExecuteBatch(ibs);//事务批处理sql语句 }
public IList <Hashtable> GetUserInfoListHash() { //return SqlAdapter.ExecuteQueryForList<Hashtable>("UserInfo.select_UserInfoAll_Hash", null); return(BuilderFactory.Default().ExecuteQueryForList <Hashtable>("UserInfo.select_UserInfoAll_Hash", null)); //return Mapper.GetMaper.QueryForList<Hashtable>("UserInfo.select_UserInfoAll_Hash", null); }