protected void btnCreate_Click(object sender, EventArgs e) { try { QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room Mroom = Broom.GetModel(roomid); if (this.fulImg.FileName == "") { //this.lblMessage.Text = "<font color=#FF0000>请选择上传的图片!</font>"; this.fulImg.Focus(); return; } if (txfName.Value == string.Empty) { Response.Write("<script>alert('用户名不能为空,请重新输入')</script>"); return; } if (txfRoomPrice.Value == string.Empty) { Response.Write("<script>alert('请重新输入房间价格')</script>"); return; } if (txfAddress.Value == string.Empty) { Response.Write("<script>alert('地址不能为空,请重新输入')</script>"); return; } if (txfArea.Value == string.Empty) { Response.Write("<script>alert('地区不能为空,请重新输入')</script>"); return; } if (txfContent.Value == string.Empty) { Response.Write("<script>alert('内容不能为空,请重新输入')</script>"); return; } if (txfRoomType.Value == string.Empty) { Response.Write("<script>alert('房间类型不能为空,请重新输入')</script>"); return; } Mroom.OwnerID = ownerid; Mroom.Address = txfAddress.Value; Mroom.Are = txfArea.Value; Mroom.Content = txfContent.Value.Length > 100 ? txfContent.Value.Substring(0, 100) : txfContent.Value; Mroom.Name = txfName.Value; Mroom.RoomPrice = Convert.ToDecimal(txfRoomPrice.Value); Mroom.RoomState = Convert.ToInt32(txfRoomType.Value); Mroom.ImagePath = Upload(fulImg); Broom.Update(Mroom); Response.Write("<script>alert('修改棋牌室成功!')</script>"); Response.Write("<script>window.close()</script>"); } catch (Exception ex) { Response.Write("<script>alert('修改棋牌室失败!')</script>"); return; } }
public DataTable databind() { DataTable dt = new DataTable(); QPS.NEW.BLL.Enterprise user = new QPS.NEW.BLL.Enterprise(); QPS.NEW.BLL.Users u = new QPS.NEW.BLL.Users(); QPS.NEW.BLL.Room BRoom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); List <QPS.NEW.Model.Room> roomList = new List <QPS.NEW.Model.Room>(); List <QPS.NEW.Model.Orderform> orderList = new List <QPS.NEW.Model.Orderform>(); List <QPS.NEW.Model.Users> userList = new List <QPS.NEW.Model.Users>(); DataColumn dc0 = dt.Columns.Add("订单编号", typeof(int)); DataColumn dc1 = dt.Columns.Add("棋牌室名称", typeof(string)); DataColumn dc2 = dt.Columns.Add("用户", typeof(string)); DataColumn dc3 = dt.Columns.Add("酒水费", typeof(float)); DataColumn dc4 = dt.Columns.Add("是否有效", typeof(string)); dc0.ReadOnly = true; dc1.ReadOnly = true; dc2.ReadOnly = true; DataSet dsUser = user.GetList("Username='******'"); uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); //获取RoomID DataSet dsRoom = BRoom.GetList("OwnerID='" + uid + "' "); for (int i = 0; i < dsRoom.Tables[0].Rows.Count; i++) { int roomid = Convert.ToInt32(dsRoom.Tables[0].Rows[i]["Id"]); QPS.NEW.Model.Room r = BRoom.GetModel(roomid); DataSet dsOrder = Border.GetList("Roomid='" + roomid + "' and IsDelete=0"); if (dsOrder.Tables[0].Rows.Count == 0) { continue; } for (int j = 0; j < dsOrder.Tables[0].Rows.Count; j++) { DataRow dr = dt.NewRow(); dr[1] = r.Name; //订单ID int orderid = Convert.ToInt32(dsOrder.Tables[0].Rows[j]["Id"]); dr[0] = orderid; int userid = Convert.ToInt32(dsOrder.Tables[0].Rows[j]["Userid"]); string username = u.GetModel(userid).Username; dr[2] = username; dr[3] = dsOrder.Tables[0].Rows[j]["Beveragecost"]; dr[4] = dsOrder.Tables[0].Rows[j]["RoomType"]; dt.Rows.Add(dr); } } return(dt); }
public DataTable databind() { DataTable dt = new DataTable(); QPS.NEW.BLL.Enterprise user = new QPS.NEW.BLL.Enterprise(); QPS.NEW.BLL.Users u = new QPS.NEW.BLL.Users(); QPS.NEW.BLL.Room BRoom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); List<QPS.NEW.Model.Room> roomList = new List<QPS.NEW.Model.Room>(); List<QPS.NEW.Model.Orderform> orderList = new List<QPS.NEW.Model.Orderform>(); List<QPS.NEW.Model.Users> userList = new List<QPS.NEW.Model.Users>(); DataColumn dc0 = dt.Columns.Add("订单编号", typeof(int)); DataColumn dc1 = dt.Columns.Add("棋牌室名称", typeof(string)); DataColumn dc2 = dt.Columns.Add("用户", typeof(string)); DataColumn dc3 = dt.Columns.Add("酒水费", typeof(float)); DataColumn dc4 = dt.Columns.Add("是否有效",typeof(string)); dc0.ReadOnly = true; dc1.ReadOnly = true; dc2.ReadOnly = true; DataSet dsUser = user.GetList("Username='******'"); uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); //获取RoomID DataSet dsRoom = BRoom.GetList("OwnerID='"+uid+"' "); for (int i = 0; i < dsRoom.Tables[0].Rows.Count; i++) { int roomid =Convert.ToInt32(dsRoom.Tables[0].Rows[i]["Id"]); QPS.NEW.Model.Room r = BRoom.GetModel(roomid); DataSet dsOrder = Border.GetList("Roomid='" + roomid + "' and IsDelete=0"); if (dsOrder.Tables[0].Rows.Count == 0) continue; for (int j = 0; j < dsOrder.Tables[0].Rows.Count; j++) { DataRow dr = dt.NewRow(); dr[1] = r.Name; //订单ID int orderid = Convert.ToInt32(dsOrder.Tables[0].Rows[j]["Id"]); dr[0] = orderid; int userid = Convert.ToInt32(dsOrder.Tables[0].Rows[j]["Userid"]); string username= u.GetModel(userid).Username; dr[2]=username; dr[3] = dsOrder.Tables[0].Rows[j]["Beveragecost"]; dr[4]=dsOrder.Tables[0].Rows[j]["RoomType"]; dt.Rows.Add(dr); } } return dt; }
public void databind(GridView gdv) { QPS.NEW.BLL.Enterprise user = new QPS.NEW.BLL.Enterprise(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); List<QPS.NEW.Model.Room> roomList = new List<QPS.NEW.Model.Room>(); if (Session["username"] != null) { string uname = Session["username"].ToString(); DataSet dsUser = user.GetList("Username='******'"); int uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); roomList = Broom.GetModelList("OwnerID='" + uid + "'"); } gdv.DataSource = Gettable(roomList); gdv.DataBind(); }
public void databind(GridView gdv) { QPS.NEW.BLL.Enterprise user = new QPS.NEW.BLL.Enterprise(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); List <QPS.NEW.Model.Room> roomList = new List <QPS.NEW.Model.Room>(); if (Session["username"] != null) { string uname = Session["username"].ToString(); DataSet dsUser = user.GetList("Username='******'"); int uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); roomList = Broom.GetModelList("OwnerID='" + uid + "'"); } gdv.DataSource = Gettable(roomList); gdv.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["username"] != null) { roomid = Convert.ToInt32(Request.QueryString["roomid"]); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room Mroom = Broom.GetModel(roomid); ownerid = Mroom.OwnerID; txfAddress.Value = Mroom.Address; txfArea.Value = Mroom.Are; txfContent.Value = Mroom.Content; txfName.Value = Mroom.Name; txfRoomPrice.Value = Mroom.RoomPrice.ToString(); txfRoomType.Value = Mroom.RoomState.ToString(); } } }
protected void gdvPersonnalOrder_RowDeleting(object sender, GridViewDeleteEventArgs e) { //得到单位编号 string rowToDelete = gdvPersonnalOrder.DataKeys[e.RowIndex].Values[0].ToString(); //转换为整数 int ID = Convert.ToInt32(rowToDelete); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); DataSet dsorder = Border.GetList("Roomid ='" + ID + "'"); int Oid = Convert.ToInt32(dsorder.Tables[0].Rows[0]["Id"]); Border.Delete(Oid); QPS.NEW.Model.Room r = Broom.GetModel(ID); r.RoomState = 0; Broom.Update(r); databind(gdvPersonnalOrder); }
public DataTable Gettable() { DataTable dt = new DataTable(); QPS.NEW.BLL.Enterprise user = new QPS.NEW.BLL.Enterprise(); QPS.NEW.BLL.Users u = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); QPS.NEW.BLL.Integral Bint = new QPS.NEW.BLL.Integral(); List <QPS.NEW.Model.Room> roomList = new List <QPS.NEW.Model.Room>(); List <QPS.NEW.Model.Orderform> orderlist = new List <QPS.NEW.Model.Orderform>(); //创建新列 //DataColumn dc0 = dt.Columns.Add("积分编号", typeof(int)); DataColumn dc1 = dt.Columns.Add("用户名称", typeof(string)); //DataColumn dc2 = dt.Columns.Add("棋牌室名称", typeof(string)); DataColumn dc3 = dt.Columns.Add("积分", typeof(string)); //DataColumn dc4 = dt.Columns.Add("消费时间", typeof(string)); if (Session["username"] != null) { //获取Uid string uname = Session["username"].ToString(); DataSet dsUser = user.GetList("Username='******'"); int uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); QPS.NEW.Model.Integral mInt = new NEW.Model.Integral(); mInt = Bint.GetModel(uid); if (mInt != null) { DataRow dr = dt.NewRow(); dr[0] = uname; dr[1] = mInt.TotalMoney.ToString(); dt.Rows.Add(dr); } } return(dt); }
public DataTable Gettable() { DataTable dt = new DataTable(); QPS.NEW.BLL.Enterprise user = new QPS.NEW.BLL.Enterprise(); QPS.NEW.BLL.Users u = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); QPS.NEW.BLL.Integral Bint = new QPS.NEW.BLL.Integral(); List<QPS.NEW.Model.Room> roomList = new List<QPS.NEW.Model.Room>(); List<QPS.NEW.Model.Orderform> orderlist = new List<QPS.NEW.Model.Orderform>(); //创建新列 //DataColumn dc0 = dt.Columns.Add("积分编号", typeof(int)); DataColumn dc1 = dt.Columns.Add("用户名称", typeof(string)); //DataColumn dc2 = dt.Columns.Add("棋牌室名称", typeof(string)); DataColumn dc3 = dt.Columns.Add("积分", typeof(string)); //DataColumn dc4 = dt.Columns.Add("消费时间", typeof(string)); if (Session["username"] != null) { //获取Uid string uname = Session["username"].ToString(); DataSet dsUser = user.GetList("Username='******'"); int uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); QPS.NEW.Model.Integral mInt = new NEW.Model.Integral(); mInt = Bint.GetModel(uid); if (mInt != null) { DataRow dr = dt.NewRow(); dr[0] = uname; dr[1] = mInt.TotalMoney.ToString(); dt.Rows.Add(dr); } } return dt; }
//修改 protected void btnupdate_Click(object sender, EventArgs e) { // string ID = this.RoomID.Text.ToString().Trim(); string id = Request["ID"].ToString(); string name = this.txName.Text; //棋牌室名称 string type = this.ddlCat.SelectedValue.ToString(); //棋牌室类型 //string type = this.ddlCat.Text; string Price = this.Textprice.Text; //棋牌室价格 string are = this.TextAre.Text; //棋牌室地域 string address = this.TextAddress.Text; //祥细地址 string imagePath = this.Photo.Text; //图片地址 string content = this.FileContent.Value; //祥细介绍 QPS.NEW.Model.Room Mro = new QPS.NEW.Model.Room(); Mro.Id = Convert.ToInt32(id); Mro.Name = name; Mro.RoomType = type; Mro.RoomPrice = Convert.ToDecimal(Price); Mro.Are = are; Mro.Address = address; Mro.ImagePath = imagePath; Mro.IfRecommend = this.Rec.Checked ? 0 : 1; Mro.Content = content; Mro.RecommendTime = DateTime.Now.ToString(); QPS.NEW.BLL.Room rm = new QPS.NEW.BLL.Room(); //rm.Add(Mro); if (rm.Update(Mro)) { Response.Write("<script>alert('修改成功!!');</script>"); } else { Response.Write("<script>alert('修改失败!!');</script>"); } }
//确定 protected void btnsure_Click(object sender, EventArgs e) { string name = this.txName.Text; //棋牌室名称 string type = this.ddlCat.Text; //棋牌室类型 string Price = this.Textprice.Text; //棋牌室价格 string are = this.Textprice.Text; //棋牌室地域 string address = this.Textprice.Text; //祥细地址 string imagePath = this.Textprice.Text; //图片地址 string content = this.Textprice.Text; //祥细介绍 string IfR = ""; if (this.Rec.Checked) { IfR = "0"; } QPS.NEW.Model.Room Mro = new QPS.NEW.Model.Room(); Mro.Name = name; Mro.RoomType = type; Mro.RoomPrice = Convert.ToDecimal(Price); Mro.Are = are; Mro.Address = address; Mro.ImagePath = imagePath; Mro.Content = content; Mro.IfRecommend = Convert.ToInt32(IfR); QPS.NEW.BLL.Room rm = new QPS.NEW.BLL.Room(); //rm.Add(Mro); int i = rm.Add(Mro); if (i > 0) { Response.Write("<script>alert('添加成功!!');</script>"); } else { Response.Write("<script>alert('添加失败!!');</script>"); } }
public void databind(GridView gdv) { QPS.NEW.BLL.Users user = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); List<QPS.NEW.Model.Room> roomList = new List<QPS.NEW.Model.Room>(); if (Session["username"] != null) { string uname = Session["username"].ToString(); DataSet dsUser = user.GetList(uname); int uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["UserID"]); List<QPS.NEW.Model.Orderform> orderlist = Border.GetModelList("Userid='" + uid + "'"); foreach (QPS.NEW.Model.Orderform o in orderlist) { int roomid = (int)o.Roomid; roomList.Add(Broom.GetModel(roomid)); } } gdv.DataSource = Gettable(roomList); gdv.DataBind(); }
//确定 protected void btnsure_Click(object sender, EventArgs e) { string name = this.txName.Text; //棋牌室名称 string type = this.ddlCat.Text; //棋牌室类型 string Price = this.Textprice.Text; //棋牌室价格 string are = this.Textprice.Text; //棋牌室地域 string address = this.Textprice.Text; //祥细地址 string imagePath = this.Textprice.Text; //图片地址 string content = this.Textprice.Text;//祥细介绍 string IfR = ""; if(this.Rec.Checked) { IfR = "0"; } QPS.NEW.Model.Room Mro = new QPS.NEW.Model.Room(); Mro.Name = name; Mro.RoomType = type; Mro.RoomPrice = Convert.ToDecimal(Price); Mro.Are = are; Mro.Address = address; Mro.ImagePath = imagePath; Mro.Content = content; Mro.IfRecommend =Convert.ToInt32(IfR); QPS.NEW.BLL.Room rm = new QPS.NEW.BLL.Room(); //rm.Add(Mro); int i = rm.Add(Mro); if (i > 0) { Response.Write("<script>alert('添加成功!!');</script>"); } else { Response.Write("<script>alert('添加失败!!');</script>"); } }
public void databind(GridView gdv) { QPS.NEW.BLL.Users user = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); List <QPS.NEW.Model.Room> roomList = new List <QPS.NEW.Model.Room>(); if (Session["username"] != null) { string uname = Session["username"].ToString(); DataSet dsUser = user.GetList(uname); int uid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["UserID"]); List <QPS.NEW.Model.Orderform> orderlist = Border.GetModelList("Userid='" + uid + "'"); foreach (QPS.NEW.Model.Orderform o in orderlist) { int roomid = (int)o.Roomid; roomList.Add(Broom.GetModel(roomid)); } } gdv.DataSource = Gettable(roomList); gdv.DataBind(); }
protected void gdvOrder_RowCommand(object sender, GridViewCommandEventArgs e) { ////得到单位编号 //string rowUpdate = this.gdvOrder.DataKeys[].Values[0].ToString(); ////转换为整数 //int ID = Convert.ToInt32(rowUpdate); //QPS.BLL.Orderform Border = new QPS.BLL.Orderform(); //QPS.Model.Orderform Morder = new QPS.Model.Orderform(); //Morder.Id = ID; //Morder.Beveragecost = (decimal)this.gdvOrder.DataKeys[e.RowIndex].Values[3]; //Border.Update(Morder); //gdvOrder.DataSource = databind(); //gdvOrder.DataBind(); string strArgument = e.CommandArgument.ToString(); if (e.CommandName == "IsValidate") { string[] Argument = strArgument.Split('|'); string id = Argument[0].ToString(); string type = Argument[1].ToString(); int ok; if (type == "0") { ok = 1; } else { ok = 0; } QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform(); QPS.NEW.Model.Orderform order = Border.GetModel(Convert.ToInt32(id)); Border.UpdateType(id, type); //订单有效 则加上积分 否则 如果存在积分 则删除 QPS.NEW.BLL.Integral Bint = new QPS.NEW.BLL.Integral(); QPS.NEW.Model.Integral Mint = new QPS.NEW.Model.Integral(); if (Bint.GetList("OrderId='" + id + "'").Tables[0].Rows.Count > 0) //删除已有积分 { Bint.Delete(Convert.ToInt32(Bint.GetList("OrderId='" + id + "'").Tables[0].Rows[0]["Id"])); } if (ok == 1)//有效 { QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room r = Broom.GetModel(order.Roomid); //Mint.OrderId = Convert.ToInt32(id); //Mint.RoomId = order.Roomid; Mint.UserID = order.Userid; //Mint.CreateTime = order.StartTime; TimeSpan ts = (TimeSpan)(order.endTime - order.StartTime); Mint.BankMoney = Convert.ToInt32((ts.Hours * (double)r.RoomPrice)); if (order.Beveragecost != null) { Mint.BankMoney += (int)order.Beveragecost; } Bint.Add(Mint); } } gdvOrder.DataSource = databind(); gdvOrder.DataBind(); }
protected void btnSub_Click(object sender, EventArgs e) { if (txbPhone.Text == "") { Response.Write("<script>alert('请填写手机号!')</script>"); return; } string erromsg = string.Empty; string celpattern = @"(^18\d{9}$)|(^13\d{9}$)|(^15\d{9}$)"; if (txbNum.Text == "") { Response.Write("<script>alert('请填写预定人数!')</script>"); return; } string IsNumeric = @"^[0-9]+$"; if (!System.Text.RegularExpressions.Regex.IsMatch(txbNum.Text, IsNumeric)) { Response.Write("<script>alert('请填写数字!')</script>"); return; } if (Calendar1.SelectedDate.ToString() == "" || Calendar2.SelectedDate.ToString() == "") { Response.Write("<script>alert('请填写预定预定时间!')</script>"); return; } if (txbPhone.Text != "") { if (!System.Text.RegularExpressions.Regex.IsMatch(txbPhone.Text, celpattern)) { Response.Write("<script>alert('输入的手机号有错误,请重新输入!')</script>"); return; } } try { //生成一张订单 然后 修改房间信息表的房间状态 最后添加积分信息 double starthour = Convert.ToDouble(this.dplStartTime.SelectedValue); DateTime ddd = this.Calendar1.SelectedDate; DateTime startdate = this.Calendar1.SelectedDate.AddHours(starthour); double endhour = Convert.ToDouble(this.dplEndTime.SelectedValue); DateTime enddate = this.Calendar2.SelectedDate.AddHours(endhour); if (startdate >= enddate) { Response.Write("<script>alert('起始时间不应该早于结束时间,请认真填写预定时间')</script>"); return; } Morder.Roomid = roomid; Morder.Userid = userid; Morder.StartTime = startdate; Morder.endTime = enddate; Morder.OrderNumber = txbNum.Text.Trim(); Border.Add(Morder); QPS.NEW.Model.Room r = room.GetModel(roomid); r.RoomState = 1; room.Update(r); QPS.NEW.BLL.Users Buser = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Users Muser = Buser.GetModel(userid); Muser.Phone = txbPhone.Text.Trim(); Buser.Update(Muser); Response.Write("<script>alert('预定成功!');window.location.href='MainPage.aspx'</script>"); //Response.Redirect("MainPage.aspx", false); } catch (Exception ex) { Response.Write("<script>alert('预定失败!')</script>"); return; } }
protected void btnCreate_Click(object sender, EventArgs e) { try { QPS.NEW.BLL.Room Broom = new QPS.NEW.BLL.Room(); QPS.NEW.Model.Room Mroom = new QPS.NEW.Model.Room(); if (this.fulImg.FileName == "") { //this.lblMessage.Text = "<font color=#FF0000>请选择上传的图片!</font>"; this.fulImg.Focus(); return; } if (txfName.Value == string.Empty) { Response.Write("<script>alert('用户名不能为空,请重新输入')</script>"); return; } if (txfRoomPrice.Value == string.Empty) { Response.Write("<script>alert('请重新输入房间价格')</script>"); return; } if (txfAddress.Value == string.Empty) { Response.Write("<script>alert('地址不能为空,请重新输入')</script>"); return; } if (txfArea.Text == string.Empty) { Response.Write("<script>alert('地区不能为空,请重新输入')</script>"); return; } if (txfContent.Value == string.Empty) { Response.Write("<script>alert('内容不能为空,请重新输入')</script>"); return; } if (txfRoomType.Text == string.Empty) { Response.Write("<script>alert('房间类型不能为空,请重新输入')</script>"); return; } Mroom.Name = txfName.Value; Mroom.RoomPrice = Convert.ToDecimal(txfRoomPrice.Value); Mroom.RoomState = 0; Mroom.IfRecommend =1; Mroom.Address = txfAddress.Value; Mroom.Are = txfArea.Text; Mroom.Content = txfContent.Value.Length > 100 ? txfContent.Value.Substring(0, 100) : txfContent.Value; Mroom.RoomType = txfRoomType.Text; Mroom.OwnerID = userid; Mroom.ImagePath = Upload(fulImg); Mroom.Examine = 0; Broom.Add(Mroom); Response.Write("<script>alert('添加棋牌室成功!')</script>"); Response.Write("<script>window.close()</script>"); } catch (Exception ex) { Response.Write("<script>alert('添加棋牌室失败!')</script>"); return; } }