/// <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); } }