Ejemplo n.º 1
0
        /// <summary>
        /// 将数据表的数据封装为业务对象
        /// </summary>
        /// <param name="mt">数据表的单行记录</param>
        /// <returns>一个业务对象</returns>
        private YunShanOA.Model.MeetingType FillRecord(YunShanOA.DataAccess.Mapping.MeetingType mt)
        {
            YunShanOA.Model.MeetingType meetingType = null;
            if (mt != null)
            {
                meetingType = new MeetingType();
                meetingType.MeetingTypeID          = mt.MeetingTypeID;
                meetingType.MeetingTypeName        = mt.MeetingTypeName;
                meetingType.MeetingTypeDescription = mt.MeetingTypeDescription;
            }

            return(meetingType);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除会议类型
        /// </summary>
        /// <param name="mt">要删除的会议业务对象</param>
        /// <returns>返回成功与否</returns>
        public bool DeleteMeetingType(Model.MeetingType mt)
        {
            YunShanOA.DataAccess.Mapping.MeetingType meetingType = null;
            dc          = new Mapping.YunShanOADataContext();
            meetingType = (from meeting in dc.MeetingType
                           where meeting.MeetingTypeID == mt.MeetingTypeID
                           select meeting).FirstOrDefault();
            if (meetingType != null)
            {
                try
                {
                    dc.MeetingType.DeleteOnSubmit(meetingType);
                    dc.SubmitChanges();
                }
                catch (ChangeConflictException)
                {
                    dc.ChangeConflicts.ResolveAll(RefreshMode.OverwriteCurrentValues);
                    dc.SubmitChanges();
                }
            }

            return(meetingType != null);
        }