public bool UpData(IEnumerable <StudentDetialData> datas, IStudentDetialDataDal dal)
        {
            if (datas == null || dal == null)
            {
                return(false);
            }

            bool updateIsFun = true;

            try
            {
                foreach (var data in datas)
                {
                    if (data == null)
                    {
                        continue;
                    }
                    var  entity = dal.GetEntity(data.ID);
                    bool isUp   = dal.UpdateToCurrentValuesSets(entity, data);
                }
            }
            catch (Exception e)
            {
                updateIsFun = false;
            }
            return(updateIsFun);
        }
Beispiel #2
0
        public bool LibrayDelete(IEnumerable <StudentDetialData> datas, IStudentDetialDataDal dal)
        {
            if (datas == null || dal == null)
            {
                return(false);
            }

            bool updateIsFun = true;

            try
            {
                //删除StudentDetialData表必须将其从表中的依赖关系删除,我们需要找出所有关系数据,删除。
                foreach (var data in datas)
                {
                    if (data == null)
                    {
                        continue;
                    }
                    var             en   = dal.GetEntity(data.ID);
                    var             stu  = en.StudentDatas;
                    IStudentDataDal dals = new StudentDataDal((ConfigurationManager.AppSettings["assembly"]));
                    dals.Delete(stu);
                    dal.Delete(en);
                }
            }
            catch (Exception e)
            {
                updateIsFun = false;
            }
            return(updateIsFun);
        }