예제 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ImpactDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToImpactDetails(ImpactDetail impactDetail)
 {
     base.AddObject("ImpactDetails", impactDetail);
 }
예제 #2
0
 /// <summary>
 /// Create a new ImpactDetail object.
 /// </summary>
 /// <param name="impactDetailId">Initial value of the ImpactDetailId property.</param>
 /// <param name="impactTypeId">Initial value of the ImpactTypeId property.</param>
 /// <param name="impactLevelId">Initial value of the ImpactLevelId property.</param>
 /// <param name="impactDetailName">Initial value of the ImpactDetailName property.</param>
 public static ImpactDetail CreateImpactDetail(global::System.Int32 impactDetailId, global::System.Int32 impactTypeId, global::System.Int32 impactLevelId, global::System.String impactDetailName)
 {
     ImpactDetail impactDetail = new ImpactDetail();
     impactDetail.ImpactDetailId = impactDetailId;
     impactDetail.ImpactTypeId = impactTypeId;
     impactDetail.ImpactLevelId = impactLevelId;
     impactDetail.ImpactDetailName = impactDetailName;
     return impactDetail;
 }
예제 #3
0
        private void InsertImpactDetails(ImpactType type)
        {
            var typeId = type.ImpactTypeId;
            int detailId;
            foreach (var level in db.ImpactLevels)
            {
                string s = typeId.ToString() + level.ImpactLevelId.ToString();
                detailId = int.Parse(s);

                ImpactDetail detail = db.ImpactDetails.Where(p => p.ImpactTypeId == typeId && p.ImpactLevelId == level.ImpactLevelId).FirstOrDefault();
                if (detail == null || detail.ImpactDetailId != detailId)
                {
                    if (detail != null && detail.ImpactDetailId != detailId)
                        db.ImpactDetails.DeleteObject(detail);
                    detail = new ImpactDetail();
                    detail.ImpactDetailId = detailId;
                    detail.ImpactTypeId = typeId;
                    detail.ImpactLevelId = level.ImpactLevelId;
                    detail.ImpactDetailName = "...";
                    db.ImpactDetails.AddObject(detail);
                }
            }
            db.SaveChanges();
        }