using System;
namespace Versioning
{
    public class DepartmentData : Sage_Container, IData
    {
        /* Autogenerated by sage_wrapper_generator.pl */
        SageDataObject110.DepartmentData dd11;
        SageDataObject120.DepartmentData dd12;
        SageDataObject130.DepartmentData dd13;
        SageDataObject140.DepartmentData dd14;
        SageDataObject150.DepartmentData dd15;
        SageDataObject160.DepartmentData dd16;
        SageDataObject170.DepartmentData dd17;


        public DepartmentData(object inner, int version)
            : base(version) {
            switch (m_version) {
            case 11: {
                    dd11 = (SageDataObject110.DepartmentData)inner;
                    m_fields = new Fields(dd11.Fields,m_version);
                    return;
                }

            case 12: {
                    dd12 = (SageDataObject120.DepartmentData)inner;
                    m_fields = new Fields(dd12.Fields,m_version);
                    return;
                }

            case 13: {
                    dd13 = (SageDataObject130.DepartmentData)inner;
                    m_fields = new Fields(dd13.Fields,m_version);
                    return;
                }

            case 14: {
                    dd14 = (SageDataObject140.DepartmentData)inner;
                    m_fields = new Fields(dd14.Fields,m_version);
                    return;
                }

            case 15: {
                    dd15 = (SageDataObject150.DepartmentData)inner;
                    m_fields = new Fields(dd15.Fields,m_version);
                    return;
                }
            case 16: {
                    dd16 = (SageDataObject160.DepartmentData)inner;
                    m_fields = new Fields(dd16.Fields,m_version);
                    return;
                }
            case 17: {
                    dd17 = (SageDataObject170.DepartmentData)inner;
                    m_fields = new Fields(dd17.Fields,m_version);
                    return;
                }

            default: throw new InvalidOperationException("ver");
            }
        }
        /* Autogenerated with data_generator.pl */
        const string ACCOUNT_REF = "ACCOUNT_REF";
        const string DEPARTMENTDATA = "DepartmentData";


        
        public bool Open(OpenMode mode) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.Open((SageDataObject110.OpenMode)mode);
                    break;
                }

            case 12: {
                    ret = dd12.Open((SageDataObject120.OpenMode)mode);
                    break;
                }

            case 13: {
                    ret = dd13.Open((SageDataObject130.OpenMode)mode);
                    break;
                }

            case 14: {
                    ret = dd14.Open((SageDataObject140.OpenMode)mode);
                    break;
                }

            case 15: {
                    ret = dd15.Open((SageDataObject150.OpenMode)mode);
                    break;
                }
            case 16: {
                    ret = dd16.Open((SageDataObject160.OpenMode)mode);
                    break;
                }
            case 17: {
                    ret = dd17.Open((SageDataObject170.OpenMode)mode);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public void Close() {
            switch (m_version) {
            case 11: {
                    dd11.Close();
                    break;
                }

            case 12: {
                    dd12.Close();
                    break;
                }

            case 13: {
                    dd13.Close();
                    break;
                }

            case 14: {
                    dd14.Close();
                    break;
                }

            case 15: {
                    dd15.Close();
                    break;
                }
            case 16: {
                    dd16.Close();
                    break;
                }
            case 17: {
                    dd17.Close();
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }

        }
        public bool Read(int IRecNo) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.Read(IRecNo);
                    break;
                }

            case 12: {
                    ret = dd12.Read(IRecNo);
                    break;
                }

            case 13: {
                    ret = dd13.Read(IRecNo);
                    break;
                }

            case 14: {
                    ret = dd14.Read(IRecNo);
                    break;
                }

            case 15: {
                    ret = dd15.Read(IRecNo);
                    break;
                }
            case 16: {
                    ret = dd16.Read(IRecNo);
                    break;
                }
            case 17: {
                    ret = dd17.Read(IRecNo);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public bool Write(int IRecNo) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.Write(IRecNo);
                    break;
                }

            case 12: {
                    ret = dd12.Write(IRecNo);
                    break;
                }

            case 13: {
                    ret = dd13.Write(IRecNo);
                    break;
                }

            case 14: {
                    ret = dd14.Write(IRecNo);
                    break;
                }

            case 15: {
                    ret = dd15.Write(IRecNo);
                    break;
                }
            case 16: {
                    ret = dd16.Write(IRecNo);
                    break;
                }
            case 17: {
                    ret = dd17.Write(IRecNo);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public bool Seek(int IRecNo) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.Seek(IRecNo);
                    break;
                }

            case 12: {
                    ret = dd12.Seek(IRecNo);
                    break;
                }

            case 13: {
                    ret = dd13.Seek(IRecNo);
                    break;
                }

            case 14: {
                    ret = dd14.Seek(IRecNo);
                    break;
                }

            case 15: {
                    ret = dd15.Seek(IRecNo);
                    break;
                }
            case 16: {
                    ret = dd16.Seek(IRecNo);
                    break;
                }
            case 17: {
                    ret = dd17.Seek(IRecNo);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public bool Lock(int IRecNo) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.Lock(IRecNo);
                    break;
                }

            case 12: {
                    ret = dd12.Lock(IRecNo);
                    break;
                }

            case 13: {
                    ret = dd13.Lock(IRecNo);
                    break;
                }

            case 14: {
                    ret = dd14.Lock(IRecNo);
                    break;
                }

            case 15: {
                    ret = dd15.Lock(IRecNo);
                    break;
                }
            case 16: {
                    ret = dd16.Lock(IRecNo);
                    break;
                }
            case 17: {
                    ret = dd17.Lock(IRecNo);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public bool Unlock(int IRecNo) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.Unlock(IRecNo);
                    break;
                }

            case 12: {
                    ret = dd12.Unlock(IRecNo);
                    break;
                }

            case 13: {
                    ret = dd13.Unlock(IRecNo);
                    break;
                }

            case 14: {
                    ret = dd14.Unlock(IRecNo);
                    break;
                }

            case 15: {
                    ret = dd15.Unlock(IRecNo);
                    break;
                }
            case 16: {
                    ret = dd16.Unlock(IRecNo);
                    break;
                }
            case 17: {
                    ret = dd17.Unlock(IRecNo);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public bool FindFirst(object varField, object varSearch) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.FindFirst(varField, varSearch);
                    break;
                }

            case 12: {
                    ret = dd12.FindFirst(varField, varSearch);
                    break;
                }

            case 13: {
                    ret = dd13.FindFirst(varField, varSearch);
                    break;
                }

            case 14: {
                    ret = dd14.FindFirst(varField, varSearch);
                    break;
                }

            case 15: {
                    ret = dd15.FindFirst(varField, varSearch);
                    break;
                }
            case 16: {
                    ret = dd16.FindFirst(varField, varSearch);
                    break;
                }
            case 17: {
                    ret = dd17.FindFirst(varField, varSearch);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public bool FindNext(object varField, object varSearch) {
            bool ret;
            switch (m_version) {
            case 11: {
                    ret = dd11.FindNext(varField, varSearch);
                    break;
                }

            case 12: {
                    ret = dd12.FindNext(varField, varSearch);
                    break;
                }

            case 13: {
                    ret = dd13.FindNext(varField, varSearch);
                    break;
                }

            case 14: {
                    ret = dd14.FindNext(varField, varSearch);
                    break;
                }

            case 15: {
                    ret = dd15.FindNext(varField, varSearch);
                    break;
                }
            case 16: {
                    ret = dd16.FindNext(varField, varSearch);
                    break;
                }
            case 17: {
                    ret = dd17.FindNext(varField, varSearch);
                    break;
                }

            default: throw new InvalidOperationException("ver");
            }
            return ret;
        }
        public int Count {
            get {
                int ret;
                switch (m_version) {
                case 11: {
                        ret = dd11.Count();
                        break;
                    }

                case 12: {
                        ret = dd12.Count();
                        break;
                    }

                case 13: {
                        ret = dd13.Count();
                        break;
                    }

                case 14: {
                        ret = dd14.Count();
                        break;
                    }

                case 15: {
                        ret = dd15.Count();
                        break;
                    }
                case 16: {
                        ret = dd16.Count();
                        break;
                    }
                case 17: {
                        ret = dd17.Count();
                        break;
                    }

                default: throw new InvalidOperationException("ver");
                }
                return ret;
            }
        }
    }
}
