Esempio n. 1
0
        protected void gvAprovReq_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            AdminOperation _aObj = new AdminOperation();

            if (e.CommandName == "APPROVE")
            {
                SqlCommand _cmd = new SqlCommand("update Booking set BookingStatus = 'ACCEPTED' where BookingID = " + ddlBookingID.SelectedValue + "  ", _conObj);
                _conObj.Open();
                SqlDataReader dr = _cmd.ExecuteReader();
                gvAprovReq.DataSource = dr;
                gvAprovReq.DataBind();
                Response.Write("<script>alert('Booking ID successfully APPROVED')</script>");

                EntityLayers.Booking _bookobj = new EntityLayers.Booking()
                {
                    _bookingID = int.Parse(ddlBookingID.SelectedValue)
                };
                _aObj.ApproveRoom(_bookobj);
            }
            else if (e.CommandName == "REJECT")
            {
                SqlCommand _cmd = new SqlCommand("update Booking set BookingStatus = 'REJECTED' where BookingID = " + ddlBookingID.SelectedValue + "  ", _conObj);
                _conObj.Open();
                SqlDataReader dr = _cmd.ExecuteReader();
                gvAprovReq.DataSource = dr;
                gvAprovReq.DataBind();
                Response.Write("<script>alert('Booking ID successfully REJECTED')</script>");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string        _uId    = Session["UserID"].ToString();
            SqlConnection _conObj = new SqlConnection("server=.; database=HotelDB; trusted_connection=yes");

            EntityLayers.Booking _bObj = new EntityLayers.Booking();
            _conObj.Open();

            SqlCommand    _cmd = new SqlCommand(" select BookingID from Booking where UserID='" + _uId + "' ", _conObj);
            SqlDataReader dr   = _cmd.ExecuteReader();

            while (dr.Read())
            {
                _bObj._bookingID = int.Parse(dr[0].ToString());
            }
            _conObj.Close();
            txtBookID.Text = _bObj._bookingID.ToString();



            lblUserSession.Text = Session["UserID"].ToString();
            //  txtBookID.Text = Session["BookingID"].ToString();

            if (!IsPostBack)
            {
                lblIdli.Visible = false;
                txtIdli.Visible = false;

                lblBiryani.Visible = false;
                txtBiryani.Visible = false;

                lblPasta.Visible = false;
                txtPasta.Visible = false;

                lblBurger.Visible = false;
                txtBurger.Visible = false;

                lblIcecream.Visible = false;
                txtIcecream.Visible = false;

                lblDosa.Visible = false;
                txtDosa.Visible = false;
            }
        }
        protected void btnOrder_Click(object sender, EventArgs e)
        {
            lblUserSession.Text = Session["UserID"].ToString();
            string uname = lblUserSession.Text;

            UserOperation _user = new UserOperation();

            List <EntityLayers.Booking> _temp;

            EntityLayers.Booking _bookobj = new EntityLayers.Booking()
            {
                //_bookingID = int.Parse(Session["BookingID"].ToString()),
                _bookingID = int.Parse(txtBookID.Text),
                _userID    = uname
            };


            _temp = _user.RetreiveOrderFood(_bookobj);

            string _check = _temp[0]._status;

            decimal _tPrice = 0;



            if (_check == "ACCEPTED")
            {
                SqlConnection _con = new SqlConnection("server=.; database=HotelDB; trusted_connection=yes");
                _con.Open();

                if (chkIdli.Checked)
                {
                    _tPrice = decimal.Parse(txtIdli.Text) * (decimal)55;
                    SqlCommand _cmd = new SqlCommand(" insert into TEMPORDER values ( 'idli', " + txtIdli.Text + ", '55' , " + _tPrice + ", '" + lblUserSession.Text + "' )", _con);
                    _cmd.ExecuteNonQuery();
                }


                if (chkBiryani.Checked)
                {
                    _tPrice = decimal.Parse(txtBiryani.Text) * (decimal)155;
                    SqlCommand _cmd = new SqlCommand("insert into TEMPORDER values ('biryani', " + txtBiryani.Text + ", '155' , " + _tPrice + " , '" + lblUserSession.Text + "' )", _con);
                    _cmd.ExecuteNonQuery();
                }

                if (chkPasta.Checked)
                {
                    _tPrice = decimal.Parse(txtPasta.Text) * (decimal)110;
                    SqlCommand _cmd = new SqlCommand(" insert into TEMPORDER values ('Pasta'," + txtPasta.Text + ", '110' ," + _tPrice + " , '" + lblUserSession.Text + "' )", _con);
                    _cmd.ExecuteNonQuery();
                }


                if (chkBurger.Checked)
                {
                    _tPrice = decimal.Parse(txtBurger.Text) * (decimal)60;
                    SqlCommand _cmd = new SqlCommand(" insert into TEMPORDER values ('Mexican burger', " + txtBurger.Text + ", '60' , " + _tPrice + ", '" + lblUserSession.Text + "' ) ", _con);
                    _cmd.ExecuteNonQuery();
                }


                if (chkIcecream.Checked)
                {
                    _tPrice = decimal.Parse(txtIcecream.Text) * (decimal)90;
                    SqlCommand _cmd = new SqlCommand(" insert into TEMPORDER values ('Triple Sunday', " + txtIcecream.Text + ", '90' , " + _tPrice + ", '" + lblUserSession.Text + "' ) ", _con);
                    _cmd.ExecuteNonQuery();
                }


                if (chkDosa.Checked)
                {
                    _tPrice = decimal.Parse(txtDosa.Text) * (decimal)60;
                    SqlCommand _cmd = new SqlCommand("insert into TEMPORDER values ('Masala Dosa'," + txtDosa.Text + ",'60' ,  " + _tPrice + ", '" + lblUserSession.Text + "' )", _con);
                    _cmd.ExecuteNonQuery();
                }

                _con.Close();
                Response.Redirect("UserOrderDetails.aspx");
            }
            else if (_check == "REJECTED" || _check == "PENDING")
            {
                Response.Write("<script> alert(' You need to book the room to order Food')</script>");
            }
        }
Esempio n. 4
0
 public int BookNow(EntityLayers.Booking _bObj)
 {
     return(base.Channel.BookNow(_bObj));
 }