コード例 #1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        Guid KeyIdGuid;

        if (this.KeyId == string.Empty)
        {
            //将数据保存到客户端cookie
            HttpCookie myCookie = new HttpCookie("EmailSetting");

            myCookie.Values.Add("EmailTo", rtxtTo.Text.Trim());
            myCookie.Expires = System.DateTime.Now.AddDays(1);
            Response.AppendCookie(myCookie);

            Response.Redirect("~/Schedule Billing/TaskDetailForm.aspx");
        }
        else
        {
            KeyIdGuid               = new Guid(this.KeyId);//转换成Guid类型
            SchedulerObj            = new tblScheduler();
            SchedulerObj.EmailTo    = rtxtTo.Text.Trim();
            SchedulerObj.ScheduleID = KeyIdGuid;
            BLL_ScheduleTasks       = new ScheduleTasksBLL();
            successFlag             = BLL_ScheduleTasks.UpdateInEmailForm(SchedulerObj);
            if (!successFlag.Equals("InsertError"))
            {
                Response.Redirect("~/Schedule Billing/TaskDetailForm.aspx?KeyGuid=" + this.KeyId);
            }
            else
            {
                //错误提示信息
                MessageBox(false, false, true,
                           GetGlobalResourceObject("WebResource", "EmailSettingForm_UpdateEmailSetting_ErrorMessage").ToString());
            }
        }
    }