protected void Page_Load(object sender, EventArgs e) { //以下為測試是使用,發佈前請註釋掉 Session["UserID"] = "D003842"; // 做刪除時,把帳號也傳入AP端. // 只有Owner ID與ToDo ID與傳入參數完全一致時,才能執行刪除操作, // 可防止有人直接在瀏覽器地址網篡改網址進行惡意操作. // 如果 todoitemedit.aspx?r_id=隨意輸入一個數字, 如果DB中有這條記錄就會被刪除. if (Session["UserID"] != null) { if (Request["id"] != null) { // 讀取ToDoItem數據(進入修改狀態) // 事項編號 Session["ToDoItemID"] = Request["id"].ToString(); WCFHelperBase wcfBase = new WCFHelperBase(); DataSet dsData = wcfBase.csHelper.GetToDoItem(Request["id"].ToString()); wcfBase.CloseWCF(); } } }
protected void Page_Load(object sender, EventArgs e) { Session["ToDoItemID"] = null; Session["ToDoItemFlag"] = null; Session["ToDoItemSection"] = null; Session["ToDoMsgAnchor"] = ""; Session["ToDoMaxMsgID"] = ""; //是否正在檢查新訊息(收message.ashx控製) Session["CheckNewMsg"] = "N"; if (Request["id"] != null) { // 事項編號 Session["ToDoItemID"] = Request["id"].ToString(); WCFHelperBase wcfBase = new WCFHelperBase(); DataSet dsData = wcfBase.csHelper.GetToDoItem(Request["id"].ToString()); wcfBase.CloseWCF(); if (dsData.Tables.Count == 3) { // 正文 string Context_Result = ""; DataTable dtToDo = dsData.Tables[0]; if (dtToDo.Rows.Count > 0) { // Flag Session["ToDoItemFlag"] = this.GetFlag(dtToDo.Rows[0]); // Title Context_Result += this.GenerateArticleTitle(dtToDo.Rows[0]); // 先點掉 // Context // Context_Result += this.GenerateArticleContext(dtToDo.Rows[0], dsData.Tables[1]); // 新Context Context_Result += this.GenerateArticleContext(dtToDo.Rows[0], dsData.Tables[1], dsData.Tables[2]); //, dsData.Tables[3] Session["ToDoItemSection"] = Context_Result; //// 記錄Msg錨點(載入更多則以此ID為錨點)和最大id(定時載入新訊息抓此ID以后的訊息) //if (dsData.Tables[3].Rows.Count > 0) //{ // //Msg錨點(載入更多則以此ID為錨點) // Session["ToDoMsgAnchor"] = dsData.Tables[3].Rows[dsData.Tables[3].Rows.Count - 1]["msgid"].ToString(); // //最大id(定時載入新訊息抓此ID以后的訊息) // Session["ToDoMaxMsgID"] = dsData.Tables[3].Rows[0]["msgid"].ToString(); //} //else //{ // Session["ToDoMsgAnchor"] = ""; // Session["ToDoMaxMsgID"] = ""; //} } else { dtToDo.Dispose(); dtToDo = null; dsData = null; // 去錯誤頁面 Session["ToDoItemSection"] = "<img class=\"am-center\" src=\"images/error.png\" />" + "\r\n" + "<div class=\"am-text-warning am-text-center am-text-xl\">哎呀...暫時無法找到您的待辦事項!</div>" + "\r\n" + "<div class=\"am-text-warning am-text-center\">Opps...The To-do item you're looking for cannot be found.</div>" + "\r\n"; } dtToDo.Dispose(); dtToDo = null; dsData = null; } else { dsData = null; // 去錯誤頁面 Session["ToDoItemSection"] = "<img class=\"am-center\" src=\"images/error.png\" />" + "\r\n" + "<div class=\"am-text-warning am-text-center am-text-xl\">哎呀...暫時無法找到您的待辦事項!</div>" + "\r\n" + "<div class=\"am-text-warning am-text-center\">Opps...The To-do item you're looking for cannot be found.</div>" + "\r\n"; } } else { // 回首頁 //Response.Redirect("home.aspx?tabpage=0"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("home.aspx?tabpage=0"); } }
public bool SendActivateMail() { bool rtn = false; if (UserNO.Length > 0 && UserEmail.Length > 0) { // 發送驗證郵件 try { // 郵件Server信息 //string[] SendInfo = new string[4]; //SendInfo[0] = (string)ConfigurationManager.AppSettings["EmailSender"]; //SendInfo[1] = SymmetricMethod.Decrypt((string)ConfigurationManager.AppSettings["EmailPassWord"]); //SendInfo[2] = (string)ConfigurationManager.AppSettings["EmailIP"]; //SendInfo[3] = (string)ConfigurationManager.AppSettings["EmailPort"]; // 得到用戶名和Key WCFHelperBase wcfBase = new WCFHelperBase(); wcfBase.csHelper.UpdateActKey(UserNO); string ticket = ""; string verifyid = ""; DataTable dtUser = wcfBase.csHelper.GetUserInfo(UserNO); wcfBase.CloseWCF(); string UserName = UserNO; if (dtUser.Rows.Count > 0) { UserName = dtUser.Rows[0]["user_name"].ToString(); verifyid = dtUser.Rows[0]["uid"].ToString(); ticket = dtUser.Rows[0]["user_actkey"].ToString(); string toAddr = UserEmail; // 收件人 string ccAddr = ""; // cc //string ticket = Guid.NewGuid().ToString().Replace("-", ""); // 加密后的字符可能會有"+"號,所以必須用HttpUtility.UrlEncode轉一下 //string verifyid = HttpUtility.UrlEncode(this.EncryptTicket(UserNO, ticket)); // 試試 Uri.EscapeDataString() //string verifyid = this.EncryptTicket(UserNO, ticket); //verifyid = Uri.EscapeDataString(verifyid); string link = "http://221.12.28.220/todomobile/verify.aspx?verifyid=" + verifyid + "&ticket=" + ticket; string subject = "ToDo Manager -- 激活你的帳號"; //string attach = ""; //SendEmails.SendMailByPlainFormat(SendInfo, toAddr, ccAddr, mailContent, subject, attach); //Test //SendEmails.SendMailByPlainFormat(SendInfo, toAddr, ccAddr, GetTestMailContext(UserName, UserNO, link), subject, attach); //改為用郵件服務(WebService)來發 try { DataTable dtMail = new DataTable("dtMail"); DataColumn col1 = new DataColumn("lr_to", typeof(string)); DataColumn col2 = new DataColumn("lr_cc", typeof(string)); DataColumn col3 = new DataColumn("lr_subject", typeof(string)); DataColumn col4 = new DataColumn("lr_content", typeof(string)); DataColumn col5 = new DataColumn("lr_type", typeof(string)); DataColumn col6 = new DataColumn("lr_ftype", typeof(string)); dtMail.Columns.Add(col1); dtMail.Columns.Add(col2); dtMail.Columns.Add(col3); dtMail.Columns.Add(col4); dtMail.Columns.Add(col5); dtMail.Columns.Add(col6); DataRow row = dtMail.NewRow(); row["lr_to"] = toAddr; row["lr_cc"] = ccAddr; row["lr_subject"] = subject; row["lr_content"] = GetTestMailContext(UserName, UserNO, link); row["lr_type"] = "2"; row["lr_ftype"] = "1"; dtMail.Rows.Add(row); dtMail.AcceptChanges(); //開始發送 WSHelperBase WSBase = new WSHelperBase(); WSBase.mmsHelper.InsertMailAndMessageForData(dtMail); dtMail.Dispose(); dtMail = null; } catch { } //返回(成功) rtn = true; } else { //返回(失敗) rtn = false; } dtUser.Dispose(); dtUser = null; } catch { //返回(失敗) rtn = false; } } else { //返回(失敗) rtn = false; } return rtn; }
protected void Page_Load(object sender, EventArgs e) { //Session["UserID"] = "D003842"; if (Session["UserID"] != null) { Session["PwdErrorVisible"] = "style=\"display:none;\""; try { if (Request["user_name"] == null && Request["user_psword"] == null) { // 顯示用戶信息 WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtUserData = wcfBase.csHelper.GetUserInfo(Session["UserID"].ToString()); wcfBase.CloseWCF(); if (dtUserData.Rows.Count > 0) { Session["UserNo"] = dtUserData.Rows[0]["user_no"].ToString(); Session["UserName"] = dtUserData.Rows[0]["user_name"].ToString(); Session["UserNickname"] = dtUserData.Rows[0]["user_nickname"].ToString(); Session["UserEmail"] = dtUserData.Rows[0]["user_email"].ToString(); Session["UserCellphone"] = dtUserData.Rows[0]["user_cellphone"].ToString(); dtUserData.Dispose(); dtUserData = null; } else { // 發生異常 dtUserData.Dispose(); dtUserData = null; //Response.Redirect("logout.aspx"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("logout.aspx"); } } else { // 修改 WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtUserData = wcfBase.csHelper.GetUserInfo(Session["UserID"].ToString()); if (dtUserData.Rows.Count > 0) { bool Passed = false; DataRow AccountRow = dtUserData.Rows[0]; if (Request["user_info"] != null) { // 用戶信息 AccountRow["user_name"] = Request["user_name"].ToString().Trim(); AccountRow["user_nickname"] = Request["user_nickname"].ToString().Trim(); AccountRow["user_email"] = Request["user_email"].ToString().Trim(); AccountRow["user_cellphone"] = Request["user_cellphone"].ToString(); Passed = true; } else if (Request["user_pwd"] != null) { // 用戶密碼 if (Request["user_psword_old"].ToString() == AccountRow["user_psword"].ToString()) { AccountRow["user_psword"] = Request["user_psword"].ToString().Trim(); Passed = true; } else { // 密碼錯誤 Session["PwdErrorVisible"] = ""; } } if (Passed) { // 更新現有AccountRow,再傳到AP端更新 DataTable dtParameters = AccountRow.Table.Clone(); dtParameters.Rows.Add(AccountRow.ItemArray); dtParameters.AcceptChanges(); bool rtn = wcfBase.csHelper.UpdateAccountData(false, dtParameters, Session["UserNo"].ToString().Trim()); dtParameters.Dispose(); dtParameters = null; dtUserData.Dispose(); dtUserData = null; wcfBase.CloseWCF(); //am-btn am-btn-danger am-btn-xs am-icon-exclamation-triangle if (rtn) { // 修改成功 Session["UserNo"] = null; //Session["UserName"] = null; // 這個欄位有用 Session["UserNickname"] = null; Session["UserEmail"] = null; Session["UserCellphone"] = null; // 跳轉到成功頁面. //Response.Redirect("home.aspx?tabpage=0"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("home.aspx?tabpage=0"); } } else { dtUserData.Dispose(); dtUserData = null; wcfBase.CloseWCF(); } } else { // 發生異常 wcfBase.CloseWCF(); dtUserData.Dispose(); dtUserData = null; //Response.Redirect("logout.aspx"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("logout.aspx"); } } } catch { } } }
/// <summary> /// 主頁 /// </summary> /// <returns></returns> private string GenerateHomePage() { string rtn = ""; //.am-text-xs - 12px //.am-text-sm - 14px //.am-text-default - 16px //.am-text-lg - 18px //.am-text-xl - 24px //.am-text-xxl - 32px //.am-text-xxxl - 42px string Part_ToDo = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><a href=\"home.aspx?tabpage=2\"><strong class=\"am-text-success am-text-lg\">我要做的</strong></a> / <small>按實際開工日期排序</small></div>" + "\r\n" + " <div class=\"custum-todoitem-date am-fr am-margin-right-xs am-margin-top-xs\">降序</div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Assigned = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><a href=\"home.aspx?tabpage=3\"><strong class=\"am-text-primary am-text-lg\">我發出的</strong></a> / <small>按建檔日期排序</small></div>" + "\r\n" + " <div class=\"custum-todoitem-date am-fr am-margin-right-xs am-margin-top-xs\">降序</div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Section_Begin = "<section data-am-widget=\"accordion\" class=\"am-accordion am-accordion-default am-margin-top-0 am-margin-left-0 am-margin-right-0\" data-am-accordion='{ \"multiple\": true }'>" + "\r\n"; // {0} = 跳連頁碼(0=主頁;1=記事本;2=我要做的;3=我發出的) string Part_Show_All = "<a href=\"home.aspx?tabpage={0}\" class=\"am-btn am-center am-btn-sm am-btn-default\">查看全部</a>" + "\r\n"; string Part_Section_End = "</section>" + "\r\n"; string No_Context = "<div class=\"custum-todoitem-no-content\">無內容</div>" + "\r\n"; string Mark_Top = "<span class=\"am-badge am-badge-warning am-round am-margin-top-xs am-fr\">置頂</span>" + "\r\n"; string Mark_Overdue = "<span class=\"am-badge am-badge-danger am-round am-margin-top-xs am-fr\">逾期</span>" + "\r\n"; string Mark_Onhold = "<span class=\"am-badge am-round am-margin-top-xs am-fr\">擱置</span>" + "\r\n"; // {0} = 派發人或執行人 string Owner_Executer = "<span class=\"am-text-default am-text-sm\">- {0}</span>"; // {0} = 標題 (手機Web客戶端開發) // {1} = 日期 (今天,昨天,2015/11/03) // {2} = 派發人或執行人 // {3} = 事項的ID // {4} = 置頂 // {5} = 逾期 // {6} = 正文 (1.基本框架搭建.<br />2.登陸頁面開發<br />4.其他...) // {7} = 未讀 粗體 "style=\"font-weight:bold;\"" // {8} = 旗子 // {9} = 擱置 string Context = "<dl class=\"am-accordion-item\">" + "\r\n" + " <dt class=\"am-accordion-title " + Session["TitileSize"].ToString() + "\" {7}>{8}{0}" + "\r\n" + " <span class=\"custum-todoitem-date\">[{1}]</span>" + "\r\n" + " {2}" + "\r\n" + " <a href=\"todoitem.aspx?id={3}\">" + "\r\n" + " <i class=\"am-header-icon am-icon-info-circle am-fr\"></i>" + "\r\n" + " </a>" + "\r\n" + " {9}" + "\r\n" + " {4}" + "\r\n" + " {5}" + "\r\n" + " </dt>" + "\r\n" + " <dd class=\"am-accordion-bd am-collapse\">" + "\r\n" + " <div class=\"am-accordion-content\">" + "\r\n" + " {6}" + "\r\n" + " </div>" + "\r\n" + " </dd>" + "\r\n" + "</dl>" + "\r\n"; WCFHelperBase wcfBase = new WCFHelperBase(); DataSet dsData = wcfBase.csHelper.GetHomePageData(Session["UserID"].ToString()); wcfBase.CloseWCF(); if (dsData.Tables.Count == 2) { #region " 我要做的 " DataTable dtToDo = dsData.Tables[0]; if (dtToDo.Rows.Count > 0) { #region " 有待辦事項 " rtn += Part_ToDo; string Context_Result = ""; string Title = "", Date = ""; foreach (DataRow row in dtToDo.Rows) { Title = this.GetTile(row["td_seq"].ToString() + "." + row["td_name"].ToString()); Date = this.GetDateDesc(row["td_date"].ToString()); Context_Result += string.Format(Context, Title, Date, row["todo_type"].ToString() == "2" ? string.Format(Owner_Executer, row["user_name"].ToString()) : "", row["td_no"].ToString(), row["td_top"].ToString() == "Y" ? Mark_Top : "", row["td_overdue"].ToString() == "Y" ? Mark_Overdue : "", row["td_description"].ToString().Replace("\r\n", "<br />"), row["td_state"].ToString() == "0" ? "style=\"font-weight:bold;\"" : "", this.GetFlag(row["td_flag"].ToString()), row["td_hold"].ToString() == "Y" ? Mark_Onhold : ""); } rtn += (Part_Section_Begin + Context_Result + string.Format(Part_Show_All, "2") + Part_Section_End); // 我要做的 #endregion } else { #region " 無待辦事項 " rtn += Part_ToDo + "\r\n"; // 我要做的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } dtToDo.Dispose(); dtToDo = null; #endregion #region " 我發出的 " DataTable dtAssigned = dsData.Tables[1]; if (dtAssigned.Rows.Count > 0) { #region " 有待辦事項 " rtn += Part_Assigned; string Context_Result = ""; string Title = "", Date = ""; foreach (DataRow row in dtAssigned.Rows) { Title = this.GetTile(row["td_seq"].ToString() + "." + row["td_name"].ToString()); Date = this.GetDateDesc(row["td_date"].ToString()); Context_Result += string.Format(Context, Title, Date, string.Format(Owner_Executer, row["user_name"].ToString()), row["td_no"].ToString(), row["td_top"].ToString() == "Y" ? Mark_Top : "", row["td_overdue"].ToString() == "Y" ? Mark_Overdue : "", row["td_description"].ToString().Replace("\r\n", "<br />"), row["td_state"].ToString() == "0" ? "style=\"font-weight:bold;\"" : "", this.GetFlag(row["td_flag"].ToString()), row["td_hold"].ToString() == "Y" ? Mark_Onhold : ""); } rtn += (Part_Section_Begin + Context_Result + string.Format(Part_Show_All, "3") + Part_Section_End); // 我發出的 #endregion } else { #region " 無待辦事項 " rtn += Part_Assigned + "\r\n"; // 我發出的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } dtAssigned.Dispose(); dtAssigned = null; #endregion } else { #region " 發生異常 " rtn += Part_ToDo + "\r\n"; // 我要做的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 rtn += Part_Assigned + "\r\n"; // 我發出的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } return rtn; }
/// <summary> /// 我發出的 /// </summary> /// <returns></returns> private string GenerateAssignedPage() { string rtn = ""; //{0} 項目數 string Part_InProcess = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><strong class=\"am-text-success am-text-lg\">未完成的</strong> / <small>按建檔日期排序 - 降序</small></div>" + "\r\n" + " <div class=\"custum-todoitem-date am-fr am-margin-right-xs am-margin-top-xs\">({0})</div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; //{0} 項目數 string Part_Complete = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><strong class=\"am-text-warning am-text-lg\">已完成的</strong> / <small>按實際完工日期排序 - 降序</small></div>" + "\r\n" + " <div class=\"custum-todoitem-date am-fr am-margin-right-xs am-margin-top-xs\">({0})</div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Section_Begin = "<section data-am-widget=\"accordion\" class=\"am-accordion am-accordion-default am-margin-top-0 am-margin-left-0 am-margin-right-0\" data-am-accordion='{ \"multiple\": true }'>" + "\r\n"; string Part_Section_End = "</section>" + "\r\n"; string No_Context = "<div class=\"custum-todoitem-no-content\">無內容</div>" + "\r\n"; string Mark_Top = "<span class=\"am-badge am-badge-warning am-round am-margin-top-xs am-fr\">置頂</span>" + "\r\n"; string Mark_Overdue = "<span class=\"am-badge am-badge-danger am-round am-margin-top-xs am-fr\">逾期</span>" + "\r\n"; string Mark_Onhold = "<span class=\"am-badge am-round am-margin-top-xs am-fr\">擱置</span>" + "\r\n"; // {0} = 執行人 string Executer = "<span class=\"am-text-default am-text-sm\">- {0}</span>"; // {0} = 標題 (手機Web客戶端開發) // {1} = 日期 (今天,昨天,2015/11/03) // {2} = 執行人 // {3} = 事項的ID // {4} = 置頂 // {5} = 逾期 // {6} = 正文 (1.基本框架搭建.<br />2.登陸頁面開發<br />4.其他...) // {7} = 未讀 粗體 "style=\"font-weight:bold;\"" // {8} = 旗子 // {9} = 擱置 string Context = "<dl class=\"am-accordion-item\">" + "\r\n" + " <dt class=\"am-accordion-title " + Session["TitileSize"].ToString() + "\" {7}>{8}{0}" + "\r\n" + " <span class=\"custum-todoitem-date\">[{1}]</span>" + "\r\n" + " {2}" + "\r\n" + " <a href=\"todoitem.aspx?id={3}\">" + "\r\n" + " <i class=\"am-header-icon am-icon-info-circle am-fr\"></i>" + "\r\n" + " </a>" + "\r\n" + " {9}" + "\r\n" + " {4}" + "\r\n" + " {5}" + "\r\n" + " </dt>" + "\r\n" + " <dd class=\"am-accordion-bd am-collapse\">" + "\r\n" + " <div class=\"am-accordion-content\">" + "\r\n" + " {6}" + "\r\n" + " </div>" + "\r\n" + " </dd>" + "\r\n" + "</dl>" + "\r\n"; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtToDo = wcfBase.csHelper.GetAssignedPageData(Session["UserID"].ToString()); wcfBase.CloseWCF(); if (dtToDo.Rows.Count > 0) { DataRow[] Rows = dtToDo.Select("todo_type = '1'", "row"); #region " 進行中的 " if (Rows.Length > 0) { #region " 有待辦事項 " rtn += string.Format(Part_InProcess, Rows.Length.ToString()); string Context_Result = ""; string Title = "", Date = ""; foreach (DataRow row in Rows) { Title = this.GetTile(row["td_seq"].ToString() + "." + row["td_name"].ToString()); Date = this.GetDateDesc(row["td_date"].ToString()); Context_Result += string.Format(Context, Title, Date, string.Format(Executer, row["user_name"].ToString()), row["td_no"].ToString(), row["td_top"].ToString() == "Y" ? Mark_Top : "", row["td_overdue"].ToString() == "Y" ? Mark_Overdue : "", row["td_description"].ToString().Replace("\r\n", "<br />"), row["td_state"].ToString() == "0" ? "style=\"font-weight:bold;\"" : "", this.GetFlag(row["td_flag"].ToString()), row["td_hold"].ToString() == "Y" ? Mark_Onhold : ""); } rtn += (Part_Section_Begin + Context_Result + Part_Section_End); // 進行中的 #endregion } else { #region " 無待辦事項 " rtn += string.Format(Part_InProcess, "0") + "\r\n"; // 進行中的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } #endregion Rows = dtToDo.Select("todo_type = '2'", "row"); #region " 已完成的 " if (Rows.Length > 0) { #region " 有待辦事項 " rtn += string.Format(Part_Complete, Rows.Length.ToString()); string Context_Result = ""; string Title = "", Date = ""; foreach (DataRow row in Rows) { Title = this.GetTile(row["td_seq"].ToString() + "." + row["td_name"].ToString()); Date = this.GetDateDesc(row["td_date"].ToString()); Context_Result += string.Format(Context, Title, Date, string.Format(Executer, row["user_name"].ToString()), row["td_no"].ToString(), row["td_top"].ToString() == "Y" ? Mark_Top : "", row["td_overdue"].ToString() == "Y" ? Mark_Overdue : "", row["td_description"].ToString().Replace("\r\n", "<br />"), row["td_state"].ToString() == "0" ? "style=\"font-weight:bold;\"" : "", this.GetFlag(row["td_flag"].ToString()), row["td_hold"].ToString() == "Y" ? Mark_Onhold : ""); } rtn += (Part_Section_Begin + Context_Result + Part_Section_End); // 已完成的 #endregion } else { #region " 無待辦事項 " rtn += string.Format(Part_Complete, "0") + "\r\n"; // 已完成的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } #endregion } else { #region " 無待辦事項 " rtn += string.Format(Part_InProcess, "0") + "\r\n"; // 進行中的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 rtn += string.Format(Part_Complete, "0") + "\r\n"; // 已完成的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } dtToDo.Dispose(); dtToDo = null; return rtn; }
private string GenerateTemplateList() { string rtn = ""; string selected = ""; //Session["TemplateID"] //{0} 模板代號 //{1} 模板名稱 //{2} 默認選中 selected string Option_String = "<option value=\"{0}\" {2}>{1}</option>" + "\r\n"; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtTplData = wcfBase.csHelper.GetTemplateList(Session["UserID"].ToString()); wcfBase.CloseWCF(); if (dtTplData.Rows.Count > 0) { for (int i = 0; i < dtTplData.Rows.Count; i++) { if (Session["TemplateID"].ToString().Length == 0 && i == 0) { // 默認選中第一項 selected = "selected"; Session["TemplateID"] = dtTplData.Rows[i]["tpl_no"].ToString(); } else if (Session["TemplateID"].ToString().Length > 0 && Session["TemplateID"].ToString() == dtTplData.Rows[i]["tpl_no"].ToString()) { // 選中當前在使用的 selected = "selected"; } else { selected = ""; } rtn += string.Format(Option_String, dtTplData.Rows[i]["tpl_no"].ToString(), dtTplData.Rows[i]["tpl_name"].ToString(), selected); } } else { Session["TemplateID"] = ""; rtn = string.Format(Option_String, "", "無可用模板", "selected"); } return rtn; }
/// <summary> /// 記事本 /// </summary> /// <returns></returns> private string GenerateNoteBook() { string rtn = ""; string Part_Today = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><strong class=\"am-text-success am-text-lg\">今天</strong> / <small>Today</small></div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Yesterday = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><strong class=\"am-text-primary am-text-lg\">昨天</strong> / <small>Yesterday</small></div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Before = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><strong class=\"am-text-warning am-text-lg\">以前</strong> / <small>Before</small></div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Section_Begin = "<section data-am-widget=\"accordion\" class=\"am-accordion am-accordion-default am-margin-top-0 am-margin-left-0 am-margin-right-0\" data-am-accordion='{ \"multiple\": true }'>" + "\r\n"; string Part_Section_End = "</section>" + "\r\n"; string No_Context = "<div class=\"custum-todoitem-no-content\">無內容</div>" + "\r\n"; // {0} = 標題 (手機Web客戶端開發) // {1} = 日期或時間 (13:15) // {2} = 要刪除筆記的ID // {3} = 要編輯筆記的ID // {4} = 正文 (1.基本框架搭建.<br />2.登陸頁面開發<br />4.其他...) string Context = "<dl class=\"am-accordion-item\">" + "\r\n" + " <dt class=\"am-accordion-title " + Session["TitileSize"].ToString() + "\">{0}" + "\r\n" + " <span class=\"custum-todoitem-date\">[{1}]</span>" + "\r\n" + " <a href=\"note.aspx?r_id={2}\" onclick=\"return submit_hint('確定要刪除這條筆記嗎?');\">" + "\r\n" + " <i class=\"am-header-icon am-icon-trash am-fr\"></i>" + "\r\n" + " </a>" + "\r\n" + " <a href=\"note.aspx?e_id={3}\">" + "\r\n" + " <i class=\"am-header-icon am-icon-edit am-fr am-margin-right-sm\"></i>" + "\r\n" + " </a>" + "\r\n" + " </dt>" + "\r\n" + " <dd class=\"am-accordion-bd am-collapse\">" + "\r\n" + " <div class=\"am-accordion-content\">" + "\r\n" + " {4}" + "\r\n" + " </div>" + "\r\n" + " </dd>" + "\r\n" + "</dl>" + "\r\n"; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtNoteData = wcfBase.csHelper.GetNoteDataByUser(Session["UserID"].ToString()); wcfBase.CloseWCF(); if (dtNoteData.Rows.Count > 0) { #region " 有筆記 " #region " 今天 " rtn += Part_Today; DataRow[] rows = dtNoteData.Select("td_cdate = '" + DateTime.Now.ToString("yyyy/MM/dd") + "'", "td_ctime desc"); if (rows.Length > 0) { string Context_Result = ""; string Title = ""; foreach (DataRow row in rows) { Title = this.GetTile(row["td_text"].ToString()); Context_Result += string.Format(Context, Title, row["td_ctime"].ToString().Substring(0, 5), row["uid"].ToString(), row["uid"].ToString(), row["td_text"].ToString().Replace("\r\n", "<br />")); } rtn += (Part_Section_Begin + Context_Result + Part_Section_End); // 今天的內容 } else { rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 今天無內容 } #endregion #region " 昨天 " rtn += Part_Yesterday; rows = dtNoteData.Select("td_cdate = '" + DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") + "'", "td_ctime desc"); if (rows.Length > 0) { string Context_Result = ""; string Title = ""; foreach (DataRow row in rows) { Title = this.GetTile(row["td_text"].ToString()); Context_Result += string.Format(Context, Title, row["td_ctime"].ToString().Substring(0, 5), row["uid"].ToString(), row["uid"].ToString(), row["td_text"].ToString().Replace("\r\n", "<br />")); } rtn += (Part_Section_Begin + Context_Result + Part_Section_End); // 昨天的內容 } else { rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 昨天無內容 } #endregion #region " 以前 " rtn += Part_Before; rows = dtNoteData.Select("td_cdate < '" + DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") + "'", "td_cdate desc"); if (rows.Length > 0) { string Context_Result = ""; string Title = ""; foreach (DataRow row in rows) { Title = this.GetTile(row["td_text"].ToString()); Context_Result += string.Format(Context, Title, row["td_cdate"].ToString(), row["uid"].ToString(), row["uid"].ToString(), row["td_text"].ToString().Replace("\r\n", "<br />")); } rtn += (Part_Section_Begin + Context_Result + Part_Section_End); // 以前的內容 } else { rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 以前無內容 } #endregion #endregion } else { #region " 無筆記 " rtn += Part_Today + "\r\n"; // 今天 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 rtn += Part_Yesterday + "\r\n"; // 昨天 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 rtn += Part_Before + "\r\n"; // 以前 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } return rtn; }
private string GenerateTemplatePage(string node_uid) { string rtn = ""; //.am-text-xs - 12px //.am-text-sm - 14px //.am-text-default - 16px //.am-text-lg - 18px //.am-text-xl - 24px //.am-text-xxl - 32px //.am-text-xxxl - 42px //Session["tpl_title"] = ""; //Session["tpl_subtitle"] = ""; //{0} 過濾節點 //{1} 排序欄位 排序方式 //{2} 項目數 string Part_Head = "<div class=\"am-cf am-margin-top-xs\">" + "\r\n" + " <div class=\"am-fl am-cf\"><strong class=\"am-text-success am-text-lg\">{0}</strong> / <small>{1} - {2}</small></div>" + "\r\n" + " <div class=\"custum-todoitem-date am-fr am-margin-right-xs am-margin-top-xs\">({3})</div>" + "\r\n" + " <hr data-am-widget=\"divider\" class=\"am-divider-dashed\" />" + "\r\n" + "</div>" + "\r\n"; string Part_Section_Begin = "<section data-am-widget=\"accordion\" class=\"am-accordion am-accordion-default am-margin-top-0 am-margin-left-0 am-margin-right-0\" data-am-accordion='{ \"multiple\": true }'>" + "\r\n"; string Part_Section_End = "</section>" + "\r\n"; string No_Context = "<div class=\"custum-todoitem-no-content\">無內容</div>" + "\r\n"; string Mark_Top = "<span class=\"am-badge am-badge-warning am-round am-margin-top-xs am-fr\">置頂</span>" + "\r\n"; string Mark_Overdue = "<span class=\"am-badge am-badge-danger am-round am-margin-top-xs am-fr\">逾期</span>" + "\r\n"; string Mark_Onhold = "<span class=\"am-badge am-round am-margin-top-xs am-fr\">擱置</span>" + "\r\n"; // {0} = 派發人 // {1} = 執行人 string Owner_Executer = "<span class=\"am-text-default am-text-sm\">{0} → {1}</span>"; // {0} = 標題 (手機Web客戶端開發) // {1} = 日期 (今天,昨天,2015/11/03) // {2} = 派發人或執行人 // {3} = 事項的ID // {4} = 置頂 // {5} = 逾期 // {6} = 正文 (1.基本框架搭建.<br />2.登陸頁面開發<br />4.其他...) // {7} = 未讀 粗體 "style=\"font-weight:bold;\"" // {8} = 旗子 // {9} = 擱置 string Context = "<dl class=\"am-accordion-item\">" + "\r\n" + " <dt class=\"am-accordion-title " + Session["TitileSize"].ToString() + "\" {7}>{8}{0}" + "\r\n" + " <span class=\"custum-todoitem-date\">[{1}]</span>" + "\r\n" + " {2}" + "\r\n" + " <a href=\"todoitem.aspx?id={3}\">" + "\r\n" + " <i class=\"am-header-icon am-icon-info-circle am-fr\"></i>" + "\r\n" + " </a>" + "\r\n" + " {9}" + "\r\n" + " {4}" + "\r\n" + " {5}" + "\r\n" + " </dt>" + "\r\n" + " <dd class=\"am-accordion-bd am-collapse\">" + "\r\n" + " <div class=\"am-accordion-content\">" + "\r\n" + " {6}" + "\r\n" + " </div>" + "\r\n" + " </dd>" + "\r\n" + "</dl>" + "\r\n"; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtToDo = wcfBase.csHelper.GetTemplateData(Session["UserID"].ToString(), node_uid, this.GetGlobalFilters()); wcfBase.CloseWCF(); if (dtToDo.Rows.Count > 0) { #region " 有待辦事項 " string SortName = "無排序", SortColumn = "td_prdate"; string SortType = "降序"; //Pdate - 要求完工 td_prdate //Seq td_seq //Sdate - 實際開工 td_sdate //Edate - 實際完工 td_edate switch (dtToDo.Rows[0]["sort_field"].ToString().ToUpper()) { case "PDATE": SortName = "按要求完工日期排序"; SortColumn = "td_prdate"; break; case "SEQ": SortName = "按項次排序"; SortColumn = "td_seq"; break; case "SDATE": SortName = "按實際開工日期排序"; SortColumn = "td_sdate"; break; case "EDATE": SortName = "按實際完工日期排序"; SortColumn = "td_edate"; break; } if (dtToDo.Rows[0]["sort_type"].ToString() == "0") SortType = "降序"; else SortType = "升序"; rtn += string.Format(Part_Head, Session["tpl_subtitle"].ToString(), SortName, SortType, dtToDo.Rows.Count.ToString()) + "\r\n"; string Context_Result = ""; string Title = "", Date = ""; foreach (DataRow row in dtToDo.Rows) { Title = this.GetTile(row["td_seq"].ToString() + "." + row["td_name"].ToString()); Date = SortColumn == "td_seq" ? row[SortColumn].ToString() : this.GetDateDesc(row[SortColumn].ToString()); Context_Result += string.Format(Context, Title, Date, string.Format(Owner_Executer, row["owner_name"].ToString(), row["executor_name"].ToString()), row["td_no"].ToString(), row["td_top"].ToString() == "Y" ? Mark_Top : "", row["td_overdue"].ToString() == "Y" ? Mark_Overdue : "", row["td_description"].ToString().Replace("\r\n", "<br />"), row["td_state"].ToString() == "0" ? "style=\"font-weight:bold;\"" : "", this.GetFlag(row["td_flag"].ToString()), row["td_hold"].ToString() == "Y" ? Mark_Onhold : ""); } rtn += (Part_Section_Begin + Context_Result + Part_Section_End); // 我要做的 #endregion } else { #region " 無待辦事項 " if (Session["tpl_subtitle"] != null) rtn += string.Format(Part_Head, Session["tpl_subtitle"].ToString(), "無", "無", "0") + "\r\n"; // 我要做的 else rtn += string.Format(Part_Head, "我的事項", "無", "無", "0") + "\r\n"; // 我要做的 rtn += (Part_Section_Begin + No_Context + Part_Section_End); // 無內容 #endregion } dtToDo.Dispose(); dtToDo = null; return rtn; }
/// <summary> /// 模板菜單 /// </summary> /// <returns></returns> private string GenerateTemplateMenu() { //<li class="am-parent"> // <a href="##" class="am-icon-tasks"> 所有事項</a> // <ul class="am-menu-sub am-collapse sm-block-grid-3 "> // <li class=""> // <a href="home.aspx?tabpage=2">我要做的<span class="am-badge am-badge-success am-margin-right-xl am-fr am-square am-round"><%=Session["ToDoMineCount"]%></span></a> // </li> // <li class=""> // <a href="home.aspx?tabpage=3">我發出的<span class="am-badge am-badge-primary am-margin-right-xl am-fr am-square am-round"><%=Session["ToDoAssignedCount"]%></span></a> // </li> // <li class=""> // <a href="home.aspx?tabpage=4">我監督的<span class="am-badge am-badge-secondary am-margin-right-xl am-fr am-square am-round"><%=Session["ToDoSuperviseCount"]%></span></a> // </li> // <%-- <li class=""> // <a href="##">與我相關</a> // </li>--%> // </ul> // </li> string rtn = ""; // {0} 文字節點名稱 // {1} 是否展開 am-collapse string Text_Node_Head = "<li class=\"am-parent\">" + "\r\n" + " <a href=\"##\" class=\"am-icon-bookmark\"> {0}</a>" + "\r\n" + " <ul class=\"am-menu-sub {1} sm-block-grid-3 \">" + "\r\n"; // {0} 過濾節點的uid // {1} 過濾節點的名稱 // {2} 過濾節點下的事項數 // {3} 模板標題(文字節點) // {4} 模板小標題(過濾節點) // {5} 是否被選中 <span class="am-icon-check am-success am-text-success"/> string Filter_Node = " <li>" + "\r\n" + " <a href=\"home.aspx?tabpage=5&id={0}\" onclick=\"return UpdateTemplateTitle('{3}','{4}');\">{5} {1}<span class=\"am-badge am-badge-success am-margin-right-xl am-fr am-square am-round\">{2}</span></a>" + "\r\n" + " </li>" + "\r\n"; string Text_Node_End = " </ul>" + "\r\n" + "</li>" + "\r\n"; // {0} 工號 // {1} 工號 // {2} 姓名 string Users_List_Part = "<option id=\"{0}\" value=\"{1}\">{2}</option>" + "\r\n"; string Note_Selected = "<span class=\"am-icon-check am-text-success\"/>"; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtUsers = wcfBase.csHelper.GetRelatedUsers(Session["UserID"].ToString()); DataTable dtTplData = wcfBase.csHelper.GetTemplateStruct(Session["TemplateID"].ToString()); // 當前選定模板代號 wcfBase.CloseWCF(); string UsersSection = "<option id=\"ALL\" value=\"ALL\">全部</option>" + "\r\n"; if (Session["user_list"] != null) { // 處理全部選中 if (Session["user_list"].ToString().IndexOf("ALL") > -1 || Session["user_list"].ToString().Length == 0) { Session["user_list"] = "ALL|"; // 記入Cookie //WriteCookie("user_list", "ALL|"); } } if (dtUsers.Rows.Count > 0) { foreach (DataRow row in dtUsers.Rows) UsersSection += string.Format(Users_List_Part, row["td_user"].ToString(), row["td_user"].ToString(), row["user_name"].ToString()); } Session["UsersSection"] = UsersSection; if (dtTplData.Rows.Count > 0) { // 抓出文字節點 DataRow[] TextNodeRows = dtTplData.Select("node_type = '0'", "node_seq"); foreach (DataRow rowTN in TextNodeRows) { // 抓出當前文字節點下的過濾節點 DataRow[] FilterNodeRows = dtTplData.Select("node_type = '1' and node_fno='" + rowTN["node_no"].ToString() + "'", "node_seq"); if (FilterNodeRows.Length > 0) { string Context = ""; string noteChecked = ""; bool activated = false; foreach (DataRow rowFN in FilterNodeRows) { if (Session["node_id"] != null && Session["node_id"].ToString() == rowFN["uid"].ToString()) { activated = true; noteChecked = Note_Selected; } else { noteChecked = ""; } Context += string.Format(Filter_Node, rowFN["uid"].ToString(), rowFN["node_text"].ToString(), "", rowTN["node_text"].ToString(), rowFN["node_text"].ToString(), noteChecked); } // 文字結節 Context = string.Format(Text_Node_Head, rowTN["node_text"].ToString(), activated ? "" : "am-collapse") + Context; Context += Text_Node_End; rtn += Context; } } } dtUsers.Dispose(); dtUsers = null; dtTplData.Dispose(); dtTplData = null; return rtn; }
protected void Page_Load(object sender, EventArgs e) { // 當前是登錄狀態時,執行退出登錄 if (Session["Logout"] != null) { Session["UserID"] = ""; Session["Login"] = ""; Session["UserNo"] = ""; //註冊頁面賦值 } Session["AccountErrorVisible"] = "style=\"display:none;\""; Session["PwdErrorVisible"] = "style=\"display:none;\""; // 點擊了“登錄”后,執行提交進這里. if (Request["username"] != null && Request["password"] != null) { bool Passed = false; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtUserInfo = wcfBase.csHelper.GetUserInfo(Request["username"].ToString()); if (dtUserInfo.Rows.Count > 0) { if (dtUserInfo.Rows[0]["ie_cancel"].ToString() == "Y") { // 帳號已經失效 dtUserInfo.Dispose(); dtUserInfo = null; wcfBase.CloseWCF(); Session["AccountErrorVisible"] = ""; Session["AccountTip"] = "帳號已失效,請聯繫ToDo Manager客服人員了解詳情."; } else if (dtUserInfo.Rows[0]["user_actived"].ToString() != "Y") { // 帳號未激活 dtUserInfo.Dispose(); dtUserInfo = null; wcfBase.CloseWCF(); Session["AccountErrorVisible"] = ""; Session["AccountTip"] = "帳號未激活,請先前往註冊時填寫的郵箱完成激活操作."; } else { dtUserInfo = wcfBase.csHelper.Login(Request["username"].ToString(), Request["password"].ToString()); if (dtUserInfo != null) { if (dtUserInfo.Rows.Count > 0) { Passed = true; Session["UserID"] = Request["username"].ToString(); Session["UserName"] = dtUserInfo.Rows[0]["user_name"].ToString(); } dtUserInfo.Dispose(); dtUserInfo = null; } wcfBase.CloseWCF(); if (Passed) { // 標記用戶已經登錄 Session["Login"] = "******"; Session["TabPage"] = "0"; // 0=草稿;1=我的;2=派發的; //跳轉到主頁 //Response.Redirect("home.aspx?tabpage=0"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("home.aspx?tabpage=0"); } else { // 顯示密碼錯誤 Session["PwdErrorVisible"] = ""; } } } else { // 帳號不存在. Session["AccountErrorVisible"] = ""; Session["AccountTip"] = "帳號不存在,請重新輸入."; } } else { Session["UserID"] = ""; Session["Login"] = ""; Session["UserName"] = ""; } }
protected void Page_Load(object sender, EventArgs e) { //以下為測試是使用,發佈前請註釋掉 //Session["UserID"] = "D003842"; // 做刪除時,把帳號也傳入AP端. // 只有Owner ID與Note ID與傳入參數完全一致時,才能執行刪除操作, // 可防止有人直接在瀏覽器地址網篡改網址進行惡意操作. // 如果 note.aspx?r_id=隨意輸入一個數字, 如果DB中有這條記錄就會被刪除. if (Session["UserID"] != null) { bool Passed = false; string Style_DisplayNone = "style=\"display:none;\""; if (Request["r_id"] != null) { // 刪除筆記 WCFHelperBase wcfBase = new WCFHelperBase(); Passed = wcfBase.csHelper.DeleteNote(Request["r_id"].ToString(), Session["UserID"].ToString()); wcfBase.CloseWCF(); } else { if (Request["note_text"] == null) { if (Request["e_id"] != null) { WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtNoteInfo = wcfBase.csHelper.GetNoteDataByID(Request["e_id"].ToString()); // 得到Note wcfBase.CloseWCF(); // 顯示為選中的筆記,開始編輯 Session["NoteTitle"] = "修改筆記"; //dtNoteInfo.Rows[0]["td_text"].ToString().Length < 15 ? dtNoteInfo.Rows[0]["td_text"].ToString() : dtNoteInfo.Rows[0]["td_text"].ToString().Substring(0, 15) + "..."; Session["NoteContext"] = dtNoteInfo.Rows[0]["td_text"].ToString(); Session["NoteID"] = Request["e_id"].ToString(); Session["TrashVisible"] = ""; } else { // 顯示為新筆記 Session["NoteTitle"] = "新筆記"; Session["NoteContext"] = ""; Session["NoteID"] = ""; Session["TrashVisible"] = Style_DisplayNone; } } else { if (Request["e_id"] != null) { // 修改選中的筆記 Session["NoteID"] = Request["e_id"].ToString(); WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtNoteInfo = wcfBase.csHelper.GetNoteDataByID(Request["e_id"].ToString()); // 得到Note dtNoteInfo.Rows[0]["td_text"] = Request["note_text"].ToString(); dtNoteInfo.Rows[0]["td_cdate"] = DateTime.Now.ToString("yyyy/MM/dd"); dtNoteInfo.Rows[0]["td_ctime"] = DateTime.Now.ToString("HH:mm:ss"); dtNoteInfo.AcceptChanges(); Passed = wcfBase.csHelper.UpdateNote(dtNoteInfo, false) != "-1"; wcfBase.CloseWCF(); } else { // 提交添加新筆記 Session["NoteID"] = ""; WCFHelperBase wcfBase = new WCFHelperBase(); DataTable dtNoteInfo = wcfBase.csHelper.GetNoteDataByID(""); // 得到結構 DataRow row = dtNoteInfo.NewRow(); row["user_no"] = Session["UserID"].ToString(); row["td_text"] = Request["note_text"].ToString(); row["td_cdate"] = DateTime.Now.ToString("yyyy/MM/dd"); row["td_ctime"] = DateTime.Now.ToString("HH:mm:ss"); dtNoteInfo.Rows.Add(row); dtNoteInfo.AcceptChanges(); Passed = wcfBase.csHelper.UpdateNote(dtNoteInfo, true) != "-1"; wcfBase.CloseWCF(); } } } if (Passed) { // 標記用戶已經登錄 Session["NoteTitle"] = null; Session["NoteContext"] = null; Session["NoteID"] = null; Session["TrashVisible"] = null; //跳轉到記事本 //Response.Redirect("home.aspx?tabpage=1"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("home.aspx?tabpage=1"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["verifyid"] != null && Request["ticket"] != null) { #region " Test " //// Test 加密 //string ticket_test = Guid.NewGuid().ToString().Replace("-", ""); //Response.Write(ticket_test); //Response.Write("<br/>"); //string verifyid_test = this.EncryptTicket("ABC", ticket_test); //Response.Write(verifyid_test); //Response.Write("<br/>"); //// Test 變url //string urlstring = Uri.EscapeDataString(verifyid_test); //Response.Write(urlstring); //Response.Write("<br/>"); //string urlstring_target = HttpUtility.UrlDecode(urlstring); //Response.Write(urlstring_target); //Response.Write("<br/>"); ////// Test 解密 //string user_id_test = this.DecryptTicket(urlstring_target, ticket_test); //Response.Write(user_id_test); ////Response.Write("<br/>"); //Response.End(); #endregion // 解密激活信息 //string verifyid_test = "4ThZ0L0m44ngSfHkChXgXQ=="; ////Response.Write(verifyid_test); ////Response.Write("<br/>"); //string ticket_test = "a7d6bceb403344b181484225d1813b49"; ////Response.Write(ticket_test); ////Response.Write("<br/>"); //string user_id_test = this.DecryptTicket(verifyid_test, ticket_test); //Response.Write(user_id_test); //Response.Write("<br/>"); //Response.End(); // 從瀏覽器進來,用Request取出字串時,已經自動UrlDecode了. ////Response.Write(Request["verifyid"].ToString()); ////Response.Write("<br/>"); //string verifyid = Request.QueryString["verifyid"].ToString(); ////Response.Write("test_id == real_id : " + (verifyid_test == verifyid).ToString()); //Response.Write(verifyid); //Response.Write("<br/>"); //string ticket = Request.QueryString["ticket"].ToString(); //Response.Write(ticket); ////Response.Write("test_id == real_id : " + (ticket_test == ticket).ToString()); //Response.Write("<br/>"); ////Response.End(); //string user_id = this.DecryptTicket(verifyid, ticket); //Response.Write(user_id); //Response.Write("<br/>"); // 激活帳號 WCFHelperBase wcfBase = new WCFHelperBase(); bool Done = wcfBase.csHelper.ActivateAccount(Request.QueryString["verifyid"].ToString(), Request.QueryString["ticket"].ToString()); wcfBase.CloseWCF(); if (Done) { // 激活 Session["Success_Mark"] = ""; Session["Fail_Mark"] = "style=\"display:none;\""; } else { // 失敗.原因:1.帳號不存在;2.帳號已激活;3.系統故障. Session["Success_Mark"] = "style=\"display:none;\""; Session["Fail_Mark"] = ""; } } else { // 跳回登錄 //Response.Redirect("login.aspx"); //本服務器內跳轉使用以下方法會提高效率(不同服務器還是要用上面這個) Server.Transfer("login.aspx"); } }