//end append srr log
    protected void update_note(int noteid, string newref)
    {
        string _oldref = this.dxlblNoteRef.Text.ToString();

        if (newref != _oldref)
        {
            try
            {
                //update if ref has changed
                DespatchNote _note = new DespatchNote(noteid);
                _note.DespatchRef = newref;
                _note.CreatedBy   = Page.Session["user"] != null ? (string)((UserClass)Page.Session["user"]).UserName : "";
                _note.CreatedDate = DateTime.Now;
                _note.Save();
            }
            catch (Exception ex)
            {
                this.dxlblErr.Text          = ex.Message.ToString();
                this.dxpnlErr.ClientVisible = true;
            } //end try catch block
        }     //endif
    }
    /// <summary>
    /// create new srr log file
    /// </summary>
    /// <param name="consignmentref">string</param>
    /// <returns></returns>
    protected int append_note(string consignmentref)
    {
        int _id = 0;

        try
        {
            //save
            DespatchNote _note = new DespatchNote();
            _note.DespatchRef = consignmentref;
            _note.CreatedBy   = Page.Session["user"] != null ? (string)((UserClass)Page.Session["user"]).UserName : "";
            _note.CreatedDate = DateTime.Now;
            _note.Save();
            //return ident
            _id = wwi_func.vint(_note.GetPrimaryKeyValue().ToString());
        }
        catch (Exception ex)
        {
            this.dxlblErr.Text          = ex.Message.ToString();
            this.dxpnlErr.ClientVisible = true;
        }

        return(_id);
    }
	    public void Insert(string DespatchRef,decimal? TotalCartons,decimal? TotalWeight,decimal? TotalCbm,string CreatedBy,DateTime? CreatedDate,byte[] DespatchNoteTs)
	    {
		    DespatchNote item = new DespatchNote();
		    
            item.DespatchRef = DespatchRef;
            
            item.TotalCartons = TotalCartons;
            
            item.TotalWeight = TotalWeight;
            
            item.TotalCbm = TotalCbm;
            
            item.CreatedBy = CreatedBy;
            
            item.CreatedDate = CreatedDate;
            
            item.DespatchNoteTs = DespatchNoteTs;
            
	    
		    item.Save(UserName);
	    }
	    public void Update(int DespatchId,string DespatchRef,decimal? TotalCartons,decimal? TotalWeight,decimal? TotalCbm,string CreatedBy,DateTime? CreatedDate,byte[] DespatchNoteTs)
	    {
		    DespatchNote item = new DespatchNote();
	        item.MarkOld();
	        item.IsLoaded = true;
		    
			item.DespatchId = DespatchId;
				
			item.DespatchRef = DespatchRef;
				
			item.TotalCartons = TotalCartons;
				
			item.TotalWeight = TotalWeight;
				
			item.TotalCbm = TotalCbm;
				
			item.CreatedBy = CreatedBy;
				
			item.CreatedDate = CreatedDate;
				
			item.DespatchNoteTs = DespatchNoteTs;
				
	        item.Save(UserName);
	    }
    //end append srr log
    protected void update_note(int noteid, string newref)
    {
        string _oldref = this.dxlblNoteRef.Text.ToString();
        if (newref != _oldref)
        {
            try
            {
                //update if ref has changed 
                DespatchNote _note = new DespatchNote(noteid);
                _note.DespatchRef = newref;
                _note.CreatedBy = Page.Session["user"] != null ? (string)((UserClass)Page.Session["user"]).UserName : "";
                _note.CreatedDate = DateTime.Now;
                _note.Save();

            }
            catch (Exception ex)
            {
                this.dxlblErr.Text = ex.Message.ToString();
                this.dxpnlErr.ClientVisible = true;
            }//end try catch block

        }//endif
    }
    /// <summary>
    /// create new srr log file
    /// </summary>
    /// <param name="consignmentref">string</param>
    /// <returns></returns>
    protected int append_note(string consignmentref)
    {
        int _id = 0;

        try
        {
            //save 
            DespatchNote _note = new DespatchNote();
            _note.DespatchRef = consignmentref;
            _note.CreatedBy = Page.Session["user"] != null ? (string)((UserClass)Page.Session["user"]).UserName : "";
            _note.CreatedDate = DateTime.Now;
            _note.Save();
            //return ident
            _id = wwi_func.vint(_note.GetPrimaryKeyValue().ToString());
        }
        catch (Exception ex)
        {
            this.dxlblErr.Text = ex.Message.ToString();
            this.dxpnlErr.ClientVisible = true;
        }

        return _id;
    }