public void SetDescription() { // Make sure we have a Attribute Set GetCGenAttributeSet(); if (_mas == null) { SetDescription(""); return; } StringBuilder sb = new StringBuilder(); // Instance Attribute Values MGenAttribute[] attributes = _mas.GetCGenAttributes(true); for (int i = 0; i < attributes.Length; i++) { MGenAttributeInstance mai = attributes[i].GetCGenAttributeInstance(GetC_GenAttributeSetInstance_ID()); if (mai != null && mai.GetValue() != null) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(mai.GetValue()); } } // SerNo if (_mas.IsSerNo() && GetSerNo() != null) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(_mas.GetSerNoCharStart()).Append(GetSerNo()).Append(_mas.GetSerNoCharEnd()); } // Lot if (_mas.IsLot() && GetLot() != null) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(_mas.GetLotCharStart()).Append(GetLot()).Append(_mas.GetLotCharEnd()); } // GuaranteeDate if (_mas.IsGuaranteeDate() && GetGuaranteeDate() != null) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(_dateFormat.Format(GetGuaranteeDate())); //MessageBox.Show("set date time formate cheak line"); //sb.Append(GetGuaranteeDate()); } // Product Attribute Values attributes = _mas.GetCGenAttributes(false); for (int i = 0; i < attributes.Length; i++) { MGenAttributeInstance mai = attributes[i].GetCGenAttributeInstance(GetC_GenAttributeSetInstance_ID()); if (attributes[i].GetAttributeValueType().Equals("N")) { if (mai != null && mai.GetValueNumber() != 0) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(mai.GetValueNumber()); } } else { if (mai != null && mai.GetValue() != null) { if (sb.Length > 0) { sb.Append("_"); } sb.Append(mai.GetValue()); } } } SetDescription(sb.ToString()); }