DS7/DSWeb/box/boxtimeset.aspx.cs

67 lines
2.2 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using DSWeb.DataAccess;
using System.Data.SqlClient;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Web.Script.Serialization;
using WebSqlHelper;
namespace DSWeb.box
{
public partial class boxtimeset : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
msg.Text = "";
if (!IsPostBack)
{
databind();
}
}
protected void databind()
{
DataRow dr = BaseClass.db.GetSqlStrRow("select * from sys_remind");
if (dr != null)
{
deadline1.Text = dr["deadline1"].ToString();
deadline2.Text = dr["deadline2"].ToString();
}
}
protected void btnEnter_Click(object sender, ImageClickEventArgs e)
{
if (string.IsNullOrEmpty(deadline1.Text.Trim()) || string.IsNullOrEmpty(deadline1.Text.Trim()))
{
msg.Text = "<script>alert('请输入期限为数字0为无时间限制')</script>";
return;
}
if (BaseClass.db.GetSqlStrTable("select * from sys_remind").Rows.Count > 0)
{
BaseClass.db.SetSqlStrNonQuery("update sys_remind set deadline1=@deadline1,deadline2=@deadline2"
, BaseClass.db.GetParameter("deadline1", deadline1.Text)
, BaseClass.db.GetParameter("deadline2", deadline2.Text)
);
}
else
{
BaseClass.db.SetSqlStrNonQuery("insert into sys_remind (deadline1,deadline2)values(@deadline1,@deadline2)"
, BaseClass.db.GetParameter("deadline1", deadline1.Text)
, BaseClass.db.GetParameter("deadline2", deadline2.Text)
);
}
msg.Text = "<script>alert('保存成功')</script>";
}
}
}