//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_common_school", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtname.Text.Trim() == "" || txtname.Text.Trim().Length > 50) { strError += "名称为空或超出长度![br]"; } if (txtsort.Text.Trim() == "" || txtsort.Text.Trim().Length > 4) { strError += "排序为空或超出长度![br]"; } if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8) { strError += "添加时间为空或超出长度![br]"; } if (strError != string.Empty) { JscriptMsg(strError, "", "Error"); return; } #endregion Model.common_school model = new Model.common_school(); BLL.common_school bll = new BLL.common_school(); model.name = Convert.ToString(txtname.Text); model.sort = Convert.ToInt32(txtsort.Text); model.add_time = Convert.ToDateTime(txtadd_time.Text); int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加学校信息信息,主键:" + id); //记录日志 JscriptMsg("添加学校信息信息成功!", "Manage.aspx", ""); } else { JscriptMsg("保存过程中发生错误!", ""); } }
private bool DoAdd() { bool result = false; BLL.common_school bll = new BLL.common_school(); Model.common_school model = new Model.common_school(); model.name = Convert.ToString(txtname.Text); model.sort = Convert.ToInt32(txtsort.Text); model.add_time = System.DateTime.Now; int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "添加学校信息,主键:" + id); //记录日志 result = true; } return(result); }