Esempio n. 1
0
        public int CreateEntity <T>(T entity)
        {
            switch (entity)
            {
            case DtoRecepientGroup recepgroup:     //todo:test
                return((int)MappedCommand.InsertAndGetId(_connStr, "RecepientGroup", recepgroup, "Id"));

            case DtoSchedule sched:     //todo:test
                return((int)MappedCommand.InsertAndGetId(_connStr, "Schedule", sched, "Id"));

            case DtoReport rep:
                return((int)MappedCommand.InsertAndGetId(_connStr, "Report", rep, "Id"));

            case DtoTask task:
                return((int)MappedCommand.InsertAndGetId(_connStr, "Task", task, "Id"));

            case DtoInstance instance:
                return((int)MappedCommand.InsertAndGetId(_connStr, "Instance", instance, "Id"));

            case DtoInstanceData instanceData:
            {
                MappedCommand.Insert(_connStr, "InstanceData", instanceData);
                return(0);
            }

            case DtoTelegramChannel channel:
                return((int)MappedCommand.InsertAndGetId(_connStr, "TelegramChannel", channel, "Id"));

            default:
                return(0);
            }
        }