Пример #1
0
 public static void ToEntity(DT.Algorithm source, DA.Algorithm target, DA.OKBDataContext okb)
 {
     if ((source != null) && (target != null))
     {
         target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId; target.DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb);
     }
 }
        public void UpdateAlgorithm(DataTransfer.Algorithm dto)
        {
            roleVerifier.AuthenticateForAllRoles(OKBRoles.OKBAdministrator);

            using (OKBDataContext okb = new OKBDataContext()) {
                DataAccess.Algorithm entity = okb.Algorithms.FirstOrDefault(x => x.Id == dto.Id);
                Convert.ToEntity(dto, entity, okb);
                okb.SubmitChanges();
            }
        }
Пример #3
0
 public static DA.Algorithm ToEntity(DT.Algorithm source, DA.OKBDataContext okb)
 {
     if (source == null)
     {
         return(null);
     }
     return(new DA.Algorithm {
         Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId, DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb)
     });
 }
        public long AddAlgorithm(DataTransfer.Algorithm dto)
        {
            roleVerifier.AuthenticateForAllRoles(OKBRoles.OKBAdministrator);

            using (OKBDataContext okb = new OKBDataContext()) {
                DataAccess.Algorithm entity = Convert.ToEntity(dto, okb); entity.Id = 0;
                okb.Algorithms.InsertOnSubmit(entity);
                okb.SubmitChanges();
                return(entity.Id);
            }
        }