コード例 #1
0
        public void InsertByAssociateTypeId_InvalidInput_Failure()
        {
            #region Arrange

            var associate = new Associate
            {
                Created = DateTime.Now
            };
            var associateType = new AssociateType
            {
                Created = DateTime.Now
            };
            _dbContext.Associates.Add(associate);
            _dbContext.AssociateTypes.Add(associateType);
            _dbContext.SaveChanges();

            #endregion

            #region Act

            var response = _repository.InsertByAssociateTypeId(-1, new List <int>
            {
                associate.Id
            });

            #endregion

            #region Assert

            Assert.AreEqual(response.Success, false);
            Assert.AreEqual(_dbContext.AssociateAssociateTypes.Count(), 0);

            #endregion
        }
コード例 #2
0
 public AssociateTypeManageModel(AssociateType associateType)
     : this()
 {
     Id          = associateType.Id;
     Name        = associateType.Name;
     RecordOrder = associateType.RecordOrder;
 }
コード例 #3
0
        public void InsertByAssociateId_ValidInput_Success()
        {
            #region Arrange

            var associate = new Associate
            {
                Created = DateTime.Now
            };
            _dbContext.Associates.Add(associate);
            var associateType = new AssociateType
            {
                Created = DateTime.Now
            };
            _dbContext.AssociateTypes.Add(associateType);
            _dbContext.SaveChanges();

            #endregion

            #region Act

            _repository.InsertByAssociateId(associate.Id, new List <int>
            {
                associateType.Id
            });

            #endregion

            #region Assert

            Assert.AreEqual(_dbContext.AssociateAssociateTypes.Count(), 1);

            #endregion
        }
コード例 #4
0
 /// <summary>
 ///   Get the associate of type nAssociateType belonging to oMaster.
 ///   - nAssociateType: ASSOCIATE_TYPE_*
 ///   - nMaster
 ///   - nTh: Which associate of the specified type to return
 ///   * Returns OBJECT_INVALID if no such associate exists.
 /// </summary>
 public static uint GetAssociate(AssociateType nAssociateType, uint oMaster = OBJECT_INVALID, int nTh = 1)
 {
     Internal.NativeFunctions.StackPushInteger(nTh);
     Internal.NativeFunctions.StackPushObject(oMaster);
     Internal.NativeFunctions.StackPushInteger(nAssociateType.InternalValue);
     Internal.NativeFunctions.CallBuiltIn(364);
     return(Internal.NativeFunctions.StackPopObject());
 }
コード例 #5
0
 public static bool CreateIncludeFileByAssociateType(AssociateType associateType)
 {
     foreach (IncludeFileInfo info in GetIncludeFileListByAssociateType(associateType))
     {
         CreateIncludeFile(info);
     }
     return(true);
 }
コード例 #6
0
        public AssociateTypeDetailModel(AssociateType associateType)
            : this()
        {
            Id = associateType.Id;

            AssociateType = new AssociateTypeManageModel(associateType);

            Created      = associateType.Created;
            CreatedBy    = associateType.CreatedBy;
            LastUpdate   = associateType.LastUpdate;
            LastUpdateBy = associateType.LastUpdateBy;
        }
コード例 #7
0
        public IList <IncludeFileInfo> GetIncludeFileListByAssociateType(AssociateType associateType)
        {
            List <IncludeFileInfo> list      = new List <IncludeFileInfo>();
            Parameters             cmdParams = new Parameters();

            cmdParams.AddInParameter("@AssociateType", DbType.Int32, associateType);
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql("SELECT * FROM PE_IncludeFile WHERE AssociateType = @AssociateType ORDER BY ID DESC", cmdParams))
            {
                while (reader.Read())
                {
                    list.Add(GetIncludeFileInfoFromDataReader(reader));
                }
            }
            return(list);
        }
コード例 #8
0
        /// <summary>
        /// 新增一条记录
        /// </summary>
        /// <param name="qcRecord">质检实体</param>
        /// <returns></returns>
        public static bool InsertOneQCRecord(AssociateType qcRecord)
        {
            bool rbool = true;

            using (DCCarManagementDataContext db = new DCCarManagementDataContext())
            {
                try
                {
                    rbool = LinQBaseDao.InsertOne(db, qcRecord);
                }
                catch
                {
                    rbool = false;
                }
                finally { db.Connection.Close(); }
            }
            return(rbool);
        }
コード例 #9
0
        public void InsertByAssociateTypeId_ValidInput_Success()
        {
            #region Arrange

            var associate = new Associate
            {
                FirstName  = "First name",
                LastName   = "Last name",
                Created    = DateTime.Now,
                LastUpdate = DateTime.Now
            };
            _dbContext.Associates.Add(associate);
            var associateType = new AssociateType
            {
                Name       = "Associate Type",
                Created    = DateTime.Now,
                LastUpdate = DateTime.Now
            };
            _dbContext.AssociateTypes.Add(associateType);

            #endregion

            #region Act

            _repository.InsertByAssociateTypeId(associateType.Id, new List <int>
            {
                associate.Id
            });

            #endregion

            #region Assert

            Assert.AreEqual(_dbContext.AssociateAssociateTypes.Count(), 1);

            #endregion
        }
コード例 #10
0
 public AssociateTypeModel(AssociateType associateType)
     : base(associateType)
 {
     Name = associateType.Name;
 }
コード例 #11
0
 internal ResponseModel Delete(AssociateType associateType)
 {
     return(_associateTypeRepository.Delete(associateType));
 }
コード例 #12
0
 internal ResponseModel Insert(AssociateType associateType)
 {
     return(_associateTypeRepository.Insert(associateType));
 }
コード例 #13
0
 public static IList <IncludeFileInfo> GetIncludeFileListByAssociateType(AssociateType associateType)
 {
     return(dal.GetIncludeFileListByAssociateType(associateType));
 }