Esempio n. 1
0
        public virtual void SetDataType(Type type, UiBase parent)
        {
            CloseCurrentService();

            CurrentType           = type;
            this.associatedParent = parent;

            if (type == typeof(UiClient))
            {
                UiClient.InitService();
                SelectService(UiClient.Service, typeof(UiClient), parent);
                return;
            }

            if (type == typeof(UiEmployee))
            {
                UiEmployee.InitService();
                SelectService(UiEmployee.Service, typeof(UiEmployee), parent);
                return;
            }

            if (type == typeof(UiProjectItemsCategory))
            {
                // only as DetailController
                UiProjectItemsCategory.InitService();
                SelectService(UiProjectItemsCategory.Service, typeof(UiProjectItemsCategory), parent);
                return;
            }

            if (type == typeof(UiProject))
            {
                UiProject.InitService();
                SelectService(UiProject.Service, typeof(UiProject), parent, new[] { "Budgets" });
                return;
            }

            if (type == typeof(UiMaterial))
            {
                UiMaterial.InitService();
                SelectService(UiMaterial.Service, typeof(UiMaterial), parent);
                return;
            }

            if (type == typeof(UiProjectCategory))
            {
                UiProjectCategory.InitService();
                SelectService(UiProjectCategory.Service, typeof(UiProjectCategory), parent);
                return;
            }

            // TODO : throw an exception
        }