/// <summary> /// 添加,修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { if (btnUpdate.Text == "添加") { Orders model = new Orders(); model.O_Budget = Convert.ToDateTime(txtBudget.Value); model.O_Name = txtName.Value.Trim(); model.O_No = txtNo.Value.Trim(); model.O_Time = DateTime.Now; model.O_Tel = txtTel.Value.Trim(); model.U_Id = users.U_Id; model.Rt_Id = Convert.ToInt32(ddlRt_Id.SelectedValue); model.O_State = "未入住"; if (OrdersBLL.AddOrders(model) > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location.replace('OrdersManage.aspx');</script>"); return; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败!');</script>"); return; } } }