Ejemplo n.º 1
0
 public List<Maticsoft.Model.Shop.Products.SKUMemberPrice> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Shop.Products.SKUMemberPrice> list = new List<Maticsoft.Model.Shop.Products.SKUMemberPrice>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Shop.Products.SKUMemberPrice item = new Maticsoft.Model.Shop.Products.SKUMemberPrice();
             if ((dt.Rows[i]["SkuId"] != null) && (dt.Rows[i]["SkuId"].ToString() != ""))
             {
                 item.SkuId = long.Parse(dt.Rows[i]["SkuId"].ToString());
             }
             if ((dt.Rows[i]["GradeId"] != null) && (dt.Rows[i]["GradeId"].ToString() != ""))
             {
                 item.GradeId = int.Parse(dt.Rows[i]["GradeId"].ToString());
             }
             if ((dt.Rows[i]["MemberSalePrice"] != null) && (dt.Rows[i]["MemberSalePrice"].ToString() != ""))
             {
                 item.MemberSalePrice = decimal.Parse(dt.Rows[i]["MemberSalePrice"].ToString());
             }
             list.Add(item);
         }
     }
     return list;
 }
Ejemplo n.º 2
0
 public Maticsoft.Model.Shop.Products.SKUMemberPrice GetModel(long SkuId, int GradeId)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("SELECT  TOP 1 SkuId,GradeId,MemberSalePrice FROM Shop_SKUMemberPrice ");
     builder.Append(" WHERE SkuId=@SkuId and GradeId=@GradeId ");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SkuId", SqlDbType.BigInt, 8), new SqlParameter("@GradeId", SqlDbType.Int, 4) };
     cmdParms[0].Value = SkuId;
     cmdParms[1].Value = GradeId;
     Maticsoft.Model.Shop.Products.SKUMemberPrice price = new Maticsoft.Model.Shop.Products.SKUMemberPrice();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if ((set.Tables[0].Rows[0]["SkuId"] != null) && (set.Tables[0].Rows[0]["SkuId"].ToString() != ""))
     {
         price.SkuId = long.Parse(set.Tables[0].Rows[0]["SkuId"].ToString());
     }
     if ((set.Tables[0].Rows[0]["GradeId"] != null) && (set.Tables[0].Rows[0]["GradeId"].ToString() != ""))
     {
         price.GradeId = int.Parse(set.Tables[0].Rows[0]["GradeId"].ToString());
     }
     if ((set.Tables[0].Rows[0]["MemberSalePrice"] != null) && (set.Tables[0].Rows[0]["MemberSalePrice"].ToString() != ""))
     {
         price.MemberSalePrice = decimal.Parse(set.Tables[0].Rows[0]["MemberSalePrice"].ToString());
     }
     return price;
 }