protected void Button3_Click(object sender, EventArgs e) { if (TextBox1.Text == "" && TextBox2.Text == "" && TextBox3.Text == "" && DropDownList1.SelectedValue == "0" && DropDownList2.SelectedValue == "0" && DropDownList3.SelectedValue == "0") { Response.Write("<script>alert('请将信息填写完整!')</script>"); } else { CumrooInfoModel model = new CumrooInfoModel() { CusName = Convert.ToString(TextBox1.Text), CusSex = Convert.ToString(RadioButtonList1.SelectedValue), CusPhone = Convert.ToString(TextBox2.Text), CusBodyId = Convert.ToString(TextBox3.Text), RTypeID = Convert.ToInt32(DropDownList1.SelectedValue), NumID = Convert.ToInt32(DropDownList2.SelectedValue), RightID = Convert.ToInt32(DropDownList3.SelectedValue) }; if (Convert.ToInt32(CumrooInfoBLL.int_kaifang(model)) > 0) { Response.Write("<script>alert('添加成功!');location.href='OneRoom.aspx'</script>"); } else { Response.Write("<script>alert('该房源暂时紧缺!')"); } } }
public static int int_kaifang(CumrooInfoModel model) { SqlParameter[] sqlp = new SqlParameter[] { new SqlParameter("@CusName", model.CusName), new SqlParameter("@CusSex", model.CusSex), new SqlParameter("@CusPhone", model.CusPhone), new SqlParameter("@CusBodyId", model.CusBodyId), new SqlParameter("@RTypeID", model.RTypeID), new SqlParameter("@NumID", model.NumID), new SqlParameter("@RightID", model.RightID) }; return(SqlHelper.DBNoQuery("ins_kaifang", sqlp)); }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "0") { Response.Write("<script>alert('请选择房间类型!')</script>"); } CumrooInfoModel model = new CumrooInfoModel() { CusName = Convert.ToString(TextBox1.Text), CusSex = Convert.ToString(RadioButtonList1.SelectedValue), CusPhone = Convert.ToString(TextBox2.Text), CusBodyId = Convert.ToString(TextBox3.Text), RTypeID = Convert.ToInt32(DropDownList1.SelectedValue), NumID = Convert.ToInt32(DropDownList2.SelectedValue), RightID = Convert.ToInt32(DropDownList3.SelectedValue) }; if (Convert.ToInt32(CumrooInfoBLL.int_kaifang(model)) > 0) { Response.Write("<script>alert('添加成功!');</script>"); } }
public static int int_kaifang(CumrooInfoModel model) { return(CumrooInfoDAL.int_kaifang(model)); }