Hidistro.SqlDal/zbCommodities/ProductTypeDao.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Hidistro.SqlDal.zbCommodities
{
using Hidistro.Core;
using Hidistro.Core.Entities;
using Hidistro.Entities;
using Hidistro.Entities.Commodities;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
public class ProductTypeDao
{
private Database database = DatabaseFactory.CreateDatabase();
public int AddProductType(ProductTypeInfo productType)
{
DbCommand sqlStringCommand = this.database.GetSqlStringCommand(@"
declare @RoleId int ;
declare @MemberId int ;
declare @UserName nvarchar(50);
declare @ShopName nvarchar(50);
select @MemberId=MemberId,@RoleId=RoleId from aspnet_Managers where userid=@userID;
IF(@RoleId=1)
BEGIN
SET @userID=0;
END
ELSE
BEGIN
select @ShopName=StoreName from aspnet_Distributors where UserId=@MemberId;
select @UserName=UserName from aspnet_Members where UserId=@MemberId;
END;
INSERT INTO Hishop_zbProductTypes(TypeName, Remark,userid,userName,ShopName) VALUES (@TypeName, @Remark,@userid,@userName,@ShopName); SELECT @@IDENTITY");
this.database.AddInParameter(sqlStringCommand, "TypeName", DbType.String, productType.TypeName);
this.database.AddInParameter(sqlStringCommand, "Remark", DbType.String, productType.Remark);
this.database.AddInParameter(sqlStringCommand, "userID", DbType.Int32, Globals.GetCurrentManagerUserId());
object obj2 = this.database.ExecuteScalar(sqlStringCommand);
if (obj2 != null)
{
return Convert.ToInt32(obj2);
}
return 0;
}
public void AddProductTypeBrands(int typeId, IList<int> brands)
{
DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Hishop_zbProductTypeBrands(ProductTypeId,BrandId) VALUES(@ProductTypeId,@BrandId)");
this.database.AddInParameter(sqlStringCommand, "ProductTypeId", DbType.Int32, typeId);
this.database.AddInParameter(sqlStringCommand, "BrandId", DbType.Int32);
foreach (int num in brands)
{
this.database.SetParameterValue(sqlStringCommand, "BrandId", num);
this.database.ExecuteNonQuery(sqlStringCommand);
}
}
后面还有 110 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
