Exemple #1
0
        public void NUnit_DynamicColumn_Domain_Get()
        {
            Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
            var repo = service.GetAllUseEntity <Sys_DynamicColumn>(ref status);;

            Console.Write("Total Record: " + repo.Count());
        }
        public Sys_DynamicColumnModel Put(Sys_DynamicColumnModel model)
        {
            var Sys_DynamicColumn = new Sys_DynamicColumnEntity
            {
                ID         = model.ID,
                ColumnName = model.ColumnName,
                Code       = model.Code,
                Status     = model.Status,
                DataType   = model.DataType,
                Length     = model.Length,
                TableName  = model.TableName,
                Comment    = model.Comment
            };
            var service = new Sys_DynamicColumnServices();

            if (model.ID != Guid.Empty)
            {
                Sys_DynamicColumn.ID = model.ID;
                service.Edit <Sys_DynamicColumnEntity>(Sys_DynamicColumn);
            }
            else
            {
                service.Add(Sys_DynamicColumn);
                model.ID = Sys_DynamicColumn.ID;
            }
            return(model);
        }
        // DELETE api/<controller>/5
        public Sys_DynamicColumnModel Delete(Guid id)
        {
            var service = new Sys_DynamicColumnServices();

            service.Remove <Sys_DynamicColumnEntity>(id);
            var result = new Sys_DynamicColumnModel();

            return(result);
        }
 public void NUnit_DynamicColumn_Domain_GetById()
 {
     Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
     var model = new Sys_DynamicColumn { Id = 75 };
     var result = service.GetById<Sys_DynamicColumn>(model.Id,ref status) as Sys_DynamicColumn;
     NUnit.Framework.Assert.IsNotNull(result);
     Console.Write("SearchResult: " + result.Id 
         + " | " + result.Code
         + " | " + result.ColumnName 
         );
 }
Exemple #5
0
        public void NUnit_DynamicColumn_Domain_GetById()
        {
            Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
            var model = new Sys_DynamicColumn {
                Id = 75
            };
            var result = service.GetById <Sys_DynamicColumn>(model.Id, ref status) as Sys_DynamicColumn;

            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id
                          + " | " + result.Code
                          + " | " + result.ColumnName
                          );
        }
Exemple #6
0
        public void NUnit_DynamicColumn_Domain_Delete()
        {
            Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
            int rs    = 0;
            var model = new Sys_DynamicColumn {
                Id = 79
            };
            var result = service.Delete <Sys_DynamicColumn>(model.Id);

            //  NUnit.Framework.Assert.IsTrue(result);
            if (result == ActionStatus.EditSucceed.ToString())
            {
                rs += 1;
                Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
            }
        }
        //// GET api/<controller>
        ///// <summary>
        ///// Lấy tất cả dữ liệu
        ///// </summary>
        ///// <returns></returns>
        public IEnumerable <Sys_DynamicColumnModel> Get()
        {
            string status  = string.Empty;
            var    service = new Sys_DynamicColumnServices();
            var    list    = service.GetAllUseEntity <Sys_DynamicColumnEntity>(ref status);

            return(list.Select(item => new Sys_DynamicColumnModel
            {
                ID = item.ID,
                ColumnName = item.ColumnName,
                Code = item.Code,
                Status = item.Status,
                DataType = item.DataType,
                Length = item.Length,
                TableName = item.TableName,
                Comment = item.Comment
            }));
        }
        // GET api/<controller>/5
        public Sys_DynamicColumnModel Get(Guid id)
        {
            string status            = string.Empty;
            var    service           = new Sys_DynamicColumnServices();
            var    result            = service.GetById <Sys_DynamicColumnEntity>(id, ref status);
            var    Sys_DynamicColumn = new Sys_DynamicColumnModel
            {
                ID         = result.ID,
                ColumnName = result.ColumnName,
                Code       = result.Code,
                Status     = result.Status,
                DataType   = result.DataType,
                Length     = result.Length,
                TableName  = result.TableName,
                Comment    = result.Comment
            };

            return(Sys_DynamicColumn);
        }
 public void NUnit_DynamicColumn_Domain_Edit()
 {
     Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
     var model = new Sys_DynamicColumn
     {
         Id = 67,
         Code = "1",
         ColumnName = "test ",
     };
     var result = service.Edit<Sys_DynamicColumn>(model);
  //   NUnit.Framework.Assert.IsTrue(result);
     if (result == ActionStatus.EditSucceed.ToString())
     {
         Console.WriteLine("Process Success >>> Update >>> " + model.Id
                 + " | " + model.Code
                 + " | " + model.ColumnName
                 );
     }
 }
Exemple #10
0
        public void NUnit_DynamicColumn_Domain_Edit()
        {
            Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
            var model = new Sys_DynamicColumn
            {
                Id         = 67,
                Code       = "1",
                ColumnName = "test ",
            };
            var result = service.Edit <Sys_DynamicColumn>(model);

            //   NUnit.Framework.Assert.IsTrue(result);
            if (result == ActionStatus.EditSucceed.ToString())
            {
                Console.WriteLine("Process Success >>> Update >>> " + model.Id
                                  + " | " + model.Code
                                  + " | " + model.ColumnName
                                  );
            }
        }
        public string Post([Bind] Sys_DynamicColumnModel model)
        {
            var success = string.Empty;

            if (model.Length != null)
            {
                if (model.DataType == "Decimal")
                {
                    model.DataType = model.DataType + "(" + model.Length + ",0)";
                }
                else
                {
                    model.DataType = model.DataType + "(" + model.Length + ")";
                }
            }
            else
            {
                model.DataType = model.DataType;
            }
            var listDynamicColumnModel = new List <Sys_DynamicColumnModel> {
                model
            };
            var entity  = listDynamicColumnModel.ToList().Translate <Sys_DynamicColumnEntity>();
            var service = new Sys_DynamicColumnServices();

            if (model.ID != Guid.Empty)
            {
                entity[0].ID = model.ID;
                success      = service.Edit <Sys_DynamicColumnEntity>(entity[0]) + ",0";
            }
            else
            {
                success  = service.Add <Sys_DynamicColumnEntity>(entity[0]) + ",0";
                model.ID = entity[0].ID;
            }
            return(success);
        }
 public void NUnit_DynamicColumn_Domain_Get()
 {
     Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
     var repo = service.GetAllUseEntity<Sys_DynamicColumn>(ref status); ;
     Console.Write("Total Record: " + repo.Count());
 }
 public void NUnit_DynamicColumn_Domain_Delete()
 {
     Sys_DynamicColumnServices service = new Sys_DynamicColumnServices();
     int rs = 0;
     var model = new Sys_DynamicColumn { Id = 79 };
     var result = service.Delete<Sys_DynamicColumn>(model.Id);
   //  NUnit.Framework.Assert.IsTrue(result);
     if (result == ActionStatus.EditSucceed.ToString())
     {
         rs += 1;
         Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
     }
 }