Exemplo n.º 1
0
        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.";
            }
        }
Exemplo n.º 2
0
        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_MessageRecipient(Ext_MessageRecipient entity)
		{
			this.SendPropertyChanging();
			entity.Sys_User = null;
		}
 partial void DeleteExt_MessageRecipient(Ext_MessageRecipient instance);
 partial void UpdateExt_MessageRecipient(Ext_MessageRecipient instance);
 partial void InsertExt_MessageRecipient(Ext_MessageRecipient instance);
		private void attach_Ext_MessageRecipient(Ext_MessageRecipient entity)
		{
			this.SendPropertyChanging();
			entity.Ext_Message = this;
		}