예제 #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;
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
   protected void Page_Load(object sender, EventArgs e)
 {
         orderid =Convert.ToInt32(Request.QueryString["id"]);
         QPS.NEW.BLL.Orderform Border = new QPS.NEW.BLL.Orderform();
         QPS.NEW.Model.Orderform Morder = Border.GetModel(orderid);
         QPS.NEW.BLL.Users u = new QPS.NEW.BLL.Users();
         QPS.NEW.BLL.Room r = new QPS.NEW.BLL.Room();
         int roomid=(int)  Morder.Roomid;
         int userid =(int) Morder.Userid;
        txfRoomName.Value = r.GetModel(roomid).Name;
            txfUserName.Value = u.GetModel(userid).Username;
        //txfBeverageCost.Text =Border.GetModel(orderid).Beveragecost.ToString();
         txfOrderId.Value = orderid.ToString();
   }
예제 #4
0
        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;
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            orderid = Convert.ToInt32(Request.QueryString["id"]);
            QPS.NEW.BLL.Orderform   Border = new QPS.NEW.BLL.Orderform();
            QPS.NEW.Model.Orderform Morder = Border.GetModel(orderid);
            QPS.NEW.BLL.Users       u      = new QPS.NEW.BLL.Users();
            QPS.NEW.BLL.Room        r      = new QPS.NEW.BLL.Room();
            int roomid = (int)Morder.Roomid;
            int userid = (int)Morder.Userid;

            txfRoomName.Value = r.GetModel(roomid).Name;
            txfUserName.Value = u.GetModel(userid).Username;
            //txfBeverageCost.Text =Border.GetModel(orderid).Beveragecost.ToString();
            txfOrderId.Value = orderid.ToString();
        }
예제 #6
0
 protected void gdvPersonnalOrder_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     //得到单位编号
     string rowToDelete = this.gdvRoom.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();
     if (Broom.GetModel(ID).RoomState == 1)//说明此房间被预定需要从订单中删除
     {
         DataSet dsOrder = Border.GetList("Roomid='" + ID + "'");
         int Oid = Convert.ToInt32(dsOrder.Tables[0].Rows[0]["Id"]);
         Border.Delete(Oid);
     }
     Broom.Delete(ID);
     databind(gdvRoom);
 }
예제 #7
0
        protected void gdvPersonnalOrder_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //得到单位编号
            string rowToDelete = this.gdvRoom.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();
            if (Broom.GetModel(ID).RoomState == 1)//说明此房间被预定需要从订单中删除
            {
                DataSet dsOrder = Border.GetList("Roomid='" + ID + "'");
                int     Oid     = Convert.ToInt32(dsOrder.Tables[0].Rows[0]["Id"]);
                Border.Delete(Oid);
            }
            Broom.Delete(ID);
            databind(gdvRoom);
        }
예제 #8
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);
        }
예제 #9
0
 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();
         }
     }
 }
예제 #10
0
 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();
 }
예제 #11
0
        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();
        }
예제 #12
0
        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();
            }
예제 #13
0
        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();
        }
예제 #14
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;
            }
        }
예제 #15
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);
       }