Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        //修改
        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>");
            }
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
       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);
       }