예제 #1
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
             HotelReservations   hotelReservation    = new HotelReservations();
             hotelReservation.HotelId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (hotelReservation.HotelId > 0)
             {
                 if (hotelReservationBLL.Delete(hotelReservation))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
예제 #2
0
 private void LoadList()
 {
     try
     {
         HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
         DataTable           dt = hotelReservationBLL.GetAll();
         rptrList.DataSource = dt;
         rptrList.DataBind();
     }
     catch (Exception)
     {
         //throw;
     }
 }
        private void LoadDashboardInfo()
        {
            try
            {
                //Total Guide
                GuideBLL guideBLL = new GuideBLL();
                DataTable dtGuide = guideBLL.GetAll();
                lblTotalGuide.Text = Convert.ToString(Convert.ToInt32(dtGuide.Rows.Count));

                //Total Event
                EventBLL eventBLL = new EventBLL();
                DataTable dtEvent = eventBLL.GetAll();
                lblTotalEvent.Text = Convert.ToString(Convert.ToInt32(dtEvent.Rows.Count));

                //Total Location
                LocationBLL locationBLL = new LocationBLL();
                DataTable dtLocation = locationBLL.GetAll();
                lblTotalLocation.Text = Convert.ToString(Convert.ToInt32(dtLocation.Rows.Count));

                //Total Hotel Reservation
                HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
                DataTable dtHotelReservation = hotelReservationBLL.GetAll();
                lblTotalHotelReservation.Text = Convert.ToString(Convert.ToInt32(dtHotelReservation.Rows.Count));

                //Total Registration
                RegistrationBLL registrationBLL = new RegistrationBLL();
                DataTable dtRegistration = registrationBLL.GetAll();
                lblTotalRegistration.Text = Convert.ToString(Convert.ToInt32(dtRegistration.Rows.Count));

                //Total Registration
                //SubscribeBLL subscribeBLL = new SubscribeBLL();
                //DataTable dtSubscribe = subscribeBLL.GetAll();
                //lblTotalSubscribe.Text = Convert.ToString(Convert.ToInt32(dtSubscribe.Rows.Count));
            }
            catch (Exception)
            {
                
                throw;
            }
        }
예제 #4
0
 private void GenerateCode()
 {
     try
     {
         QuaintLibraryManager lib = new QuaintLibraryManager();
         ModelCode = CodePrefix.Hotel + "-" + lib.GetSixDigitNumber(1);
         HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
         DataTable           dt = hotelReservationBLL.GetAll();
         if (dt != null)
         {
             if (dt.Rows.Count > 0)
             {
                 string[] lastCode       = dt.Rows[dt.Rows.Count - 1]["HotelCode"].ToString().Split('-');
                 int      lastCodeNumber = Convert.ToInt32(lastCode[1]);
                 ModelCode = CodePrefix.Hotel + "-" + lib.GetSixDigitNumber(lastCodeNumber + 1);
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to load.");
     }
 }
예제 #5
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtHotelName.Text))
                {
                    Alert(AlertType.Warning, "Enter hotel name.");
                    txtHotelName.Focus();
                }
                else if (string.IsNullOrEmpty(txtArrivalDate.Text))
                {
                    Alert(AlertType.Warning, "Enter date of arrival.");
                    txtArrivalDate.Focus();
                }
                else if (string.IsNullOrEmpty(txtDepartureDate.Text))
                {
                    Alert(AlertType.Warning, "Enter date of departure.");
                    txtDepartureDate.Focus();
                }
                else if (string.IsNullOrEmpty(txtRoomType.Text))
                {
                    Alert(AlertType.Warning, "Enter room type.");
                    txtRoomType.Focus();
                }
                else if (string.IsNullOrEmpty(txtBookedBy.Text))
                {
                    Alert(AlertType.Warning, "Enter booked by name.");
                    txtBookedBy.Focus();
                }
                else if (string.IsNullOrEmpty(txtContactNumber.Text))
                {
                    Alert(AlertType.Warning, "Enter contact number.");
                    txtContactNumber.Focus();
                }
                else
                {
                    QuaintLibraryManager lib = new QuaintLibraryManager();
                    string   hotelName       = Convert.ToString(txtHotelName.Text);
                    DateTime arrivalDate     = Convert.ToDateTime(txtArrivalDate.Text);
                    DateTime departureDate   = Convert.ToDateTime(txtDepartureDate.Text);
                    string   roomType        = Convert.ToString(txtRoomType.Text);
                    string   bookedBy        = Convert.ToString(txtBookedBy.Text);
                    string   email           = Convert.ToString(txtEmail.Text);
                    string   contactNumber   = Convert.ToString(txtContactNumber.Text);
                    string   address         = Convert.ToString(txtAddress.Text);


                    HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
                    HotelReservations   hotelReservation    = new HotelReservations();
                    hotelReservation.HotelCode     = this.ModelCode;
                    hotelReservation.HotelName     = hotelName;
                    hotelReservation.ArrivalDate   = arrivalDate;
                    hotelReservation.DepartureDate = departureDate;
                    hotelReservation.RoomType      = roomType;
                    hotelReservation.BookedBy      = roomType;
                    hotelReservation.Email         = email;
                    hotelReservation.ContactNumber = contactNumber;
                    hotelReservation.Address       = address;
                    hotelReservation.IsActive      = true;
                    hotelReservation.CreatedDate   = DateTime.Now;
                    hotelReservation.CreatedBy     = this.UserInfo;
                    hotelReservation.CreatedFrom   = this.StationInfo;

                    //DataTable dtAvailableRoom = hotelReservationBLL.GetAllActive();
                    //int totalAvailableRoom = dtAvailableRoom.Rows.Count;
                    if (hotelReservationBLL.Save(hotelReservation))
                    {
                        //Alert(AlertType.Success, "Saved successfully.");
                        Alert(AlertType.Success, "Saved successfully.");
                        ClearFields();
                        GenerateCode();

                        Response.Redirect("~/Pages/HotelReservation.aspx?Ref=success", false);
                    }
                    else
                    {
                        Alert(AlertType.Error, "Failed to save.");
                    }
                }
            }

            catch (Exception ex)
            {
                Alert(AlertType.Error, ex.Message.ToString());
            }
        }
예제 #6
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
                    DataTable           dt = hotelReservationBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string            actionStatus     = "Updated";
                            HotelReservations hotelReservation = new HotelReservations();
                            hotelReservation.HotelId       = Convert.ToInt32(Convert.ToString(dt.Rows[0]["HotelId"]));
                            hotelReservation.HotelCode     = Convert.ToString(dt.Rows[0]["HotelCode"]);
                            hotelReservation.HotelName     = Convert.ToString(dt.Rows[0]["HotelName"]);
                            hotelReservation.ArrivalDate   = Convert.ToDateTime(dt.Rows[0]["ArrivalDate"]);
                            hotelReservation.DepartureDate = Convert.ToDateTime(dt.Rows[0]["DepartureDate"]);
                            hotelReservation.RoomType      = Convert.ToString(dt.Rows[0]["RoomType"]);
                            hotelReservation.BookedBy      = Convert.ToString(dt.Rows[0]["BookedBy"]);
                            hotelReservation.Email         = Convert.ToString(dt.Rows[0]["Email"]);
                            hotelReservation.ContactNumber = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                            hotelReservation.Address       = Convert.ToString(dt.Rows[0]["Address"]);
                            hotelReservation.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            hotelReservation.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            hotelReservation.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            hotelReservation.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);

                            hotelReservation.UpdatedDate = DateTime.Now;
                            hotelReservation.UpdatedBy   = UserInfo;
                            hotelReservation.UpdatedFrom = StationInfo;

                            if (hotelReservation.IsActive)
                            {
                                hotelReservation.IsActive = false;
                                actionStatus = "Deactivated";
                            }
                            else
                            {
                                hotelReservation.IsActive = true;
                                actionStatus = "Activated";
                            }

                            if (hotelReservationBLL.Update(hotelReservation))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }