protected void btnSend_Click(object sender, EventArgs e) { if(drpRecipient.SelectedValue.Length >0 && Header.Text.Length > 0 && Body.Text.Length > 0 && SessionProps.UserGuid != Guid.Empty) { using (var db = Global.GetConnection()) { var message = new Ext_Message(); message.FromUserGUID = SessionProps.UserGuid; message.Header = Header.Text; message.Body = Body.Text; message.SentDate = DateTime.Now; var recipient = new Ext_MessageRecipient(); recipient.MessageGUID = message.GUID; recipient.RecipientUserGUID = new Guid(drpRecipient.SelectedValue); db.Ext_Message.InsertOnSubmit(message); db.Ext_MessageRecipient.InsertOnSubmit(recipient); db.SubmitChanges(); pnlEditControls.Visible = false; pnlSuccessControls.Visible = true; lblSuccessMessage.Text = "Meddelandet är skickat"; } } else { lblMessage.Text = "Kunde inte skicka meddelandet, ämne, text och mottagare måste fyllas i."; } }
private void DenyChallenge(Guid tournamentGUID, Guid teamGUID) { using (var db = Global.GetConnection()) { var challenge = db.Ext_PrivateTournamentParticipant.Single( ptp => ptp.PrivateTournamentGUID == tournamentGUID && ptp.TeamGUID == teamGUID); db.Ext_PrivateTournamentParticipant.DeleteOnSubmit(challenge); //skicka meddelande till den som utmanat var message = new Ext_Message(); message.Header = "Utmaning nekad"; message.Body = String.Format("{0} ({1} {2}) vill inte vara med i din utmaning \"{3} \"", challenge.Inti_Team.Name, challenge.Inti_Team.Sys_User.FirstName, challenge.Inti_Team.Sys_User.LastName, challenge.Ext_PrivateTournament.Name); message.FromUserGUID = SessionProps.UserGuid; message.SentDate = DateTime.Now; var recipient = new Ext_MessageRecipient(); recipient.MessageGUID = message.GUID; recipient.RecipientUserGUID = challenge.Ext_PrivateTournament.UserGUID; db.Ext_MessageRecipient.InsertOnSubmit(recipient); db.Ext_Message.InsertOnSubmit(message); lblPrivateTournaments.Text = String.Format("Du har tackat nej till utmaningen (ett meddelande har skickats till {0} {1}).", challenge.Ext_PrivateTournament.Sys_User.FirstName, challenge.Ext_PrivateTournament.Sys_User.LastName); db.SubmitChanges(); LoadPrivateTournaments(); } }
private void detach_Ext_Message(Ext_Message entity) { this.SendPropertyChanging(); entity.Sys_User = null; }
partial void DeleteExt_Message(Ext_Message instance);
partial void UpdateExt_Message(Ext_Message instance);
partial void InsertExt_Message(Ext_Message instance);