public int InsertNewComm(string name, string brand, string pic, double price, double proprice, string intro, string desc, int colum, string detail, int reper) { string sql = $"insert into Commodity (Sort,Name, Brand,Picture,Price,ProPrice,Introduce,Describe,detail,Repertory,Colum) values(1,'{name}','{brand}','{pic}',{price},{proprice},'{intro}','{desc}','{detail}','{reper}',{colum})"; return(SqlHelper.ExNonQuery(sql)); }
/// <summary> /// 修改默认地址 /// </summary> /// <returns></returns> public int UpdateAddress(int type, string uname, int id) { string sql = $"update address set type='{type}' where uname='{uname}' and id='{id}' "; return(SqlHelper.ExNonQuery(sql)); }
public int UpdateType() { string sql = $"update address set type=1 where type=0"; return(SqlHelper.ExNonQuery(sql)); }
/// <summary> /// 添加收货地址 /// </summary> /// <param name="pro"></param> /// <param name="city"></param> /// <param name="county"></param> /// <param name="details"></param> /// <param name="name"></param> /// <param name="uname"></param> /// <param name="type"></param> /// <param name="tel"></param> /// <returns></returns> public int AddAddress(string pro, string city, string county, string details, string name, string uname, int type, string tel) { string sql = $"insert into address(province,city,county,details,name,uname,type,tel) values('{pro}','{city}','{county}','{details}','{name}','{uname}','{type}','{tel}')"; return(SqlHelper.ExNonQuery(sql)); }
/// <summary> /// 删除地址 /// </summary> /// <param name="id"></param> /// <param name="uname"></param> /// <returns></returns> public int DelAddress(int id, string uname) { string sql = $"Delete address where id={id} and uname='{uname}'"; return(SqlHelper.ExNonQuery(sql)); }
//清空购物车 public int DelCar(string uid) { string sql = $"delete Shoppingcart where username='******'"; return(SqlHelper.ExNonQuery(sql)); }
//修改订单状态 public int UpdateOrder(string uid, string ordernum, string type) { string sql = $"update orders set type='{type}' where uid='{uid}' and orderNum='{ordernum}'"; return(SqlHelper.ExNonQuery(sql)); }
public int UpPwd(string name, string yuan, string newpwd) { string sql = $"update Users set password='******' where username='******' and password='******'"; return(SqlHelper.ExNonQuery(sql)); }
public int DelUser(string uname) { string sql = $"delete Users where username='******'"; return(SqlHelper.ExNonQuery(sql)); }
public int InsertUser(string user, string pwd, string phone, string email) { string sql = $"insert into Users (username,password,Phone,Email,UserLevel) values('{user}','{pwd}','{phone}','{email}',1)"; return(SqlHelper.ExNonQuery(sql)); }
public int UpdateUserInfo(string name, string phone, string email, string yuan) { string sql = $"update Users set username='******',Phone='{phone}',Email ='{email}' where username='******'"; return(SqlHelper.ExNonQuery(sql)); }
/// <summary> /// 根据用户名删除所有商品 /// </summary> /// <param name="username"></param> /// <returns></returns> public int DelShopCart(string username) { string sql = $"delete Shoppingcart where UserName='******'"; return(SqlHelper.ExNonQuery(sql)); }
/// <summary> /// 多次添加相同商品更改数量 /// </summary> /// <param name="id"></param> /// <param name="username"></param> /// <returns></returns> public int UpShopCartCount(string id, string username) { string sql = $"update Shoppingcart set Count+=1 where UserName='******' and Pid='{id}'"; return(SqlHelper.ExNonQuery(sql)); }
/// <summary> ///添加到购物车 /// </summary> /// <param name="Uname"></param> /// <param name="Pid"></param> /// <param name="Count"></param> /// <param name="Color"></param> /// <returns></returns> public int InsertShopCart(string Uname, string Pid, string Count, string Color) { string sql = $"insert into Shoppingcart (UserName,Pid,Count,Color) values('{Uname}','{Pid}','{Count}','{Color}')"; return(SqlHelper.ExNonQuery(sql, Uname, Pid, Count, Color)); }
public int UpdateComm(string name, string brand, string pic, double price, double proprice, string intro, string desc, int colum, string detail, int reper, int pid) { string sql = $"update Commodity set Name='{name}',Brand='{brand}',Picture='{pic}',Price='{price}',ProPrice='{proprice}',Introduce='{intro}',Describe='{desc}',detail='{detail}',Sort='1',Colum='{colum}',Repertory='{reper}' where id={pid}"; return(SqlHelper.ExNonQuery(sql)); }
//删除订单 public int DeleteOrder(string uid, string ordernum) { string sql = $"delete orders where uid='{uid}' and orderNum='{ordernum}'"; return(SqlHelper.ExNonQuery(sql)); }
public int DelComm(int pid) { string sql = $"delete Commodity where id={pid}"; return(SqlHelper.ExNonQuery(sql)); }
//添加到订单 public int InsertToOrder(string uid, int pid, string ordernum, int num, string type, int addressid) { string sql = $"insert into orders(uid,pid,orderNum,num,type,address) values('{uid}',{pid},'{ordernum}',{num},'{type}','{addressid}')"; return(SqlHelper.ExNonQuery(sql)); }