public Member(Hidistro.Membership.Core.Enums.UserRole userRole, HiMembershipUser membershipUser) { if ((userRole != Hidistro.Membership.Core.Enums.UserRole.Member) && (userRole != Hidistro.Membership.Core.Enums.UserRole.Underling)) { throw new Exception("UserRole must be Member or Underling"); } this.MembershipUser = membershipUser; }
public HiMembershipUser(bool isAnonymous, Hidistro.Membership.Core.Enums.UserRole userRole) { if (isAnonymous && (userRole != Hidistro.Membership.Core.Enums.UserRole.Anonymous)) { throw new Exception(string.Format("Current user is Anonymous, But the user role is '{0}'", userRole.ToString())); } this.UserRole = userRole; this.IsAnonymous = userRole == Hidistro.Membership.Core.Enums.UserRole.Anonymous; }
public override AddCartItemStatus AddLineItem(Hidistro.Membership.Context.Member member, int productId, string skuId, int quantity) { if ((member == null) || (member.UserRole != UserRole.Member)) { return AddCartItemStatus.InvalidUser; } DbCommand storedProcCommand = database.GetStoredProcCommand("ss_ShoppingCart_AddLineItem"); database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, member.UserId); database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId); database.AddInParameter(storedProcCommand, "ProductId", DbType.Int32, productId); database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity); database.ExecuteNonQuery(storedProcCommand); return AddCartItemStatus.Successed; }
internal HiApplication(string pattern, string name, Hidistro.Core.Enums.ApplicationType appType) { this._name = name.ToLower(CultureInfo.InvariantCulture); this._appType = appType; this._regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); }
public HiMembershipUser(bool isAnonymous, Hidistro.Membership.Core.Enums.UserRole userRole, MembershipUser mu) : this(isAnonymous, userRole) { this.RefreshMembershipUser(mu); }
public PrivilegeCheckAttribute(Hidistro.Entities.Store.Privilege privilege) { this.privilege = privilege; }
public CreateUserException(Hidistro.Membership.Core.Enums.CreateUserStatus status, string message, Exception inner) : base(message, inner) { this.status = status; }
public CreateUserException(Hidistro.Membership.Core.Enums.CreateUserStatus status) { this.status = status; }
public override void UpdateLineItemQuantity(Hidistro.Membership.Context.Member member, int productId, string skuId, int quantity) { DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_ShoppingCarts SET Quantity = @Quantity WHERE UserId = @UserId AND SkuId = @SkuId"); database.AddInParameter(sqlStringCommand, "Quantity", DbType.Int32, quantity); database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, member.UserId); database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, skuId); database.ExecuteNonQuery(sqlStringCommand); }
public override bool GetShoppingProductInfo(Hidistro.Membership.Context.Member member, int productId, string skuId, out ProductSaleStatus saleStatus, out int stock, out int totalQuantity) { saleStatus = ProductSaleStatus.Delete; stock = 0; totalQuantity = 0; bool flag = false; DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT Stock,SaleStatus,AlertStock FROM Hishop_Skus s INNER JOIN Hishop_Products p ON s.ProductId=p.ProductId WHERE s.ProductId=@ProductId AND s.SkuId=@SkuId;SELECT Quantity FROM Hishop_ShoppingCarts sc WHERE sc.ProductId=@ProductId AND sc.SkuId=@SkuId AND sc.UserId=@UserId"); database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productId); database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, member.UserId); database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, skuId); using (IDataReader reader = database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { saleStatus = (ProductSaleStatus)((int)reader["SaleStatus"]); stock = (int)reader["Stock"]; flag = true; } if (reader.NextResult() && reader.Read()) { totalQuantity = (int)reader["Quantity"]; } } return flag; }
public override ShoppingCartItemInfo GetCartItemInfo(Hidistro.Membership.Context.Member member, int productId, string skuId, string skuContent, int quantity, out ProductSaleStatus saleStatus, out string sku, out int stock, out int totalQuantity) { saleStatus = ProductSaleStatus.OnSale; sku = string.Empty; stock = 0; totalQuantity = quantity; ShoppingCartItemInfo info = null; DbCommand storedProcCommand = database.GetStoredProcCommand("ss_ShoppingCart_GetItemInfo"); database.AddInParameter(storedProcCommand, "ProductId", DbType.Int32, productId); database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity); database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, (member != null) ? member.UserId : 0); database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId); database.AddInParameter(storedProcCommand, "GradeId", DbType.Int32, (member != null) ? member.GradeId : 0); using (IDataReader reader = database.ExecuteReader(storedProcCommand)) { if (!reader.Read()) { return info; } saleStatus = (ProductSaleStatus)((int)reader["SaleStatus"]); if (reader["SKU"] != DBNull.Value) { sku = (string)reader["SKU"]; } stock = (int)reader["Stock"]; totalQuantity = (int)reader["TotalQuantity"]; string name = reader["ProductName"].ToString(); int categoryId = 0; if (DBNull.Value != reader["CategoryId"]) { categoryId = (int)reader["CategoryId"]; } int weight = 0; if (DBNull.Value != reader["Weight"]) { weight = (int)reader["Weight"]; } decimal memberPrice = (decimal)reader["SalePrice"]; string str2 = string.Empty; if (DBNull.Value != reader["ThumbnailUrl40"]) { str2 = reader["ThumbnailUrl40"].ToString(); } string str3 = string.Empty; if (DBNull.Value != reader["ThumbnailUrl60"]) { str3 = reader["ThumbnailUrl60"].ToString(); } string str4 = string.Empty; if (DBNull.Value != reader["ThumbnailUrl100"]) { str4 = reader["ThumbnailUrl100"].ToString(); } int purchaseGiftId = 0; int giveQuantity = 0; int wholesaleDiscountId = 0; string purchaseGiftName = null; string wholesaleDiscountName = null; decimal? discountRate = null; if (member != null) { if (reader.NextResult() && reader.Read()) { if (DBNull.Value != reader["ActivityId"]) { purchaseGiftId = (int)reader["ActivityId"]; } if (DBNull.Value != reader["Name"]) { purchaseGiftName = reader["Name"].ToString(); } if ((DBNull.Value != reader["BuyQuantity"]) && (DBNull.Value != reader["GiveQuantity"])) { giveQuantity = (totalQuantity / ((int)reader["BuyQuantity"])) * ((int)reader["GiveQuantity"]); } } if (reader.NextResult() && reader.Read()) { if (DBNull.Value != reader["ActivityId"]) { wholesaleDiscountId = (int)reader["ActivityId"]; } if (DBNull.Value != reader["Name"]) { wholesaleDiscountName = reader["Name"].ToString(); } if (DBNull.Value != reader["DiscountValue"]) { discountRate = new decimal?(Convert.ToDecimal(reader["DiscountValue"])); } } } return new ShoppingCartItemInfo(skuId, productId, sku, name, memberPrice, skuContent, totalQuantity, weight, purchaseGiftId, purchaseGiftName, giveQuantity, wholesaleDiscountId, wholesaleDiscountName, discountRate, categoryId, str2, str2, str4); } }
public override ShoppingCartItemInfo GetCartItemInfo(Hidistro.Membership.Context.Member member, int productId, string skuId, int quantity) { string sku = string.Empty; int num = quantity; ShoppingCartItemInfo info = null; DbCommand storedProcCommand = database.GetStoredProcCommand("ss_ShoppingCart_GetItemInfo"); database.AddInParameter(storedProcCommand, "ProductId", DbType.Int32, productId); database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity); database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, (member != null) ? member.UserId : 0); database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId); database.AddInParameter(storedProcCommand, "GradeId", DbType.Int32, (member != null) ? member.GradeId : 0); using (IDataReader reader = database.ExecuteReader(storedProcCommand)) { if (!reader.Read()) { return info; } if (reader["SKU"] != DBNull.Value) { sku = (string)reader["SKU"]; } num = (int)reader["TotalQuantity"]; string name = reader["ProductName"].ToString(); int categoryId = 0; if (DBNull.Value != reader["CategoryId"]) { categoryId = (int)reader["CategoryId"]; } int weight = 0; if (DBNull.Value != reader["Weight"]) { weight = (int)reader["Weight"]; } decimal memberPrice = (decimal)reader["SalePrice"]; string str3 = string.Empty; if (DBNull.Value != reader["ThumbnailUrl40"]) { str3 = reader["ThumbnailUrl40"].ToString(); } string str4 = string.Empty; if (DBNull.Value != reader["ThumbnailUrl60"]) { str4 = reader["ThumbnailUrl60"].ToString(); } string str5 = string.Empty; if (DBNull.Value != reader["ThumbnailUrl100"]) { str5 = reader["ThumbnailUrl100"].ToString(); } int purchaseGiftId = 0; int giveQuantity = 0; int wholesaleDiscountId = 0; string purchaseGiftName = null; string wholesaleDiscountName = null; decimal? discountRate = null; if (member != null) { if (reader.NextResult() && reader.Read()) { if (DBNull.Value != reader["ActivityId"]) { purchaseGiftId = (int)reader["ActivityId"]; } if (DBNull.Value != reader["Name"]) { purchaseGiftName = reader["Name"].ToString(); } if ((DBNull.Value != reader["BuyQuantity"]) && (DBNull.Value != reader["GiveQuantity"])) { giveQuantity = (num / ((int)reader["BuyQuantity"])) * ((int)reader["GiveQuantity"]); } } if (reader.NextResult() && reader.Read()) { if (DBNull.Value != reader["ActivityId"]) { wholesaleDiscountId = (int)reader["ActivityId"]; } if (DBNull.Value != reader["Name"]) { wholesaleDiscountName = reader["Name"].ToString(); } if (DBNull.Value != reader["DiscountValue"]) { discountRate = new decimal?(Convert.ToDecimal(reader["DiscountValue"])); } } } string skuContent = string.Empty; if (reader.NextResult()) { while (reader.Read()) { if (!((((reader["AttributeName"] == DBNull.Value) || string.IsNullOrEmpty((string)reader["AttributeName"])) || (reader["ValueStr"] == DBNull.Value)) || string.IsNullOrEmpty((string)reader["ValueStr"]))) { object obj2 = skuContent; skuContent = string.Concat(new object[] { obj2, reader["AttributeName"], ":", reader["ValueStr"], "; " }); } } } return new ShoppingCartItemInfo(skuId, productId, sku, name, memberPrice, skuContent, num, weight, purchaseGiftId, purchaseGiftName, giveQuantity, wholesaleDiscountId, wholesaleDiscountName, discountRate, categoryId, str3, str3, str5); } }