public async Task <IHttpActionResult> PutInvited(string id, Invited invited) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != invited.InvitedUserId) { return(BadRequest()); } db.Entry(invited).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InvitedExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void SetPermissions(WebClient client, WebPermission permission) { if (!Invited.Contains(client)) { return; } WebPermission lastPermission; if (m_AccessControlDictionary.TryGetValue(client, out lastPermission)) { m_AccessControlDictionary[client] = permission; if (permission == WebPermission.None) { LeaveShare(client); } } else { lock (m_AccessControlDictionary) { m_AccessControlDictionary.Add(client, permission); } } }
public int?UpdateEventDetailsss(Invited c) { int?result = null; if (connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } MySqlCommand cmd = new MySqlCommand("update EventDetailsDB set event_status = 'Co The Tham Gia' where user_id = @EventDetails_ID and event_id = @EventDetailss_ID;", connection); try { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@EventDetails_ID", c.EventDetails_UserID); cmd.Parameters.AddWithValue("@EventDetailss_ID", c.EventDetails_EventID); result = cmd.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } finally { connection.Close(); } return(result); }
public int?AddEventDetailss(Invited c) { int?result = null; if (connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } MySqlCommand cmd = new MySqlCommand("insert into EventDetailsDB (event_id, user_id, event_status) values (@Event_ID, 2, 'Chua Biet'), (@Event_ID, 3, 'Chua Biet'), (@Event_ID, 4, 'Chua Biet'), (@Event_ID, 5, 'Chua Biet'), (@Event_ID, 6, 'Chua Biet'), (@Event_ID, 7, 'Chua Biet'), (@Event_ID, 8, 'Chua Biet'), (@Event_ID, 9, 'Chua Biet'), (@Event_ID, 10, 'Chua Biet'), (@Event_ID, 11, 'Chua Biet');", connection); try { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Event_ID", c.EventDetails_EventID); result = cmd.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } finally { } return(result); }
public void MenuDetails() { // string row1 = "========================================"; string row2 = "----------------------------------------"; Console.Clear(); Menus x = new Menus(); EventDetailsBL edbl = new EventDetailsBL(); Invited cc = new Invited(); EventBL ebl = new EventBL(); var lists = ebl.GetAllEvent(); var list = edbl.GetAllEvent(); int i = 0; foreach (var get in list) { if (get.EventDetails_UserID == 2) { i++; } } Console.WriteLine("Chào Bạn"); Console.WriteLine(row2); Console.WriteLine("1. Lời Mời Sự Kiện({0})", i); Console.WriteLine("2. Đăng Xuất"); Console.WriteLine(row2); Console.Write("Chọn :"); }
public async Task <IActionResult> Edit(int id, [Bind("Id")] Invited invited) { if (id != invited.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(invited); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InvitedExists(invited.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(invited)); }
public async Task <IHttpActionResult> PostInvited(Invited invited) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Invited.Add(invited); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (InvitedExists(invited.InvitedUserId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = invited.InvitedUserId }, invited)); }
internal void Invite(WebClient client) { if (!Invited.Contains(client)) { m_Invited.Add(client); } client.Send(new WebMessage("webShareInvite", ToJSON())); }
public async Task <IActionResult> Create([Bind("Id")] Invited invited) { if (ModelState.IsValid) { _context.Add(invited); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(invited)); }
public void MenuUser(User us, string un, string pw) { string row1 = "========================================"; // string row2 = "----------------------------------------"; Console.Clear(); Menus x = new Menus(); EventDetailsBL edbl = new EventDetailsBL(); Invited cc = new Invited(); EventBL ebl = new EventBL(); var lists = ebl.GetAllEvent(); var list = edbl.GetAllEvent(); int i = 0; foreach (var get in list) { if (get.EventDetails_UserID == 2) { i++; } } // Console.Write("=================>> Bạn có {0} lời mời tham gia sự kiện <<", Convert.ToString(i)); // string[] staffmenu = { "Lời Mời Sự Kiện", "Đăng xuất" }; do { Console.Clear(); Console.WriteLine(row1); Console.WriteLine("Chào Bạn"); MenuDetails(); // Console.WriteLine(row2); // Console.WriteLine("1. Lời Mời Sự Kiện({0})", i); // Console.WriteLine("2. Đăng Xuất"); // Console.WriteLine(row2); // Console.Write("Chọn :"); var staff = Console.ReadLine(); if (staff == " ") { Console.ReadLine(); } switch (staff) { case "1": x.ViewInvited(us, un, pw); break; case "2": Console.Clear(); MenuChoice(); break; } }while (true); }
public async Task <IHttpActionResult> GetInvited(string id) { Invited invited = await db.Invited.FindAsync(id); if (invited == null) { return(NotFound()); } return(Ok(invited)); }
public string ToJSON() { return(string.Format(formatJSONInfo, m_RoomId.ToString(), m_RoomName, m_Owner.PublicKey.ToString(), m_InviteOnly.ToString().ToLowerInvariant(), string.Join(",", Present.Select(p => p.PublicKey.ToString()).ToArray()), string.Join(",", Invited.Select(i => i.PublicKey.ToString()).ToArray()), string.Join(",", Banned.Select(b => b.PublicKey.ToString()).ToArray()))); }
public async Task <IHttpActionResult> DeleteInvited(string id) { Invited invited = await db.Invited.FindAsync(id); if (invited == null) { return(NotFound()); } db.Invited.Remove(invited); await db.SaveChangesAsync(); return(Ok(invited)); }
private void HandleInvitedRoomEvent(string roomId, InvitedRoom invitedRoom) { Log.LogTrace("Handling 'invited' room {RoomId}", roomId); var hasRoom = _rooms.TryGetValue(roomId, out var room); if (!hasRoom) { Log.LogTrace("Invited room {RoomId} did not exist, adding it", roomId); room = Room.FromInvitedRoom(roomId, invitedRoom); _rooms.TryAdd(roomId, room); } Invited?.Invoke(this, new InvitedEventArgs(room)); }
private IEnumerable <Claim> ToClaimsCore(bool initial) { if (!string.IsNullOrWhiteSpace(DisplayName)) { yield return(new Claim(SquidexClaimTypes.DisplayName, DisplayName)); } if (!string.IsNullOrWhiteSpace(PictureUrl)) { yield return(new Claim(SquidexClaimTypes.PictureUrl, PictureUrl)); } if (Hidden.HasValue) { yield return(new Claim(SquidexClaimTypes.Hidden, Hidden.ToString())); } if (Invited.HasValue) { yield return(new Claim(SquidexClaimTypes.Invited, Invited.ToString())); } if (Consent.HasValue) { yield return(new Claim(SquidexClaimTypes.Consent, Consent.ToString())); } if (ConsentForEmails.HasValue) { yield return(new Claim(SquidexClaimTypes.ConsentForEmails, ConsentForEmails.ToString())); } if (Permissions != null) { if (!initial) { yield return(new Claim(SquidexClaimTypes.Permissions, string.Empty)); } foreach (var permission in Permissions) { yield return(new Claim(SquidexClaimTypes.Permissions, permission.Id)); } } }
private Invited GetInvited(MySqlDataReader reader) { Invited c = new Invited(); c.EventDetails_EventID = reader.GetInt32("event_id"); c.EventDetails_UserID = reader.GetInt32("user_id"); c.Status = reader.GetString("event_status"); c.events = new Event(); c.events.Name_Event = reader.GetString("event_name"); c.events.Address_Event = reader.GetString("address"); c.events.Description = reader.GetString("description"); c.events.Time = reader.GetString("event_time"); c.users = new User(); c.users.Name = reader.GetString("name_user"); c.users.Phone = reader.GetString("phone_number"); c.users.Email = reader.GetString("Email"); return(c); }
public void Ban(WebClient client) { if (Invited.Contains(client)) { return; } //Ensure only 1 thread in m_Invited lock (m_Invited) { m_Invited.Add(client); } //If the user was present then make him leave if (Present.Contains(client)) { //Tell the client he was banned client.Que(new WebMessage("shareBan", ToJSON())); LeaveShare(client); } }
public List <Invited> GetAllEventDetails() { List <Invited> ev = new List <Invited>(); Invited c = new Invited(); string query = "select * from EventDetailsDB, EventDB, UserDB Where EventDetailsDB.user_id = UserDB.user_id and EventDetailsDB.event_id = EventDB.event_id;"; if (connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { while (reader.Read()) { ev.Add(GetInvited(reader)); } reader.Close(); } connection.Close(); return(ev); }
public int UpdateEventDetailsss(Invited e) { return(edal.UpdateEventDetailsss(e) ?? 0); }
public int AddEventDetailss(Invited e) { return(edal.AddEventDetailss(e) ?? 0); }
public void Inviting() { Menus x = new Menus(); UserBL ubl = new UserBL(); EventBL ebl = new EventBL(); EventDetailsBL edbl = new EventDetailsBL(); var list = ebl.GetAllEvent(); var lists = ubl.GetAllUser(); var listss = edbl.GetAllEvent(); Invited cc = new Invited(); Console.Clear(); while (true) { string lins = ("\n|=================================================================================================================|\n"); Console.WriteLine("\t\tDanh sách sự kiện"); Console.Write("\n|=================================================================================================================|\n"); Console.Write("| {0,-5} | {1,-35} | {2,-39} | {3,-15}|", "Mã Sự Kiện", "Tên Sự Kiện", "Địa chỉ Sự Kiện", "Ngày Giờ"); Console.Write(lins); foreach (var Event in list) { Console.WriteLine("| {0,-5} | {1,-35} | {2,-39} | {3,-15}|", Event.ID_Event, Event.Name_Event, Event.Address_Event, Event.Time); } Console.Write("|=================================================================================================================|\n"); if (cc.EventDetails_EventID == null) { Console.Write("- Nhập mã sự kiện: "); int p = Convert.ToInt32(Console.ReadLine()); cc.EventDetails_EventID = p; } else { Console.WriteLine("- Nhập mã sự kiện : " + cc.EventDetails_EventID); } string liness = ("|===============================================================================================================|"); Console.WriteLine("\t\tDanh Sách Người Dùng\t"); Console.Write("|===============================================================================================================|\n"); Console.Write("| {0,-15}\t| {1,-15}\t| {2,-5}\t| {3,-20}\t| {4,-20}\t|", "Mã Người Dùng", "Họ và Tên", "Năm Sinh", "Nghành Nghề", "Số Điện Thoại"); Console.Write("\n|===============================================================================================================|\n"); foreach (var User in lists) { Console.WriteLine("| {0,-15}\t| {1,-15}\t| {2,-5}\t| {3,-20}\t| {4,-20}\t|", User.User_ID, User.Name, User.Age, User.Job, User.Phone); } Console.WriteLine(liness); Console.Write("- Mời Người Dùng?"); Console.Write("\n 1. Mời Từng Người Dùng"); Console.Write("\n 2. Mời Tất Cả Người Dùng"); Console.Write("\n 0. Thoát"); Console.Write("\n- Chọn: "); string choices = Console.ReadLine(); switch (choices) { case "1": if (cc.EventDetails_UserID == null) { Console.Write("- Nhập mã người dùng : "); var p = Convert.ToInt32(Console.ReadLine()); cc.EventDetails_UserID = p; } else { Console.WriteLine("- Nhập mã người dùng : " + cc.EventDetails_UserID); } edbl.AddEventDetails(cc); Console.WriteLine("- Gửi Lời Mời Thành Công!"); break; case "2": edbl.AddEventDetailss(cc); Console.WriteLine("- Gửi Lời Mời Thành Công!"); break; case "0": break; default: // Console.WriteLine("Bạn Đã Nhập sai! Vui lòng nhập lại!"); break; } break; } Console.Write("- Nhập Phím Bất Kì Để Trờ Lại!................... "); Console.ReadLine(); }
public void ViewInvited(User us, string un, string pw) { Console.Clear(); Menus x = new Menus(); EventDetailsBL edbl = new EventDetailsBL(); Invited cc = new Invited(); EventBL ebl = new EventBL(); UserBL ubl = new UserBL(); var lists = ebl.GetAllEvent(); var list = edbl.GetAllEvent(); Console.Clear(); // string lin = ("\n|==================================================================================================================================================|"); Console.WriteLine("\t\tDanh sách lời mời sự kiện"); // Console.WriteLine("|==================================================================================================================================================|"); // Console.Write("|\n {0}\n {1}\n {2}\n {3}\n {4}\n {5} |", "No", "Tên sự kiện", "Địa chỉ", "Mô tả", "Thời gian", "Tình Trạng Tham Gia"); // Console.WriteLine(lin); Console.Write("\n================================================="); foreach (var Event in list) { if (ubl.Login(un, pw).User_ID == Convert.ToInt32(Event.EventDetails_UserID)) { Console.WriteLine("\n+ Mã Sự Kiện: {0}\n\n- Tên Sự Kiện: {1}\n- Địa Chỉ Sự Kiện: {2}\n- Mô Tả Sự Kiện: {3}\n- Thời Gian: {4}\n- Tình Trạng Tham Gia: {5}\n\n=================================================", Event.EventDetails_EventID, Event.events.Name_Event, Event.events.Address_Event, Event.events.Description, Event.events.Time, Event.Status); } } // Console.Write("|==================================================================================================================================================|\n"); cc.EventDetails_UserID = ubl.Login(un, pw).User_ID; Console.Write("\n--> Chọn Mã sự kiện để tham dự hoặc bấm 0 để thoát: "); int ss = Convert.ToInt32(Console.ReadLine()); cc.EventDetails_EventID = ss; switch (ss) { case 0: x.MenuUser(us, un, pw); break; default: // Console.WriteLine("Bạn Đã Nhập sai! Vui lòng nhập lại!"); break; } Console.Clear(); Console.Write("- Bạn có muốn tham gia sự kiện không?"); Console.Write("\n 1. Tham Gia"); Console.Write("\n 2. Không Tham Gia"); Console.Write("\n 3. Có Thể Tham Gia"); Console.Write("\n 0. Thoát"); Console.Write("\n- Chọn: "); string choices = Console.ReadLine(); switch (choices) { case "1": edbl.UpdateEventDetailss(cc); Console.Write("- Thao Tác Thành Công!"); break; case "2": edbl.UpdateEventDetails(cc); Console.Write("- Thao Tác Thành Công!"); break; case "3": edbl.UpdateEventDetailsss(cc); Console.Write("- Thao Tác Thành Công!"); break; case "0": break; default: // Console.WriteLine("Bạn Đã Nhập sai! Vui lòng nhập lại!"); break; } Console.Write("\n- Nhập Phím Bất Kỳ Để Trờ Lại......................................."); Console.ReadKey(); }
private void OnInvited(InvitationRequest invite) { Invited?.Invoke(this, invite); }
public void InviteAll() { Invite(Invited.Where(c => !Present.Contains(c))); }