using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web.Security;
using System.Web;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using System.Web.UI.HtmlControls;
using System.Threading;
using System.Text;
using System.Net;
using System.IO;
using OmegaLove.BLL;
using DataTransfer.Tables;
namespace OmegaLove.Web.UI.Pages
{
allgemeine teilweise Kategorie ShowMessage: OmegaLoveBasePage
{
private statische Schnur UserId = Null;
private statische Schnur ToUserProfileID = Null;
private statische Schnur FromUserProfileID = Null;
private statische Schnur FromUserName = Null;
private statische Schnur ToUserName = Null;
private statische Schnur ToUserEmailAddress = Null;
private statische Schnur UserEmailAddress = Null;
private statische Schnur MessageID, InitialMessageID = Null;
private statische tbl_Messages tbl_Messages = neue tbl_Messages ();
allgemeine statische Schnur ConnnectionString = ConfigurationManager.ConnectionStrings [„omegaloveConnectionString“] .ToString ();
geschütztes leeres Page_Load (Gegenstandabsender, EventArgs e)
{
wenn (! (HttpContext.Current.User.Identity.IsAuthenticated))
Response.Redirect („~/Login.aspx“);
wenn (! IsPostBack)
{
wenn (Request.QueryString.HasKeys () &&! String.IsNullOrEmpty (Request.QueryString [„MessageId“]))
{
MessageID = Request.QueryString [„MessageID“];
FromUserProfileID = Request.QueryString [„FromProfileID“];
FromUserName = Request.QueryString [„FromUsername“];
ToUserName = Lernabschnitt [„FromUserName“] == Null? Null: Lernabschnitt [„FromUserName“] .ToString ();
lblFrom.Text = „von“;
lblTo.Text = „zu“;
lblTime.Text = „Datum gesendet“;
lblSubject.Text = „Thema“;
lblMess.Text = „Mitteilung“;
GetMessage (MessageID);
DisplayUserImage ();
}
}
}
privates leeres GetMessage (Schnur MessageID)
{
DataTable dtMessage = neues DataTable ();
dtMessage = DataBase.Procedures.prc_Messages_Select.ToDataTable (ConnnectionString, Convert.ToInt32 (MessageID));
DataTable dtToEmail = neues DataTable ();
DataTable dtFromEmail = neues DataTable ();
dtToEmail = DataBase.Procedures.prc_Profile_Select.ToDataTable (ConnnectionString, FromUserName);
dtFromEmail = DataBase.Procedures.prc_Profile_Select.ToDataTable (ConnnectionString, ToUserName);
ToUserEmailAddress = dtToEmail.Rows [0] [„EmailAddress“] .ToString ();
UserEmailAddress = dtFromEmail.Rows [0] [„EmailAddress“] .ToString ();
ToUserProfileID = dtFromEmail.Rows [0] [„ProfileID“] .ToString ();
lblMessage.Text = dtMessage.Rows [0] [„Körper“] .ToString ();
lblFromUsername.Text = dtMessage.Rows [0] [„FromUserName“] .ToString ();
lblToUsername.Text = ToUserName;
lblToUser.Text = FromUserName;
lblMessageTime.Text = dtMessage.Rows [0] [„MsgDate“] .ToString ();
lblMessage.Text = dtMessage.Rows [0] [„Körper“] .ToString ();
lblSubjectMessage.Text = dtMessage.Rows [0] [„Thema“] .ToString ();
InitialMessageID = dtMessage.Rows [0] [„InitialMessageID“] .ToString ();
}
geschütztes leeres SubmitMessage_Click (Gegenstandabsender, ImageClickEventArgs e)
{
wenn (Page.IsValid)
{
wenn (MessageID == „0“)
{
//-neue Mitteilungen
sendMessage ();
}
sonst
{
// für Antwort-Mitteilungen
wenn (InitialMessageID == „0“)
InitialMessageID = MessageID;
sendMessage (, Convert.ToString (MessageID), InitialMessageID) ausrichten;
}
}
}
privates leeres sendMessage ()
{
sendMessage (falsch, ungültig, Null);
}
privates leeres sendMessage (Boolesches IsReply, Schnur CurrentMessageID, Schnur InitialMessageID)
{
tbl_Messages tbl_Messages = neue tbl_Messages ();
tbl_Messages.ProfileID = Convert.ToInt32 (FromUserProfileID);
tbl_Messages.FromProfileID = Convert.ToInt32 (ToUserProfileID);
tbl_Messages.Subject = txtSubject.Text;
tbl_Messages.Body = txtMessage.Text;
tbl_Messages.FromUsername = ToUserName;
tbl_Messages.MsgDate = DateTime.Now;
tbl_Messages.MsgNew = 1;
tbl_Messages.MsgRead = 1;
tbl_Messages.MsgReplied = Convert.ToByte (IsReply); //-neue Mitteilung (0)/Antwort-Mitteilung (1)
wenn (IsReply)
{
tbl_Messages.ReplyOfMessageID = Convert.ToInt32 (CurrentMessageID);
tbl_Messages.InitialMessageID = Convert.ToInt32 (InitialMessageID);
}
int returnValue = 0;
Versuch
{
returnValue = DataBase.prc_Messages_Save.Execute (ConnnectionString, tbl_Messages);
wenn (returnValue > 0)
{
SMTPManager.SendEmail (UserEmailAddress, FromUserName, ToUserEmailAddress, txtMessage.Text, txtSubject.Text, falsch);
}
}
Fang (Ausnahme)
{
Wurf;
}
//lblMessage.Text = „Post erfolgreich gesendet! “;
//Thread.Sleep (2000);
Response.Redirect („~/Secure/MailBox.aspx“);
}
privates leeres DisplayUserImage ()
{
DataTable Papierlösekorotron = neues DataTable ();
Papierlösekorotron = DataBase.Procedures.prc_Profile_Select.ToDataTable (ConnnectionString, FromUserName);
DataTable dtPhotos = neues DataTable ();
dtPhotos = DataBase.Procedures.prc_Fotos_Select_Primary.ToDataTable (ConnnectionString, Convert.ToInt32 (Papierlösekorotron. Reihen [0] [„ProfileID“]));
// erhalten img-Identifikation von datatable.
wenn (((dtPhotos! = Null) && (dtPhotos.Rows.Count > 0)))
{
wenn (Convert.ToBoolean (dtPhotos.Rows [0] [„p_Primary“]))
{
imgPhoto.ImageUrl = „ShowImage.ashx? img_id=“ + dtPhotos.Rows [0] [„PhotoID“] .ToString () + „u.“ + „imagesize=T“ + „u.“ + „imageisprimary=“ + „ausrichten“ +“ '„;
}
sonst
{
wenn (Papierlösekorotron. Rudert [0] [„Geschlecht“,] .ToString () == „1“)
imgPhoto.ImageUrl = „~/Images/NoPictures/no_photo_white_m_m.jpg“;
sonst
imgPhoto.ImageUrl = „~/Images/NoPictures/no_photo_white_f_m.jpg“;
}
}
sonst // dort ist kein Primärbild.
{
wenn (Papierlösekorotron. Rudert [0] [„Geschlecht“,] .ToString () == „1“)
imgPhoto.ImageUrl = „~/Images/NoPictures/no_photo_white_m_m.jpg“;
sonst
imgPhoto.ImageUrl = „~/Images/NoPictures/no_photo_white_f_m.jpg“;
}
}
}
}
|