/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.v_ProductColor GetModel(long ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,pid,ColorCode,ColorName,CBarginPriceOut,CStandardPriceIn,CTagPrice,CReferencePriceA,CReferencePriceB,CReferencePriceC,CReferencePriceD,CReferencePriceE,CReferencePriceF,member,PCode,PName,SeriesID,TypeID,Manufacturer from v_ProductColor "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.BigInt, 8) }; parameters[0].Value = ID; Maticsoft.Model.v_ProductColor model = new Maticsoft.Model.v_ProductColor(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.v_ProductColor DataRowToModel(DataRow row) { Maticsoft.Model.v_ProductColor model = new Maticsoft.Model.v_ProductColor(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = long.Parse(row["ID"].ToString()); } if (row["pid"] != null && row["pid"].ToString() != "") { model.pid = long.Parse(row["pid"].ToString()); } if (row["ColorCode"] != null) { model.ColorCode = row["ColorCode"].ToString(); } if (row["ColorName"] != null) { model.ColorName = row["ColorName"].ToString(); } if (row["CBarginPriceOut"] != null && row["CBarginPriceOut"].ToString() != "") { model.CBarginPriceOut = decimal.Parse(row["CBarginPriceOut"].ToString()); } if (row["CStandardPriceIn"] != null && row["CStandardPriceIn"].ToString() != "") { model.CStandardPriceIn = decimal.Parse(row["CStandardPriceIn"].ToString()); } if (row["CTagPrice"] != null && row["CTagPrice"].ToString() != "") { model.CTagPrice = decimal.Parse(row["CTagPrice"].ToString()); } if (row["CReferencePriceA"] != null && row["CReferencePriceA"].ToString() != "") { model.CReferencePriceA = decimal.Parse(row["CReferencePriceA"].ToString()); } if (row["CReferencePriceB"] != null && row["CReferencePriceB"].ToString() != "") { model.CReferencePriceB = decimal.Parse(row["CReferencePriceB"].ToString()); } if (row["CReferencePriceC"] != null && row["CReferencePriceC"].ToString() != "") { model.CReferencePriceC = decimal.Parse(row["CReferencePriceC"].ToString()); } if (row["CReferencePriceD"] != null && row["CReferencePriceD"].ToString() != "") { model.CReferencePriceD = decimal.Parse(row["CReferencePriceD"].ToString()); } if (row["CReferencePriceE"] != null && row["CReferencePriceE"].ToString() != "") { model.CReferencePriceE = decimal.Parse(row["CReferencePriceE"].ToString()); } if (row["CReferencePriceF"] != null && row["CReferencePriceF"].ToString() != "") { model.CReferencePriceF = decimal.Parse(row["CReferencePriceF"].ToString()); } if (row["member"] != null) { model.member = row["member"].ToString(); } if (row["PCode"] != null) { model.PCode = row["PCode"].ToString(); } if (row["PName"] != null) { model.PName = row["PName"].ToString(); } if (row["SeriesID"] != null && row["SeriesID"].ToString() != "") { model.SeriesID = long.Parse(row["SeriesID"].ToString()); } if (row["TypeID"] != null && row["TypeID"].ToString() != "") { model.TypeID = long.Parse(row["TypeID"].ToString()); } if (row["Manufacturer"] != null) { model.Manufacturer = row["Manufacturer"].ToString(); } } return(model); }