?? sendmessage.aspx.cs
字號:
using System;
using System.Data;
using qminoa.Common.Data;
using qminoa.Webs.Msg.module;
using qminoa.DA;
namespace qminoa.Webs.Msg
{
/// <summary>
/// SendMessage 的摘要說明。
/// </summary>
public class SendMessage : qminoa.Webs.PageBase
{
protected qminoa.Webs.Msg.module.ResiveModule uctrlResive;
protected qminoa.Webs.Msg.module.AccessoryModule uctrlAccessory;
protected string str_NoticeMsg ;
protected HangamaHouse.RTFBox RtfBox1;
private string flag = string.Empty;
private string msgid = string.Empty;
protected System.Web.UI.WebControls.TextBox txtflag;
protected System.Web.UI.HtmlControls.HtmlGenericControl divID1;
protected System.Web.UI.HtmlControls.HtmlGenericControl divID2;
protected System.Web.UI.HtmlControls.HtmlGenericControl divID3;
protected System.Web.UI.WebControls.LinkButton lbtnRec1;
protected System.Web.UI.WebControls.LinkButton lbtnAcc1;
protected System.Web.UI.WebControls.LinkButton lbtnBase2;
protected System.Web.UI.WebControls.LinkButton lbtnAcc2;
protected System.Web.UI.WebControls.LinkButton lbtnBase3;
protected System.Web.UI.WebControls.LinkButton lbtnRec3;
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.TextBox calshow;
protected System.Web.UI.HtmlControls.HtmlButton btnOK;
protected System.Web.UI.WebControls.Calendar calSend;
protected System.Web.UI.WebControls.TextBox txtSend;
protected System.Web.UI.WebControls.Label lblCont;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredTitle;
protected System.Web.UI.WebControls.TextBox txtTitle;
protected System.Web.UI.WebControls.Label lblTitle;
protected System.Web.UI.WebControls.RadioButton radnormal;
protected System.Web.UI.WebControls.RadioButton radImportant;
protected System.Web.UI.WebControls.Label lblImportant;
protected System.Web.UI.WebControls.TextBox txt;
protected System.Web.UI.WebControls.ImageButton btnImgSend;
private void Page_Load(object sender, System.EventArgs e)
{
this.PageBegin("發送信息",false);
if(txtTitle.Text == "<>")
{
txtTitle.Text = "";
}
if( txtSend.Text == "<>")
{
txtSend.Text = "";
}
if ( "" == txtSend.Text)
{
txtSend.Text = DateTime.Now.ToString("d");
}
flag = Request.Params["flag"].ToString();
if(!IsPostBack)
{
if(Session["isNoticed"] == null)
{
str_NoticeMsg = "onload=\"javascript:window.open('MessageNotice.aspx','','top=1000,left=1000')\"";
Session["isNoticed"] = "1";
}
if( flag == "2")
{
msgid = Request.Params["MessageID"].ToString();
DataSet data = (new MsgObj()).SeeDraft(msgid,this.Empid);
txtTitle.Text = data.Tables["draftmsg"].Rows[0]["Title"].ToString();
RtfBox1.Text = data.Tables["draftmsg"].Rows[0]["Content"].ToString();
if("" != data.Tables["draftmsg"].Rows[0]["SendTo"].ToString())
{
string [] Send = new string[2];
Send[0] = data.Tables["draftmsg"].Rows[0]["SendTo"].ToString();
Send[1] = data.Tables["draftmsg"].Rows[0]["SendToID"].ToString();
uctrlResive.Send = Send;
}
if( "" != data.Tables["draftmsg"].Rows[0]["SecretTo"].ToString())
{
string [] Secret = new string [2];
Secret[0] = data.Tables["draftmsg"].Rows[0]["SecretTo"].ToString();
Secret[1] = data.Tables["draftmsg"].Rows[0]["SecretTo"].ToString();
uctrlResive.Secret = Secret;
}
uctrlAccessory.Accessory = data.Tables["draftmsg"].Rows[0]["Accessory"].ToString();
uctrlAccessory.AccessoryID = data.Tables["draftmsg"].Rows[0]["AccessoryID"].ToString();
txtSend.Text = Convert.ToDateTime(data.Tables["draftmsg"].Rows[0]["SendDate"].ToString()).Date.ToString("d");
string fdd = data.Tables["draftmsg"].Rows[0]["Important"].ToString();
if( "True" == data.Tables["draftmsg"].Rows[0]["Important"].ToString())
{
radImportant.Checked = true;
}
else
{
radnormal.Checked = true;
}
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:該調用是 ASP.NET Web 窗體設計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
this.btnOK.ServerClick += new System.EventHandler(this.btnOK_ServerClick);
this.calSend.SelectionChanged += new System.EventHandler(this.calSend_SelectionChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void calSend_SelectionChanged(object sender, System.EventArgs e)
{
if(DateTime.Parse(calSend.SelectedDate.ToString("d"))<DateTime.Parse( DateTime.Now.ToString("d")))
{
Response.Write("<script language='javascript'>alert('發送時間不能早于今天')</script>");
calshow.Text = "1";
}
else
{
txtSend.Text = calSend.SelectedDate.ToString("d");
calshow.Text = "";
}
}
private void btnOK_ServerClick(object sender, System.EventArgs e)
{
MsgCont msgobj = GetMsgObj();
if(msgobj.SendToID != null || msgobj.SecretTo != null)
{
if("2" == flag)
{
(new MsgObj()).InsertAgain(Request.Params["MessageID"].ToString(),msgobj,0);
}
else
{
(new MsgObj()).InsertMessage(msgobj,"發送",Convert.ToInt16(this.Empid));
}
Response.Redirect("MessageDo.aspx?flag=1");
}
}
private void btnSave_Click(object sender, System.EventArgs e)
{
MsgCont msgobj = GetMsgObj();
if( msgobj.Title == "")
{
msgobj.Title = "@草稿:";
}
if(null != msgobj)
{
if("2" == flag)
{
(new MsgObj()).InsertAgain(Request.Params["MessageID"].ToString(),msgobj,2);
}
else
{
(new MsgObj()).InsertMessage(msgobj,"保存",Convert.ToInt16(this.Empid));
}
}
Response.Redirect("MessageDo.aspx?flag=2");
}
public MsgCont GetMsgObj()
{
MsgCont msgobj = new MsgCont();
msgobj.Title = txtTitle.Text;
msgobj.Content = RtfBox1.Text;
if( txtSend.Text != "")
msgobj.SendTime = Convert.ToDateTime(txtSend.Text);
else
msgobj.SendTime = DateTime.Now;
string [] send = uctrlResive.Send;
msgobj.SendTo = send[0];
msgobj.SendToID = send[1];
string [] secret = uctrlResive.Secret;
msgobj.SecretTo = secret[0];
msgobj.SecretToID = secret[1];
msgobj.Accessory = uctrlAccessory.Accessory;
msgobj.AccessoryID = uctrlAccessory.AccessoryID;
if( true == radImportant.Checked)
msgobj.Important = true;
else
msgobj.Important = false;
return msgobj;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -