public int AddOreder(Order or) { or.OID = RandomID.GetRandomID("O"); using (IDbConnection conn = new SqlConnection(sqlconnstr)) { conn.Open(); return(conn.Execute(@"insert orders(OID,GID,UID,AID,SID,OCount,OCoordersmment) values(@OID,@GID,@UID,@AID,@SID,@OCount,@OCoordersmment)", new { OID = or.OID, GID = or.GID, UID = or.UID, AID = or.AID, SID = or.SID, OCount = or.OCount, OCoordersmment = or.OCoordersmment })); } }
public int AddShoppingCar(ShoppingCar car) { car.SID = RandomID.GetRandomID("S"); using (IDbConnection conn = new SqlConnection(sqlconnstr)) { conn.Open(); return(conn.Execute("insert shoppingcar(GID,UID,SID,SCount,SPay) values(@GID,@UID,@SID,@SCount,@SPay)", new { GID = car.GID, UID = car.UID, SID = car.SID, SCount = car.SCount, SPay = car.SPay })); } }
public int AddAddress(Address adr) { adr.AID = RandomID.GetRandomID("A"); using (IDbConnection conn = new SqlConnection(sqlconnstr)) { conn.Open(); return(conn.Execute(@"insert Address(AID,UID,AName,APhone,AAddress,APostalCode) values(@AID,@UID,@AName,@APhone,@AAddress,@APostalCode)", new { AID = adr.AID, UID = adr.UID, AName = adr.AName, APhone = adr.APhone, AAddress = adr.AAddress, b = adr.APostalCode })); } }
public int InsertUser(string name, string phone, string email, string password) { string uid = RandomID.GetRandomID("U"); string token = RandomID.GetRandomID("T"); using (SqlConnection conn = new SqlConnection(sqlconnstr)) { conn.Open(); return(conn.Execute(@"insert users(UID,UName,UPassword,UPhone,UEMail,UToken) values(@UID,@UName,@UPassword,@UPhone,@UEMail,@UToken)", new { UID = uid, UName = name, UPassword = password, UPhone = phone, UEMail = email, UToken = token })); } }
//static string sqlconnstr = ConfigurationManager.ConnectionStrings["loginsql"].ConnectionString; public string AddSinglePay(SinglePay sin) { sin.SID = RandomID.GetRandomID("S"); sin.CreateTime = DateTime.Now; //adr.AID = RandomID.GetRandomID("A"); using (IDbConnection conn = new SqlConnection(sqlconnstr)) { conn.Open(); conn.Execute(@"insert singlebuy(openid,GID,Gcount,createtime,sid) values(@openid,@GID,@Gcount,@createtime,@sid)", new { openid = sin.OpenID, GID = sin.GID, Gcount = sin.GCount, createtime = sin.CreateTime, sid = sin.SID }); return(sin.SID); } }
// static string sqlconnstr = ConfigurationManager.ConnectionStrings["loginsql"].ConnectionString; public string AddCartOrder(CartOrder co) { co.COID = RandomID.GetRandomID("CO"); co.CreateTime = DateTime.Now; co.GLID = RandomID.GetRandomID("GL"); using (IDbConnection conn = new SqlConnection(sqlconnstr)) { conn.Open(); conn.Execute(@"insert cartorder(openid,coid,createtime,glid) values(@openid,@coid,@createtime,@glid)", new { @openid = co.Openid, @coid = co.COID, @createtime = co.CreateTime, @glid = co.GLID }); } return(co.GLID); }