Exemple #1
0
    private string SaveData()
    {
        bool isNew = Row == null;

        if (isNew)
        {
            Row = new tbl_mobile_white_listItem();
        }

        Row.mobile = txtmobile.Text.Trim();
        if (string.IsNullOrEmpty(Row.mobile))
        {
            return("号码不能为空");
        }
        Row.adddate = DateTime.Now;

        if (CheckExist(Row.mobile))
        {
            return("已经存在");
        }

        try
        {
            Row.SaveToDatabase(dBase);
        }
        catch (Exception ex)
        {
            return("保存出错\n" + ex.Message);
        }
        return(null);
    }
Exemple #2
0
    private void LoadDefault()
    {
        var idStr = Request["id"];

        if (string.IsNullOrEmpty(idStr))
        {
            return;
        }

        if (int.TryParse(Request["id"], out id))
        {
            Row = tbl_mobile_white_listItem.GetRowById(dBase, id);
        }

        if (Row == null)
        {
            form1.Controls.Clear();
            form1.InnerHtml = "<h1>ID无效!</h1>";
            return;
        }
        if (IsPostBack)
        {
            return;
        }

        txtmobile.Text = Row.mobile;
    }