Ejemplo n.º 1
0
 //插入会议参加人员信息
 public int Insert(AttendMeeting attendMeeting)
 {
     try
     {
         dbcontext.AttendMeetingContext.Add(attendMeeting);
         dbcontext.SaveChanges();
         return(attendMeeting.AttendMeetingID);
     }
     catch
     {
         //throw;
         return(0);
     }
 }
Ejemplo n.º 2
0
 //根据AttendMeetingID删除会议参加人员信息
 public bool Delete(int attendMeetingID)
 {
     try
     {
         AttendMeeting attendMeeting = dbcontext.AttendMeetingContext.Where(u => u.AttendMeetingID == attendMeetingID).FirstOrDefault();
         dbcontext.AttendMeetingContext.Attach(attendMeeting);
         dbcontext.AttendMeetingContext.Remove(attendMeeting);
         dbcontext.SaveChanges();
         return(true);
     }
     catch
     {
         //throw;
         return(false);
     }
 }
Ejemplo n.º 3
0
 //更新会议参加人员情况
 public void Update(AttendMeeting attendMeeting)
 {
     try
     {
         AttendMeeting AttendMeeting = dbcontext.AttendMeetingContext.Find(attendMeeting.AcademicMeetingID);
         AttendMeeting.UserInfoID        = attendMeeting.UserInfoID;
         AttendMeeting.AcademicMeetingID = attendMeeting.AcademicMeetingID;
         AttendMeeting.SecrecyLevel      = attendMeeting.SecrecyLevel;
         AttendMeeting.EntryPerson       = attendMeeting.EntryPerson;
         AttendMeeting.IsPass            = attendMeeting.IsPass;
         dbcontext.SaveChanges();
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 4
0
 //更新IsPass状态
 public void UpdateIsPass(int ID, bool isPass)
 {
     try
     {
         AttendMeeting NewAttendMeeting = dbcontext.AttendMeetingContext.Find(ID);
         if (NewAttendMeeting == null)
         {
             return;
         }
         NewAttendMeeting.IsPass = isPass;
         dbcontext.SaveChanges();
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 5
0
 //根据会议ID删除会议参加人员信息
 public bool DeleteStaffByMeetingID(int MeetingID)
 {
     try
     {
         List <int> list = dbcontext.AttendMeetingContext.Where(p => p.AcademicMeetingID == MeetingID).Select(p => p.AttendMeetingID).ToList();
         for (int i = 0; i < list.Count(); i++)
         {
             AttendMeeting attendMeeting = dbcontext.AttendMeetingContext.Find(list[i]);
             dbcontext.AttendMeetingContext.Attach(attendMeeting);
             dbcontext.AttendMeetingContext.Remove(attendMeeting);
         }
         dbcontext.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 6
0
        public IHttpActionResult MeetingAttendence(AttendMeeting attendMeeting)
        {
            object obj    = null;
            int    userId = 0;

            try
            {
                //  string _userName = System.Web.HttpContext.Current.User.Identity.Name;
                try
                {
                    userId = Convert.ToInt32(((ClaimsIdentity)User?.Identity).Claims?.FirstOrDefault(x => x.Type == "ID").Value);
                }
                // string _userName = System.Web.HttpContext.Current.User.Identity.Name;

                catch (Exception ex)
                {
                    return(Json(new { success = 0, error = "Invalid Token" }));
                }
                string decryptedCommitteeId = HypridEncryption.decrypt(attendMeeting.CommitteeId, attendMeeting.ps);
                string decryptedMeetingId   = HypridEncryption.decrypt(attendMeeting.MeetingId, attendMeeting.ps);

                int committeeId = Convert.ToInt32(decryptedCommitteeId);
                int meetingId   = Convert.ToInt32(decryptedMeetingId);

                CommitteesMember committeeMember = db.CommitteesMembers.FirstOrDefault(x => x.CommitteeId == committeeId && x.MemberId == userId && x.MeetingId == meetingId);
                if (committeeMember != null)
                {
                    committeeMember.MemberWillAttend = attendMeeting.Attend;

                    db.Entry(committeeMember).State = EntityState.Modified;
                    db.SaveChanges();
                    return(Json(new { success = 1, error = obj, data = obj }));
                }
                else
                {
                    return(Json(new { success = 0, error = "no data found for this request", data = obj }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = 0, error = ex.Message }));
            }
        }