private void RoomBooking_Load(object sender, EventArgs e)
        {
            dateTimePicker1.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            dateTimePicker2.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

            try
            {
                rd.Load(@"C:\Users\nanthu\Desktop\HotelManagementSystem\HotelManagementSystem\CrystalReport2.rpt");
                connection     con = new connection();
                SqlDataAdapter sad = new SqlDataAdapter("roombookingview", con.Activecon());
                sad.SelectCommand.CommandType = CommandType.StoredProcedure;
                sad.SelectCommand.Parameters.AddWithValue("@mode", "checkout");
                sad.SelectCommand.Parameters.AddWithValue("@date1", dateTimePicker1.Value);
                sad.SelectCommand.Parameters.AddWithValue("@date2", dateTimePicker2.Value);
                DataSet st = new DataSet();
                sad.Fill(st, "BookingReport");

                rd.SetDataSource(st);
                crystalReportViewer1.ReportSource = rd;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 2
0
        private void ViewBills_Load(object sender, EventArgs e)
        {
            // textBox2.Text = Convert.ToDateTime(textBox2.Text).ToString("yyyy-mm-dd hh:mi:ss.mmm");
            //  DateTime dt=DateTime.ParseExact(this.date,"yyyy-MM-dd HH:mm:ss")



            try
            {
                rd.Load(@"C:\Users\nanthu\Desktop\HotelManagementSystem\HotelManagementSystem\CrystalReport4.rpt");
                connection     con = new connection();
                SqlDataAdapter sad = new SqlDataAdapter("printBillforguest", con.Activecon());
                sad.SelectCommand.CommandType = CommandType.StoredProcedure;
                sad.SelectCommand.Parameters.AddWithValue("@guestId", textBox1.Text.Trim());
                //   DateTime ad = Convert.ToDateTime(textBox2.Text.Trim());
                // sad.SelectCommand.Parameters.AddWithValue("@date", textBox2.Text);
                DataSet st = new DataSet();
                sad.Fill(st, "prinybillforguests");

                rd.SetDataSource(st);
                crystalReportViewer1.ReportSource = rd;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                try
                {
                    rd.Load(@"C:\Users\nanthu\Desktop\HotelManagementSystem\HotelManagementSystem\CrystalReport2.rpt");
                    connection     con = new connection();
                    SqlDataAdapter sad = new SqlDataAdapter("roombookingview", con.Activecon());
                    sad.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sad.SelectCommand.Parameters.AddWithValue("@mode", "checkin");
                    sad.SelectCommand.Parameters.AddWithValue("@date1", dateTimePicker1.Value);
                    sad.SelectCommand.Parameters.AddWithValue("@date2", dateTimePicker2.Value);

                    DataSet st = new DataSet();
                    sad.Fill(st, "BookingReport");

                    rd.SetDataSource(st);
                    crystalReportViewer1.ReportSource = rd;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
            else if (radioButton2.Checked == true)
            {
                try
                {
                    rd.Load(@"C:\Users\nanthu\Desktop\HotelManagementSystem\HotelManagementSystem\CrystalReport2.rpt");
                    connection     con = new connection();
                    SqlDataAdapter sad = new SqlDataAdapter("roombookingview", con.Activecon());
                    sad.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sad.SelectCommand.Parameters.AddWithValue("@mode", "checkout");
                    sad.SelectCommand.Parameters.AddWithValue("@date1", dateTimePicker1.Value);
                    sad.SelectCommand.Parameters.AddWithValue("@date2", dateTimePicker2.Value);

                    DataSet st = new DataSet();
                    sad.Fill(st, "BookingReport");

                    rd.SetDataSource(st);
                    crystalReportViewer1.ReportSource = rd;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
            else
            {
                MessageBox.Show("please check your check in and check out button", "Error");
            }
        }
        void searchreport()
        {
            try
            {
                rd.Load(@"C:\Users\nanthu\Desktop\HotelManagementSystem\HotelManagementSystem\CrystalReport1.rpt");
                connection     con = new connection();
                SqlDataAdapter sad = new SqlDataAdapter("guestVieworSearchReport", con.Activecon());
                sad.SelectCommand.CommandType = CommandType.StoredProcedure;
                sad.SelectCommand.Parameters.AddWithValue("@lname", gsearch.Text.Trim());
                DataSet st = new DataSet();
                sad.Fill(st, "guestdetails");

                rd.SetDataSource(st);
                crystalReportViewer1.ReportSource = rd;
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                rd.Load(@"C:\Users\nanthu\Desktop\HotelManagementSystem\HotelManagementSystem\CrystalReport3.rpt");
                connection     con = new connection();
                SqlDataAdapter sad = new SqlDataAdapter("viewbilldate", con.Activecon());
                sad.SelectCommand.CommandType = CommandType.StoredProcedure;
                sad.SelectCommand.Parameters.AddWithValue("@date2", dateTimePicker1.Value);
                sad.SelectCommand.Parameters.AddWithValue("@date1", dateTimePicker2.Value);
                DataSet st = new DataSet();
                sad.Fill(st, "ViewBiil");

                rd.SetDataSource(st);
                crystalReportViewer1.ReportSource = rd;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }