public void Insert(int DespatchItemId,string Sscc,string PalletType,byte[] PalletTs)
	    {
		    DespatchNotePalletId item = new DespatchNotePalletId();
		    
            item.DespatchItemId = DespatchItemId;
            
            item.Sscc = Sscc;
            
            item.PalletType = PalletType;
            
            item.PalletTs = PalletTs;
            
	    
		    item.Save(UserName);
	    }
    /// <summary>
    /// generated automatically when a  title is saved/updated
    /// </summary>
    /// <param name="palletcount"></param>
    protected void append_pallet_ids(int itemid, int?full, int?part, int?totalqty, string publishipref)
    {
        const int  _max         = 17;  //base length sscc pallet id 17 digits + 1 for checksum
        const char _chr         = '0'; //left padding
        int?       _palletcount = full + part;

        for (int _ix = 1; _ix <= _palletcount; _ix++)
        {
            //base for sscc is 17 digits plus 1 digit checksum
            //use total quantity + ix t give an incremetnal numner 0 seperator + publiship ref
            string _sscc = string.Format("{0}0{1}", (totalqty + _ix).ToString(), publishipref);
            //leading 0's to make it up to 17 characters
            _sscc = _sscc.PadLeft(_max, _chr);
            //append checksum
            _sscc += wwi_func.sscc_checkdigit(_sscc);
            //save to pallet id's
            DespatchNotePalletId _id = new DespatchNotePalletId();
            _id.DespatchItemId = itemid; //link to srr item
            _id.Sscc           = _sscc;
            _id.PalletType     = _ix <= full ? "Full" : "Part";
            _id.Save();
        }
        //end for
    }
	    public void Update(int PalletId,int DespatchItemId,string Sscc,string PalletType,byte[] PalletTs)
	    {
		    DespatchNotePalletId item = new DespatchNotePalletId();
	        item.MarkOld();
	        item.IsLoaded = true;
		    
			item.PalletId = PalletId;
				
			item.DespatchItemId = DespatchItemId;
				
			item.Sscc = Sscc;
				
			item.PalletType = PalletType;
				
			item.PalletTs = PalletTs;
				
	        item.Save(UserName);
	    }
    /// <summary>
    /// generated automatically when a  title is saved/updated
    /// </summary>
    /// <param name="palletcount"></param>
    protected void append_pallet_ids(int itemid, int? full, int? part,  int? totalqty, string publishipref)
    {
        const int _max = 17; //base length sscc pallet id 17 digits + 1 for checksum
        const char _chr = '0'; //left padding
        int? _palletcount = full + part;

        for (int _ix = 1; _ix <= _palletcount; _ix++)
        {
            //base for sscc is 17 digits plus 1 digit checksum
            //use total quantity + ix t give an incremetnal numner 0 seperator + publiship ref 
            string _sscc = string.Format("{0}0{1}", (totalqty + _ix).ToString(), publishipref);
            //leading 0's to make it up to 17 characters
            _sscc = _sscc.PadLeft(_max, _chr);
            //append checksum
            _sscc += wwi_func.sscc_checkdigit(_sscc);
            //save to pallet id's
            DespatchNotePalletId _id = new DespatchNotePalletId();
            _id.DespatchItemId = itemid; //link to srr item
            _id.Sscc = _sscc;
            _id.PalletType = _ix <= full ? "Full" : "Part";
            _id.Save();
        }
        //end for 
    }