Пример #1
0
        public void UpdateFreeCount(int useed, int meetingEquipmentID)
        {
            var query = dc.MeetingEquipment.Single(p => p.MeetingEquipmentID == meetingEquipmentID);

            query.MeetingEquipmentFreeCount = query.MeetingEquipmentFreeCount - useed;
            dc.SubmitChanges();
        }
Пример #2
0
        public void UpdateReviewMeetingApplyState(int meetingApplyFormID, string userName, int newState)
        {
            var query = dc.ReviewMeetingApply.Single(p => p.MeetingApplyFormID == meetingApplyFormID);

            query.ReviewUserName = userName;
            query.Agree          = newState;
            dc.SubmitChanges();
        }
Пример #3
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);
            }
        }
Пример #4
0
        public int SaveMeetingRoom(Model.MeetingRoom meetingRoom)
        {
            DataAccess.Mapping.MeetingRoom mr = null;
            bool find = false;

            if (meetingRoom.MeetingRoomID == -1)
            {
                mr = new Mapping.MeetingRoom();
                dc.MeetingRoom.InsertOnSubmit(mr);
                find = true;
            }
            else
            {
                mr = (from meeting in dc.MeetingRoom
                      where meeting.MeetingRoomID == meetingRoom.MeetingRoomID
                      select meeting).FirstOrDefault();
                if (mr != null)
                {
                    find             = true;
                    mr.MeetingRoomID = meetingRoom.MeetingRoomID;
                }
            }

            if (find)
            {
                mr.MeetingRoomCapacity = meetingRoom.MeetingRoomCapacity;
                mr.MeetingRoomName     = meetingRoom.MeetingRoomName;
                mr.MeetingRoomStatus   = meetingRoom.MeetingRoomStatus;
                mr.MeetingTypeID       = meetingRoom.MeetingTypeID;
                try
                {
                    dc.SubmitChanges();
                }
                catch (ChangeConflictException)
                {
                    dc.ChangeConflicts.ResolveAll(RefreshMode.OverwriteCurrentValues);
                    dc.SubmitChanges();
                }
                return(mr.MeetingRoomID);
            }
            else
            {
                return(-1);
            }
        }
Пример #5
0
 public void InsertLog(YunShanOA.Model.Log logModel)
 {
     if (logModel != null)
     {
         YunShanOA.DataAccess.Mapping.Log log = new Mapping.Log();
         log.LogType    = logModel.LogTypeID;
         log.LogContent = logModel.LogContext;
         log.UserName   = logModel.userName;
         dc.Log.InsertOnSubmit(log);
         dc.SubmitChanges();
     }
 }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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;
            }
        }