コード例 #1
0
        public Boolean CreateSibling(List <SiblingBDO> sbdo, string studentId)
        {
            Boolean ret = true;

            try {
                foreach (SiblingBDO s in sbdo)
                {
                    Sibling sib = new Sibling();
                    ConvertSiblingBDOToSibling(s, sib, studentId);
                    using (var DCEnt = new DCFIEntities())
                    {
                        DCEnt.Siblings.Attach(sib);
                        int num = DCEnt.SaveChanges();
                        if (num != 1)
                        {
                            ret = false;
                        }
                    }
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
            }
            return(ret);
        }
コード例 #2
0
        private List <Sibling> ToSiblingList(List <SiblingBDO> siblings)
        {
            List <Sibling> sibList = new List <Sibling>();

            foreach (SiblingBDO s in siblings)
            {
                Sibling sbdo = new Sibling();
                ConvertSiblingBDOToSibling(s, sbdo, s.StudentId);
                sibList.Add(sbdo);
            }
            return(sibList);
        }
コード例 #3
0
ファイル: StudentDAO.cs プロジェクト: dansalan/DCFIv3
 public Boolean CreateSibling(List<SiblingBDO> sbdo, string studentId)
 {
     Boolean ret = true;
     foreach (SiblingBDO s in sbdo)
     {
         Sibling sib = new Sibling();
         ConvertSiblingBDOToSibling(s, sib, studentId);
         using (var DCEnt = new DCFIEntities())
         {
             DCEnt.Siblings.Attach(sib);
             int num = DCEnt.SaveChanges();
             if (num != 1)
                 ret = false;
         }
     }
     return ret;
 }
コード例 #4
0
        public Boolean CreateSibling(List <SiblingBDO> sbdo, string studentId)
        {
            Boolean ret = true;

            foreach (SiblingBDO s in sbdo)
            {
                Sibling sib = new Sibling();
                ConvertSiblingBDOToSibling(s, sib, studentId);
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.Siblings.Attach(sib);
                    int num = DCEnt.SaveChanges();
                    if (num != 1)
                    {
                        ret = false;
                    }
                }
            }
            return(ret);
        }
コード例 #5
0
 private void ConvertSiblingToSiblingBDO(Sibling s, SiblingBDO sib)
 {
     sib.SiblingId        = s.SiblingId;
     sib.StudentId        = s.StudentId;
     sib.SiblingStudentId = s.SiblingStudentId;
 }
コード例 #6
0
 private void ConvertSiblingBDOToSibling(SiblingBDO s, Sibling sib, string studentId)
 {
     sib.StudentId        = studentId;
     sib.SiblingStudentId = s.SiblingStudentId;
 }
コード例 #7
0
ファイル: StudentDAO.cs プロジェクト: dansalan/DCFIv5
 private List<Sibling> ToSiblingList(List<SiblingBDO> siblings)
 {
     List<Sibling> sibList = new List<Sibling>();
     foreach (SiblingBDO s in siblings)
     {
         Sibling sbdo = new Sibling();
         ConvertSiblingBDOToSibling(s, sbdo,s.StudentId);
         sibList.Add(sbdo);
     }
     return sibList;
 }
コード例 #8
0
ファイル: StudentDAO.cs プロジェクト: dansalan/DCFIv5
 private void ConvertSiblingToSiblingBDO(Sibling s, SiblingBDO sib)
 {
     sib.SiblingId = s.SiblingId;
     sib.StudentId = s.StudentId;
     sib.SiblingStudentId = s.SiblingStudentId;
 }
コード例 #9
0
ファイル: StudentDAO.cs プロジェクト: dansalan/DCFIv5
 private void ConvertSiblingBDOToSibling(SiblingBDO s, Sibling sib,string studentId)
 {
     sib.StudentId = studentId;
     sib.SiblingStudentId = s.SiblingStudentId;
 }
コード例 #10
0
ファイル: StudentDAO.cs プロジェクト: dansalan/DCFIv5
 public Boolean CreateSibling(List<SiblingBDO> sbdo, string studentId)
 {
     Boolean ret = true;
     try {
     foreach (SiblingBDO s in sbdo)
     {
         Sibling sib = new Sibling();
         ConvertSiblingBDOToSibling(s, sib, studentId);
         using (var DCEnt = new DCFIEntities())
         {
             DCEnt.Siblings.Attach(sib);
             int num = DCEnt.SaveChanges();
             if (num != 1)
                 ret = false;
         }
     }
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 Trace.TraceInformation("Property: {0} Error: {1}",
                                         validationError.PropertyName,
                                         validationError.ErrorMessage);
             }
     }
     }
     return ret;
 }