asp.net storemanagement

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WindowManagerDemo
{
public partial class Add : System.Web.UI.Page
{
Maticsoft.BLL.FatherType father_bll = new Maticsoft.BLL.FatherType();
Maticsoft.Model.FatherType father_model = new Maticsoft.Model.FatherType();
protected void Page_Load(object sender, EventArgs e)
{

        btnReturn.Attributes["onclick"] = "GetClose();return false;";
    }
    static string id;

    protected void btnSave_Click(object sender, EventArgs e)
    {
       
        if (RadTextBox1.Text == "")
        {
            Response.Write("<script>alert(\"输入不能为空!\")</script>");
            
        }
        else
        {

            DataSet ds = father_bll.GetList("FatherName='" + RadTextBox1.Text + "'");
            if (ds.Tables[0].Rows.Count >0)
            {
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>repeat();</script>");
            }
            else
            {
                string str = DateTime.Now.Year.ToString();//获取年
                string str1 = DateTime.Now.Month.ToString();//获取月
                string str2 = DateTime.Now.Day.ToString();//获取日
                string str3 = DateTime.Now.Minute.ToString();//获取分
                string str4 = DateTime.Now.Second.ToString();//获取秒
                string data = str + "/" + str1 + "/" + str2 + "/" + str3 + "/" + str4;//年月日分秒;
                father_model.FatherName = RadTextBox1.Text;
                father_model.FatherId = data;
                father_bll.Add(father_model);
                //Response.Write("<script>alert('修改成功');window.location.href='father.aspx'</script>");//提示并跳转
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>");
            }
        }
    }

}

}

猜你喜欢

转载自blog.csdn.net/qq_39593196/article/details/86442951