/// <summary> /// 订单中用户信息 /// </summary> /// <returns>用户对象列表</returns> public List <StoreUser> ConfrimOrder() { List <StoreUser> ConfirmInfo = new List <StoreUser>(); StoreUser user = new StoreUser(); user.UserName = this.UserName; string[] userInfo = new string[6]; int lCount = 0; int lUserID = StoreUser.UserNameGetID(user); string trueName = "select TrueName from StoreUser where UserID=N'" + lUserID + "'"; string phone = "select Phone from UserInfo where UserID='" + lUserID + "'"; string address = "select Address,IsDefault from ShipAddress where UserID=N'" + lUserID + "'"; SqlHelper.ReadDateReadBegin(address); while (SqlHelper.SqlReader.Read()) { userInfo[lCount] = SqlHelper.SqlReader[0].ToString(); userInfo[lCount + 3] = SqlHelper.SqlReader[1].ToString(); lCount++; } SqlHelper.ReadDateReadEnd(); StoreUser ConfirmOrderInfo = new StoreUser(); ConfirmOrderInfo.Phone = SqlHelper.ReadSclar(phone).ToString(); ConfirmOrderInfo.UserTrueName = SqlHelper.ReadSclar(trueName).ToString(); ConfirmOrderInfo.Address1 = userInfo[0]; ConfirmOrderInfo.Address2 = userInfo[1]; ConfirmOrderInfo.Address3 = userInfo[2]; ConfirmOrderInfo.IsDafult1 = userInfo[3]; ConfirmOrderInfo.IsDafult2 = userInfo[4]; ConfirmOrderInfo.IsDafult3 = userInfo[5]; ConfirmInfo.Add(ConfirmOrderInfo); return(ConfirmInfo); }
/// <summary> /// 对订单的修改 /// </summary> /// <returns></returns> public bool AlterOrderStatus(SaveOrders alter) { string sqlstring = "update Orders set TradeStatus ='" + alter.TradeStatus + "'" + "where OrderID='" + alter.OrderID + "'" + ";update SaveOrders set TradeStatus ='" + alter.TradeStatus + "'" + "where OrderID='" + alter.OrderID + "'" + ";update SaveOrders set IsDeal ='" + alter.IsDeal + "'" + "where OrderID='" + alter.OrderID + "'" + ";update Orders set IsDeal ='" + alter.IsDeal + "'" + "where OrderID='" + alter.OrderID + "'" + ";update SaveOrders set StaffID='" + alter.StaffID + "'" + "where OrderID='" + alter.OrderID + "'" + ";update Orders set StaffID='" + alter.StaffID + "'" + "where OrderID='" + alter.OrderID + "'"; string sqlstring2 = "select UserInfo.MoneySum from StoreUser left join UserInfo on UserInfo.UserID=StoreUser.UserID where UserName='******'"; StoreUser mStore = new StoreUser(); mStore.UserName = alter.ReceiveStr; int TempUserID = StoreUser.UserNameGetID(mStore); int Money = Convert.ToInt32(SqlHelper.ReadSclar(sqlstring2)) + Convert.ToInt32(alter.TotalPrices); string sqlstring3 = "update UserInfo set MoneySum ='" + Money + "'" + "where UserID='" + TempUserID + "'"; if (alter.TradeStatus == '3' && alter.Number != 0) { string sqlstring4 = "select Good.SalesVolume from SaveOrders left join SaveSingleGoodInfo on SaveOrders.SingleGoodID=SaveSingleGoodInfo.SingleGoodID left join Good on SaveSingleGoodInfo.GoodID=Good.GoodID where OrderID='" + alter.OrderID + "'"; string sqlstring5 = "select GoodID from SaveOrders left join SaveSingleGoodInfo on SaveOrders.SingleGoodID=SaveSingleGoodInfo.SingleGoodID where OrderID='" + alter.OrderID + "'"; int SalesVolume = (Convert.ToInt32(SqlHelper.ReadSclar(sqlstring4)) + alter.Number); int GoodID = Convert.ToInt32(SqlHelper.ReadSclar(sqlstring5)); string sqlstring6 = "update Good set SalesVolume='" + SalesVolume + "'" + " where GoodID='" + GoodID + "'"; string sqlstring8 = "select Good.GoodIncentory from SaveOrders left join SaveSingleGoodInfo on SaveOrders.SingleGoodID=SaveSingleGoodInfo.SingleGoodID left join Good on SaveSingleGoodInfo.GoodID=Good.GoodID where OrderID='" + alter.OrderID + "'"; int GoodIncentory = (Convert.ToInt32(SqlHelper.ReadSclar(sqlstring8)) - alter.Number); string sqlstring7 = "update Good set GoodIncentory='" + GoodIncentory + "'" + " where GoodID='" + GoodID + "'"; SingleGoodInfo mSingleGoodInfo = new SingleGoodInfo(); mSingleGoodInfo.SingleGoodID = alter.SingleGoodID; int TempGoodID = SingleGoodInfo.SingleGoodIDGetGood(mSingleGoodInfo); string sqlstring1 = "delete top(" + alter.Number + ") from SaveSingleGoodInfo where GoodID='" + TempGoodID + "'"; if (SqlHelper.ExecuteNonQuery(sqlstring) > 0 && SqlHelper.ExecuteNonQuery(sqlstring1) > 0 && SqlHelper.ExecuteNonQuery(sqlstring3) > 0 && SqlHelper.ExecuteNonQuery(sqlstring6) > 0 && SqlHelper.ExecuteNonQuery(sqlstring7) > 0) { return(true); } else { return(false); } } else { if (SqlHelper.ExecuteNonQuery(sqlstring) > 0) { return(true); } else { return(false); } } }
/// <summary> /// 判断删除用户信息时是否将其完全删除 /// </summary> /// <returns></returns> public bool DeleteUserInfo() { string yUserName = this.UserName; StoreUser mSU = new StoreUser(); mSU.UserName = yUserName; int TempUserID = StoreUser.UserNameGetID(mSU); string Sqlstring = "delete from ShipAddress where UserID='" + TempUserID + "'" + ";delete from UserInfo where UserID='" + TempUserID + "'" + ";delete from StoreUser where UserName='******'"; int temp1 = SqlHelper.ExecuteNonQuery(Sqlstring); if (temp1 > 0) { return(true); } else { return(false); } }
/// <summary> /// 创建用户 /// </summary> /// <returns>是否成功</returns> public bool CreateStoreUser() { StringBuilder lSqlstring = new StringBuilder(); lSqlstring.Append("insert into StoreUser(UserName,PassWord,Email,UserType,IsConfirm,RegistTime,IdCardNum,TrueName)"); lSqlstring.Append("values("); lSqlstring.Append("'" + this.UserName + "',"); lSqlstring.Append("'" + this.PassWord + "',"); lSqlstring.Append("'" + this.Email + "',"); lSqlstring.Append("'0',"); lSqlstring.Append("'0',"); lSqlstring.Append("getdate(),"); lSqlstring.Append("'" + this.IdCardNum + "',"); lSqlstring.Append("N'" + this.UserTrueName + "'"); lSqlstring.Append(")"); if (SqlHelper.ExecuteNonQuery(lSqlstring.ToString()) > 0) { int lUserID = StoreUser.UserNameGetID(this); string lSqlUserInfo = "insert into UserInfo(UserID,UserPicture,NickName,Sex,Age,Phone,QQ,MoneySum) values('" + lUserID + "','','','',0,'','',0) "; string lSqlShipAddress1 = "insert into ShipAddress(UserID,Address,IsDefault) values('" + lUserID + "','','0');"; string lSqlShipAddress2 = "insert into ShipAddress(UserID,Address,IsDefault) values('" + lUserID + "','','0');"; string lSqlShipAddress3 = "insert into ShipAddress(UserID,Address,IsDefault) values('" + lUserID + "','','0');"; if (SqlHelper.ExecuteNonQuery(lSqlUserInfo) > 0 && SqlHelper.ExecuteNonQuery(lSqlShipAddress1) > 0 && SqlHelper.ExecuteNonQuery(lSqlShipAddress2) > 0 && SqlHelper.ExecuteNonQuery(lSqlShipAddress3) > 0) { return(true); } else { return(false); } } else { return(false); } }