Exemplo n.º 1
0
        public List <Booking_Details> View()
        {
            SqlConnection conn = new SqlConnection("server = intvmsql01; user id = pj01test01; password = tcstvm; database=DB01TEST01");

            conn.Open();
            SqlCommand cmd = new SqlCommand("view__details_1", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            SqlDataReader          rdr    = cmd.ExecuteReader();
            List <Booking_Details> bdlist = new List <Booking_Details>();

            while (rdr.Read())
            {
                Booking_Details bd = new Booking_Details();
                bd.Bid            = Convert.ToInt32(rdr["bid"]);
                bd.Name1          = rdr["name"].ToString();
                bd.Age1           = Convert.ToInt32(rdr["age"].ToString());
                bd.ContactNumber1 = Convert.ToInt64(rdr["contactnumber"]);
                bd.EmailId1       = rdr["emailid"].ToString();
                bd.Address1       = rdr["addresss"].ToString();
                bd.RoomCategory1  = rdr["roomcategory"].ToString();
                bd.NumberofDays1  = Convert.ToInt32(rdr["noofdays"]);
                bd.RentalAmount1  = Convert.ToInt32(rdr["rentalamount"]);
                bdlist.Add(bd);
            }

            return(bdlist);
        }
Exemplo n.º 2
0
        /*      public int connectionclass()
         *  {
         *        SqlConnection conn = new SqlConnection("server = intvmsql01; user name = pj01test01; password = tcstvm; database=DB01TEST01");
         *        conn.Open();
         *         return 0;
         *    }
         */
        public int bookroom(Booking_Details bdobj)
        {
            SqlConnection conn = new SqlConnection("server = intvmsql01; user id = pj01test01; password = tcstvm; database=DB01TEST01");

            conn.Open();
            SqlCommand cmd = new SqlCommand("booking__details5", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@name", bdobj.Name1);
            cmd.Parameters.AddWithValue("@age", bdobj.Age1);
            cmd.Parameters.AddWithValue("@contactnumber", bdobj.ContactNumber1);
            cmd.Parameters.AddWithValue("@emailid", bdobj.EmailId1);
            cmd.Parameters.AddWithValue("@addresss", bdobj.Address1);
            cmd.Parameters.AddWithValue("@roomcategory", bdobj.RoomCategory1);
            cmd.Parameters.AddWithValue("@noofdays", bdobj.NumberofDays1);
            cmd.Parameters.AddWithValue("@rentalamount", bdobj.RentalAmount1);
            cmd.Parameters.AddWithValue("@boid1", 0);
            cmd.Parameters["@boid1"].Direction = ParameterDirection.Output;
            int rowaffected = cmd.ExecuteNonQuery();

            if (rowaffected > 0)
            {
                int BookingID = Convert.ToInt32(cmd.Parameters["@boid1"].Value);
                return(BookingID);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 3
0
        public ActionResult DeleteRequest(int id)
        {
            int             cid = (int)Session["id"];
            Booking_Details bd  = Db.Booking_Details.Where(m => m.Customer_Id == cid && m.Property_Id == id).FirstOrDefault();

            Db.Booking_Details.Remove(bd);
            Db.SaveChanges();
            return(RedirectToAction("Property"));
        }
 // POST api/<controller>
 public HttpResponseMessage Post(Booking_Details bd)
 {
     try
     {
         db.Booking_Details.Add(bd);
         db.SaveChanges();
         return(new HttpResponseMessage(HttpStatusCode.Created));
     }
     catch (Exception ex)
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
Exemplo n.º 5
0
        public ActionResult PropertyRequest(int pid, int Sid)
        {
            int             cid = (int)Session["id"];
            Booking_Details bd  = new Booking_Details
            {
                Customer_Id = cid,
                Property_Id = pid,
                Seller_Id   = Sid
            };

            Db.Booking_Details.Add(bd);
            Db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 // PUT api/<controller>/5
 public HttpResponseMessage Put(int id, Booking_Details bd)
 {
     try
     {
         if (id == bd.TicketNo)
         {
             db.Entry(bd).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(new HttpResponseMessage(HttpStatusCode.OK));
         }
         else
         {
             return(new HttpResponseMessage(HttpStatusCode.NotFound));
         }
     }
     catch (Exception ex)
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
 // DELETE api/<controller>/5
 public HttpResponseMessage Delete(int id)
 {
     try
     {
         Booking_Details b = db.Booking_Details.Find(id);
         if (b != null)
         {
             db.Booking_Details.Remove(b);
             db.SaveChanges();
             return(new HttpResponseMessage(HttpStatusCode.OK));
         }
         else
         {
             return(new HttpResponseMessage(HttpStatusCode.NotFound));
         }
     }
     catch (Exception ex)
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
Exemplo n.º 8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
    
            string name = TextBox2.Text;
            int age = Convert.ToInt32(TextBox3.Text);
            long contactnumber = Convert.ToInt32(TextBox4.Text);
            string email = TextBox5.Text;
            string address = TextBox6.Text;
            string roomcategory = DropDownList1.SelectedItem.Value;
            int noofdays = Convert.ToInt32(TextBox7.Text);
            int rentalamount=0;
            if(roomcategory=="Single")
            {
                rentalamount = 1000 * noofdays;
                Response.Write(rentalamount);
            }
            else if(roomcategory == "double" || roomcategory=="Double")
            {
                rentalamount = 2500 * noofdays;
                Response.Write(rentalamount);
            }
            else if(roomcategory == "deluxe" || roomcategory=="Deluxe")
            {
                rentalamount = 5000 * noofdays;
                Response.Write(rentalamount);
            }
            else
            {
                Response.Write("error");
            }

            Booking_Details bd = new Booking_Details(name,age,contactnumber,email,address,roomcategory,noofdays,rentalamount);
           Booking_Operation bo = new Booking_Operation();
            int bookingid= bo.bookroom(bd);
           
        }