/// <summary> /// Takes in a FileDataHolder object and goes through it looking for a 'productID' and 'quantity /// field. Then sets them into this object's 'itemcode' and 'quantity' property. /// </summary> /// <param name="fdh">A filled in FileDataHolder object is to be passed in.</param> public void SortData(FileDataHolder ifdh) { string fixname = ifdh.FileName.Remove(0, 5); string[] rmvext = fixname.Split('.'); boxid = rmvext[0]; string[] usplit = boxid.Split('u'); po = usplit[0]; boxnumber = Int32.Parse(usplit[1]); boxid = boxid.ToUpper(); po = po.ToUpper(); //loop through all the datafields and gather the wanted information for (int i = 0; i < ifdh.DataFields.Count; ++i) { //add FNSKU first if (ifdh.DataFields[i].AttributeName.Contains("productId")) { for (int j = 0; j < ifdh.DataFields[i].AttributeValues.Count; ++j) { contents.Add(new Item(ifdh.DataFields[i].AttributeValues[j], "")); } } //add quantity next else if (ifdh.DataFields[i].AttributeName.Contains("quantity")) { for (int j = 0; j < ifdh.DataFields[i].AttributeValues.Count; ++j) { contents[j].Quantity = ifdh.DataFields[i].AttributeValues[j]; } } } }
/// <summary> /// Overloaded constructor for Box object. /// </summary> /// <param name="fdh">Pass in a FileDataHolder object and all properties are set.</param> public Box(FileDataHolder ifdh) { SortData(ifdh); }