Пример #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);
        }
Пример #2
0
        /// <summary>
        /// 会议类型的保存和更新
        /// </summary>
        /// <param name="mt">要保存或更新的MeetingType对象</param>
        /// <returns>返回MeetingTypeID</returns>
        public int SaveMeetingType(MeetingType mt)
        {
            YunShanOA.DataAccess.Mapping.MeetingType meetingType = null;
            dc = new Mapping.YunShanOADataContext();
            bool find = false;

            if (mt.MeetingTypeID == -1)
            {
                meetingType = new Mapping.MeetingType();
                dc.MeetingType.InsertOnSubmit(meetingType);
                find = true;
            }
            else
            {
                meetingType = (from meeting in dc.MeetingType
                               where meeting.MeetingTypeID == mt.MeetingTypeID
                               select meeting).FirstOrDefault();
                if (meetingType != null)
                {
                    find = true;
                    meetingType.MeetingTypeID = mt.MeetingTypeID;
                }
            }

            if (find)
            {
                meetingType.MeetingTypeName = mt.MeetingTypeName;
                meetingType.MeetingTypeDescription = mt.MeetingTypeDescription;

                try
                {
                    dc.SubmitChanges();
                }
                catch (ChangeConflictException)
                {
                    dc.ChangeConflicts.ResolveAll(RefreshMode.OverwriteCurrentValues);
                    dc.SubmitChanges();
                }
                return meetingType.MeetingTypeID;
            }
            else
            {
                return -1;
            }
        }
Пример #3
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;
        }