本文整理汇总了C#中IProduct.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IProduct.GetProperty方法的具体用法?C# IProduct.GetProperty怎么用?C# IProduct.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProduct
的用法示例。
在下文中一共展示了IProduct.GetProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
/// <summary>
///
/// </summary>
/// <param name="session"></param>
/// <param name="product"></param>
/// <param name="mb"></param>
/// <param name="delivery"></param>
/// <param name="part"></param>
/// <param name="name"></param>
/// <param name="spliter"></param>
/// <returns></returns>
public static string GetValue(Session session,
IProduct product,
IMB mb,
Delivery delivery,
IPart part,
string name, char spliter)
{
int index = name.IndexOf(spliter);
if (index < 1)
{
throw new Exception("wrong method name : " + name);
}
string objName = name.Substring(0, index).ToUpper();
string objMethod = name.Substring(index + 1).Trim();
if (objName == "PRODUCTINFO")
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "ProductInfo" });
}
return product.ProductInfoes
.Where(x => x.InfoType == objMethod)
.Select(y => y.InfoValue).FirstOrDefault();
}
if (objName == "MODELINFO")
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
return product.ModelObj.Attributes
.Where(x => x.Name == objMethod)
.Select(y => y.Value).FirstOrDefault();
}
if (objName == "FAMILYINFO")
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
string family = product.Family;
IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod });
if (familyInfoList == null || familyInfoList.Count == 0)
{
throw new FisException("CHK1036", new List<string> { family, objMethod });
}
return familyInfoList[0].value;
}
if (objName == "PRODUCT")
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
string value = (string)product.GetProperty(objMethod);
if (string.IsNullOrEmpty(value))
{
throw new FisException("not exists property name:" + name);
}
return value;
}
if (objName == "PCB")
{
if (mb == null)
{
throw new FisException("CQCHK0006", new List<string> { "PCB" });
}
string value = (string)mb.GetProperty(objMethod);
if (string.IsNullOrEmpty(value))
{
throw new FisException("not exists property name:" + name);
}
return value;
}
if (objName == "PCBINFO")
{
if (mb == null)
{
throw new FisException("CQCHK0006", new List<string> { "PCB" });
//.........这里部分代码省略.........
示例2: GetValue
/// <summary>
///
/// </summary>
/// <param name="product"></param>
/// <param name="mb"></param>
/// <param name="delivery"></param>
/// <param name="part"></param>
/// <param name="name"></param>
/// <param name="spliter"></param>
/// <returns></returns>
public static string GetValue(IProduct product, IMB mb, Delivery delivery, Part part,
string name, char spliter)
{
int index = name.IndexOf(spliter);
if (index < 1)
{
throw new Exception("wrong method name : " + name);
}
string objName = name.Substring(0, index).ToUpper();
string objMethod = name.Substring(index + 1).Trim();
if (objName == GlobalConstName.ResolveValue.PRODUCTINFO)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
if (product.ProductInfoes == null ||
!product.ProductInfoes.Any(x => x.InfoType == objMethod))
{
throw new FisException("CHK1036", new List<string> { product.ProId, name });
}
return product.ProductInfoes
.Where(x => x.InfoType == objMethod)
.Select(y => y.InfoValue).FirstOrDefault().Trim();
}
if (objName == GlobalConstName.ResolveValue.PRODUCTATTR)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
if (product.ProductAttributes == null ||
!product.ProductAttributes.Any(x => x.AttributeName == objMethod))
{
throw new FisException("CHK1036", new List<string> { product.ProId, name });
}
return product.ProductAttributes
.Where(x => x.AttributeName == objMethod)
.Select(y => y.AttributeValue).FirstOrDefault().Trim();
}
if (objName == GlobalConstName.ResolveValue.MODELINFO)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
if (product.ModelObj ==null||
product.ModelObj.Attributes == null ||
!product.ModelObj.Attributes.Any(x => x.Name == objMethod))
{
throw new FisException("CHK1036", new List<string> { product.Model, name });
}
return product.ModelObj.Attributes
.Where(x => x.Name == objMethod)
.Select(y => y.Value).FirstOrDefault().Trim();
}
if (objName == GlobalConstName.ResolveValue.FAMILYINFO)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
string family = product.Family;
//IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod });
if (familyInfoList == null || familyInfoList.Count == 0)
{
throw new FisException("CHK1036", new List<string> { family, name });
}
return familyInfoList[0].value.Trim();
}
if (objName == GlobalConstName.ResolveValue.PRODUCT)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
string value = (string)product.GetProperty(objMethod);
if (string.IsNullOrEmpty(value))
//.........这里部分代码省略.........
示例3: GetValue
/// <summary>
///
/// </summary>
/// <param name="session"></param>
/// <param name="product"></param>
/// <param name="mb"></param>
/// <param name="delivery"></param>
/// <param name="part"></param>
/// <param name="name"></param>
/// <param name="spliter"></param>
/// <returns></returns>
public static string GetValue(Session session,
IProduct product,
IMB mb,
Delivery delivery,
IPart part,
string name, char spliter)
{
int index = name.IndexOf(spliter);
if (index < 1)
{
throw new Exception("wrong method name : " + name);
}
string objName = name.Substring(0, index).ToUpper();
string objMethod = name.Substring(index + 1).Trim();
if (objName == GlobalConstName.ResolveValue.PRODUCTINFO)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
return product.ProductInfoes
.Where(x => x.InfoType == objMethod)
.Select(y => y.InfoValue).FirstOrDefault();
}
if (objName == GlobalConstName.ResolveValue.PRODUCTATTR)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
if (product.ProductAttributes == null ||
!product.ProductAttributes.Any(x => x.AttributeName == objMethod))
{
throw new FisException("CHK1036", new List<string> { product.ProId, name });
}
return product.ProductAttributes
.Where(x => x.AttributeName == objMethod)
.Select(y => y.AttributeValue).FirstOrDefault().Trim();
}
if (objName == GlobalConstName.ResolveValue.MODEL)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
if (product.ModelObj == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
}
object value = product.ModelObj.GetProperty(objMethod);
if (value == null)
{
return null;
}
return value.ToString().Trim();
}
if (objName == GlobalConstName.ResolveValue.MODELINFO)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
if (product.ModelObj == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
}
return product.ModelObj.Attributes
.Where(x => x.Name == objMethod)
.Select(y => y.Value).FirstOrDefault();
}
if (objName == GlobalConstName.ResolveValue.FAMILYINFO)
{
if (product == null)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
string family = product.Family;
//IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod });
//.........这里部分代码省略.........
示例4: getValueInner
private static string getValueInner(Session session, IProduct product, IMB mb, Delivery delivery, IPart part,
string name, char spliter, bool isThrowError)
{
int index = name.IndexOf(spliter);
if (index < 1)
{
throw new Exception("wrong method name : " + name);
}
string objName = name.Substring(0, index);
string objMethod = name.Substring(index + 1).Trim();
if (string.Compare(objName, GlobalConstName.ResolveValue.PRODUCTINFO, true) == 0)
{
if (product == null)
{
if (isThrowError)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
else
{
return null;
}
}
if (product.ProductInfoes == null ||
!product.ProductInfoes.Any(x => x.InfoType == objMethod))
{
if (isThrowError)
{
throw new FisException("CHK1036", new List<string> { product.ProId, name });
}
else
{
return null;
}
}
return product.ProductInfoes
.Where(x => x.InfoType == objMethod)
.Select(y => y.InfoValue).FirstOrDefault();
}
if (string.Compare(objName, GlobalConstName.ResolveValue.PRODUCTATTR, true) == 0)
{
if (product == null)
{
if (isThrowError)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
else
{
return null;
}
}
if (product.ProductAttributes == null ||
!product.ProductAttributes.Any(x => x.AttributeName == objMethod))
{
if (isThrowError)
{
throw new FisException("CHK1036", new List<string> { product.ProId, name });
}
else
{
return null;
}
}
return product.ProductAttributes
.Where(x => x.AttributeName == objMethod)
.Select(y => y.AttributeValue).FirstOrDefault().Trim();
}
if (string.Compare(objName, GlobalConstName.ResolveValue.MODEL,true) == 0)
{
if (product == null)
{
if (isThrowError)
{
throw new FisException("CQCHK0006", new List<string> { "Product" });
}
else
{
return null;
}
}
if (product.ModelObj == null)
{
if (isThrowError)
{
throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
}
else
{
return null;
}
}
object value = product.ModelObj.GetProperty(objMethod);
if (value == null)
//.........这里部分代码省略.........