예제 #1
0
        private ACTIONDTO Delete(ACTIONDTO dto)
        {
            var model = _DBManger.TEST.Where(m => m.ID == dto.Model.ID);

            _DBManger.TEST.RemoveRange(model);

            return(dto);
        }
예제 #2
0
        private ACTIONDTO Update(ACTIONDTO dto)
        {
            var ID    = dto.Model.ID;
            var model = _DBManger.TEST.First(m => m.ID == ID);

            model.MergeObject(dto.Model);

            return(dto);
        }
예제 #3
0
        private ACTIONDTO GetAllEF(ACTIONDTO dto)
        {
            string sql    = @"SELECT TOP (1000) [ID]
                              ,[DATA]
                          FROM [TCDB].[dbo].[TEST]";
            var    result = _DBMangerNoEF.ExecuteDataSet(sql, null, commandType: CommandType.Text);

            if (result.Success(dto))
            {
                dto.Models = result.OutputDataSet.Tables[0].ToList <ACTIONModel>();
            }
            return(dto);
        }
예제 #4
0
        private ACTIONDTO Insert(ACTIONDTO dto)
        {
            if (dto.Model.ID.IsNullOrEmpty())
            {
                dto.Model.ID = _DBManger.TEST.Max(m => m.ID) + 1;
            }

            var model = dto.Model.ToNewObject(new TEST());

            _DBManger.TEST.Add(model);

            return(dto);
        }
예제 #5
0
        private ACTIONDTO GetAll(ACTIONDTO dto)
        {
            //dto.Model = _DBManger.TEST.FirstOrDefault().ToNewObject(new ACTIONModel());
            dto.Models = _DBManger.TEST
                         .Select(m => new
            {
                ID   = m.ID,
                DATA = m.DATA
            }).Distinct().Select(m => new ACTIONModel {
                ID = m.ID, DATA = m.DATA
            }).ToList();

            return(dto);
        }
예제 #6
0
        private ACTIONDTO DeleteEF(ACTIONDTO dto)
        {
            string sql        = @"delete from [dbo].[TEST] where id = @id";
            var    parameters = CreateParameter();

            parameters.AddParameter("id", dto.Model.ID);
            var result = _DBMangerNoEF.ExecuteNonQuery(sql, parameters, CommandType.Text);

            if (!result.Success(dto))
            {
                dto.Result.IsResult  = false;
                dto.Result.ResultMsg = result.ErrorMessage;
            }

            return(dto);
        }
예제 #7
0
        private ACTIONDTO GetByIDEF(ACTIONDTO dto)
        {
            string sql = @"SELECT TOP (1000) [ID]
                              ,[DATA]
                          FROM [TCDB].[dbo].[TEST] whrer id = @id";

            var parameters = CreateParameter();

            parameters.AddParameter("id", dto.Model.ID);

            var result = _DBMangerNoEF.ExecuteDataSet(sql, parameters, commandType: CommandType.Text);

            if (result.Success(dto))
            {
                dto.Models = result.OutputDataSet.Tables[0].ToList <ACTIONModel>();
            }

            return(dto);
        }
예제 #8
0
        private ACTIONDTO InsertEF(ACTIONDTO dto)
        {
            string sql        = @"INSERT INTO [dbo].[TEST]
                                   ([ID]
                                   ,[DATA])
                             VALUES
                                   (@id
                                   ,@data)";
            var    parameters = CreateParameter();

            parameters.AddParameter("id", dto.Model.ID);
            parameters.AddParameter("data", dto.Model.DATA);
            var result = _DBMangerNoEF.ExecuteNonQuery(sql, parameters, CommandType.Text);

            if (!result.Success(dto))
            {
                dto.Result.IsResult  = false;
                dto.Result.ResultMsg = result.ErrorMessage;
            }

            return(dto);
        }
예제 #9
0
        private ACTIONDTO GetByID(ACTIONDTO dto)
        {
            dto.Model = _DBManger.TEST.Where(m => m.ID == dto.Model.ID).FirstOrDefault().ToNewObject(new ACTIONModel());

            return(dto);
        }
예제 #10
0
 public ACTIONDA()
 {
     DTO = new ACTIONDTO();
 }