Ejemplo n.º 1
0
        public void getTimeCustomerServices(string aBookingID, string primaryBookingID, int i, SP_GetEmpAgenda a)
        {
            #region Time

            TableCell start = new TableCell();
            start.Width = 200;
            TableCell end = new TableCell();
            end.Width = 200;

            try
            {
                try
                {
                    bServices = handler.getBookingServices(a.BookingID.ToString());
                }
                catch (Exception serviceErr)
                {
                    function.logAnError("Error getting services [receptionist.aspx {tryCatch within getTime  method }]err:" + serviceErr.ToString());
                }

                if (bServices.Count > 0)
                {
                    time = handler.getMultipleServicesTime(primaryBookingID);

                    start.Text = time.StartTime.ToString("HH:mm");
                    AgendaTable.Rows[i].Cells.Add(start);

                    end.Text = time.EndTime.ToString("HH:mm");
                    AgendaTable.Rows[i].Cells.Add(end);
                }
            }
            catch (Exception Err)
            {
                //If time isn't retrieved (Error)
                start.Text = "---";
                AgendaTable.Rows[i].Cells.Add(start);
                end.Text = "---";
                AgendaTable.Rows[i].Cells.Add(end);
                function.logAnError("Couldn't get the time (check db for 2nd bkID) [receptionist.aspx {getTimeCustomerServices?getTime}] error:"
                                    + Err.ToString());
            }
            #endregion
            #region Customer
            TableCell c = new TableCell();
            c.Width = 300;
            c.Text  = "<a href = '../Profile.aspx?Action=View&UserID=" + a.UserID.ToString().Replace(" ", string.Empty) +
                      "'>" + a.CustomerFName.ToString() + "</a>";
            AgendaTable.Rows[i].Cells.Add(c);
            #endregion
            #region Services

            TableCell services = new TableCell();
            services.Width = 300;

            try
            {
                bServices = handler.getBookingServices(a.BookingID.ToString());
                if (bServices.Count == 1)
                {
                    services.Text = "<a href='../cheveux/services.aspx?ProductID=" + bServices[0].ServiceID.Replace(" ", string.Empty) + "'>"
                                    + bServices[0].ServiceName.ToString() + "</a>";
                }
                else if (bServices.Count > 1)
                {
                    string dropDown = "<li style='list-style: none;' class='dropdown'>" +
                                      "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
                    if (bServices.Count == 2)
                    {
                        dropDown += bServices[0].ServiceName.ToString() +
                                    ", " + bServices[1].ServiceName.ToString();
                    }
                    else if (bServices.Count > 2)
                    {
                        dropDown += " Multiple ";
                    }
                    dropDown += "<span class='caret'></span></a>" +
                                "<ul class='dropdown-menu bg-dark text-white'>";
                    foreach (SP_GetBookingServices service in bServices)
                    {
                        dropDown += "<li>&nbsp;<a href='../cheveux/services.aspx?ProductID=" + service.ServiceID.Replace(" ", string.Empty) + "'>" +
                                    " " + service.ServiceName.ToString() + " </a>&nbsp;</li>";
                    }
                    dropDown += "</ul></li>";

                    services.Text = dropDown;
                }
                AgendaTable.Rows[i].Cells.Add(services);
            }
            catch (Exception Err)
            {
                //if theres an error or cant retrieve the services from the database
                services.Text = "Unable to retreive services";
                AgendaTable.Rows[i].Cells.Add(services);
                function.logAnError("Couldn't get the services [receptionist.aspx {getTimeCustomerServices?getServices} ] error:" + Err.ToString());
            }


            #endregion
        }
Ejemplo n.º 2
0
        private void loadTodaysBookings()
        {
            //load todays bookings from the database and diplays them in the bookings table
            try
            {
                //load todays bookings
                todaysBookings = handler.getTodaysBookings();
                //check if the are any bookings today
                if (todaysBookings.Count > 0)
                {
                    //set the table headings
                    //create a new row in the table and set the height
                    TableRow newRow = new TableRow();
                    newRow.Height = 50;
                    tblBookings.Rows.Add(newRow);
                    //create a header row and set cell withs
                    TableHeaderCell newHeaderCell = new TableHeaderCell();
                    newHeaderCell.Text  = "Time: ";
                    newHeaderCell.Width = 100;
                    tblBookings.Rows[bookingCount].Cells.Add(newHeaderCell);
                    newHeaderCell       = new TableHeaderCell();
                    newHeaderCell.Text  = "Customer: ";
                    newHeaderCell.Width = 250;
                    tblBookings.Rows[bookingCount].Cells.Add(newHeaderCell);
                    newHeaderCell       = new TableHeaderCell();
                    newHeaderCell.Text  = "Description: ";
                    newHeaderCell.Width = 300;
                    tblBookings.Rows[bookingCount].Cells.Add(newHeaderCell);
                    newHeaderCell       = new TableHeaderCell();
                    newHeaderCell.Text  = "Status: ";
                    newHeaderCell.Width = 250;
                    tblBookings.Rows[bookingCount].Cells.Add(newHeaderCell);
                    newHeaderCell = new TableHeaderCell();
                    //view booking details
                    newHeaderCell.Width = 100;
                    tblBookings.Rows[bookingCount].Cells.Add(newHeaderCell);

                    //increment rowcounter
                    bookingCount++;

                    //fill the table with bookings
                    //upcoming bookings
                    foreach (SP_GetTodaysBookings booking in todaysBookings)
                    {
                        //create a new row in the table and set the height
                        newRow        = new TableRow();
                        newRow.Height = 50;
                        tblBookings.Rows.Add(newRow);
                        //fill the wrow with data
                        TableCell newCell = new TableCell();
                        newCell.Text = booking.StartTime.ToString("HH:mm");
                        tblBookings.Rows[bookingCount].Cells.Add(newCell);
                        newCell      = new TableCell();
                        newCell.Text = "<a href = '../Profile.aspx?Action=View&UserID=" + booking.CustomerID.ToString().Replace(" ", string.Empty) +
                                       "&PreviousPage=Dashboard.aspx'>" + booking.CustomerFirstName + " " + booking.CustomerLastName + "</a>";
                        tblBookings.Rows[bookingCount].Cells.Add(newCell);
                        //Services
                        List <SP_GetBookingServices> bookingServiceList = null;
                        //get the booking services
                        try
                        {
                            bookingServiceList = handler.getBookingServices(booking.BookingID.ToString());
                        }
                        catch (Exception Err)
                        {
                            function.logAnError("Error Loading Booking Services in manager dashboard todays bookings (Upcoming) Error:" +
                                                Err.ToString());
                        }
                        newCell = new TableCell();
                        if (bookingServiceList.Count == 1)
                        {
                            newCell.Text = "<a href='ViewProduct.aspx?ProductID=" + bookingServiceList[0].ServiceID.Replace(" ", string.Empty) + "'>"
                                           + bookingServiceList[0].ServiceName.ToString() + "</a>";
                        }
                        else if (bookingServiceList.Count > 1)
                        {
                            string dropDown = "<li style='list-style: none;' class='dropdown'>" +
                                              "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
                            if (bookingServiceList.Count == 2)
                            {
                                dropDown += bookingServiceList[0].ServiceName.ToString() +
                                            ", " + bookingServiceList[1].ServiceName.ToString();
                            }
                            else if (bookingServiceList.Count > 2)
                            {
                                dropDown += " Multiple ";
                            }
                            dropDown += "<span class='caret'></span></a>" +
                                        "<ul class='dropdown-menu bg-dark text-white'>";
                            foreach (SP_GetBookingServices service in bookingServiceList)
                            {
                                dropDown += "<li>&nbsp;<a href='/cheveux/services.aspx?ProductID=" + service.ServiceID.Replace(" ", string.Empty) + "'>" +
                                            " " + service.ServiceName.ToString() + " </a>&nbsp;</li>";
                            }
                            dropDown += "</ul></li>";

                            newCell.Text = dropDown;
                        }
                        tblBookings.Rows[bookingCount].Cells.Add(newCell);
                        newCell = new TableCell();
                        if (function.GetFullArrivedStatus(booking.Arrived.ToString()[0]) == "No")
                        {
                            newCell.Text = "Not Arrived";
                        }
                        else if (function.GetFullArrivedStatus(booking.Arrived.ToString()[0]) == "Yes")
                        {
                            newCell.Text = "Arrived";
                        }
                        tblBookings.Rows[bookingCount].Cells.Add(newCell);
                        newCell      = new TableCell();
                        newCell.Text = "<button type = 'button' class='btn btn-default'>" +
                                       "<a href = '../ViewBooking.aspx?BookingID=" + booking.BookingID.ToString().Replace(" ", string.Empty) +
                                       "&BookingType=Past" +
                                       "&PreviousPage=../Manager/Dashboard.aspx'>View</a></button>";
                        tblBookings.Rows[bookingCount].Cells.Add(newCell);

                        //increment rowcounter
                        bookingCount++;
                    }

                    //set the bookings count
                    bookingsLable.Text = bookingCount - 1 + " Bookings";
                }
                else if (todaysBookings.Count == 0)
                {
                    //set the bookings count
                    bookingsLable.Text  = "No bookings today";
                    tblBookings.Visible = false;
                }
                else if (todaysBookings.Count < 0)
                {
                    //let the user know an error occoured
                    bookingsLable.Text  = "An error occurred loading all bookings";
                    tblBookings.Visible = false;
                }
            }
            catch (Exception Err)
            {
                bookingsLable.Text = "An error occurred loading todays bookings";
                function.logAnError("unable to load todays bookings on Manager/Dashboard.aspx: " +
                                    Err);
            }
        }
Ejemplo n.º 3
0
        public void getTimeCustomerServices(string aBookingID, string primaryBookingID, int rCnt, SP_GetAllofBookingDTL a)
        {
            #region Customer
            TableCell c = new TableCell();
            c.Width = 300;
            c.Text  = "<a href = '../Profile.aspx?Action=View&UserID=" + a.CustomerID.ToString().Replace(" ", string.Empty) +
                      "'>" + a.CustomerName.ToString() + "</a>";
            allBookingTable.Rows[rCnt].Cells.Add(c);
            rCnt++;
            #endregion
            #region Services

            TableRow newRow = new TableRow();
            newRow.Height = 50;
            allBookingTable.Rows.Add(newRow);
            TableCell newCell = new TableCell();
            newCell.Font.Bold = true;
            newCell.Text      = "Service :";
            newCell.Width     = 300;
            allBookingTable.Rows[rCnt].Cells.Add(newCell);
            TableCell services = new TableCell();
            services.Width = 300;

            try
            {
                bServices = handler.getBookingServices(a.BookingID.ToString());
                if (bServices.Count == 1)
                {
                    services.Text = "<a href='../cheveux/services.aspx?ProductID=" + bServices[0].ServiceID.Replace(" ", string.Empty) + "'>"
                                    + bServices[0].ServiceName.ToString() + "</a>";
                }
                else if (bServices.Count > 1)
                {
                    string dropDown = "<li style='list-style: none;' class='dropdown'>" +
                                      "<a class='dropdown-toggle' data-toggle='dropdown' href='#'>";
                    if (bServices.Count == 2)
                    {
                        dropDown += bServices[0].ServiceName.ToString() +
                                    ", " + bServices[1].ServiceName.ToString();
                    }
                    else if (bServices.Count > 2)
                    {
                        dropDown += " Multiple ";
                    }
                    dropDown += "<span class='caret'></span></a>" +
                                "<ul class='dropdown-menu bg-dark text-white'>";
                    foreach (SP_GetBookingServices service in bServices)
                    {
                        dropDown += "<li>&nbsp;<a href='../cheveux/services.aspx?ProductID=" + service.ServiceID.Replace(" ", string.Empty) + "'>" +
                                    " " + service.ServiceName.ToString() + " </a>&nbsp;</li>";
                    }
                    dropDown += "</ul></li>";

                    services.Text = dropDown;
                }
                allBookingTable.Rows[rCnt].Cells.Add(services);
                rCnt++;
            }
            catch (Exception Err)
            {
                //if theres an error or cant retrieve the services from the database
                services.Text = "Unable to retreive services";
                allBookingTable.Rows[rCnt].Cells.Add(services);
                rCnt++;
                function.logAnError("Couldn't get the services [stylist.aspx {getTimeCustomerServices?getServices} ] error:" + Err.ToString());
            }
            #endregion
            #region Time

            newRow        = new TableRow();
            newRow.Height = 50;
            allBookingTable.Rows.Add(newRow);
            newCell           = new TableCell();
            newCell.Font.Bold = true;
            newCell.Text      = "Start Time - End Time:";
            newCell.Width     = 300;
            allBookingTable.Rows[rCnt].Cells.Add(newCell);
            newCell       = new TableCell();
            newCell.Width = 300;
            try
            {
                try
                {
                    bServices = handler.getBookingServices(a.BookingID.ToString());
                }
                catch (Exception serviceErr)
                {
                    function.logAnError("Error retreiving services [receptionist.aspx] getTimeAndServices method err:" + serviceErr.ToString());
                }
                if (bServices.Count > 0)
                {
                    time = handler.getMultipleServicesTime(primaryBookingID);

                    newCell.Text = time.StartTime.ToString("HH:mm") + " - " + time.EndTime.ToString("HH:mm");

                    allBookingTable.Rows[rCnt].Cells.Add(newCell);
                    rCnt++;
                }
            }
            catch (Exception Err)
            {
                newCell.Text = "Unable to retrieve time";
                function.logAnError("Couldn't get the time [customerVisit.aspx, getT&C&S method] Error:" + Err.ToString());
            }

            //if (bServices.Count < 2)
            //{
            //    newCell.Text = a.StartTime.ToString("HH:mm") + " - " + a.EndTime.ToString("HH:mm");
            //}
            //else if (bServices.Count >= 2)
            //{
            //    newCell.Text = time.StartTime.ToString("HH:mm") + " - " + time.EndTime.ToString("HH:mm");
            //}
            #endregion
        }
Ejemplo n.º 4
0
        public void searchBookings(object sender, EventArgs e)
        {
            List <SP_GetCustomerBooking> bookingsList       = new List <SP_GetCustomerBooking>();
            List <SP_GetBookingServices> bookingServiceList = null;
            bool searchBooking = false;

            bookingCount = 0;
            bookingSearchResults.Rows.Clear();
            //get the search term form the querystring
            searchTerm = Request.QueryString["ST"];

            if (cookie != null)
            {
                if (cookie["UT"].ToString()[0] == 'C' ||
                    cookie["UT"].ToString()[0] == 'R' ||
                    cookie["UT"].ToString()[0] == 'S' ||
                    cookie["UT"].ToString()[0] == 'M')
                {
                    searchBooking = true;
                    if (!Page.IsPostBack)
                    {
                        CalendarDateStrart.SelectedDate = Convert.ToDateTime("1/1/1753");
                        CalendarDateEnd.SelectedDate    = Convert.ToDateTime("12/31/9999");
                    }
                }

                if (searchBooking == true)
                {
                    if (CalendarDateStrart.SelectedDate < CalendarDateEnd.SelectedDate)
                    {
                        lCalBookingError.Visible = false;
                        //add booking to list
                        foreach (SP_GetCustomerBooking book in handler.searchBookings(CalendarDateStrart.SelectedDate, CalendarDateEnd.SelectedDate))
                        {
                            bookingsList.Add(book);
                        }

                        //sort the list by date
                        bookingsList.Sort((x, y) => y.bookingDate.CompareTo(x.bookingDate));

                        if (bookingsList.Count != 0)
                        {
                            foreach (SP_GetCustomerBooking booking in bookingsList)
                            {
                                bool addBooking = false;

                                //if customer show only their bookings
                                if (cookie["UT"].ToString()[0] == 'C' &&
                                    booking.CustomerID.ToString().Replace(" ", string.Empty) == cookie["ID"].ToString().Replace(" ", string.Empty))
                                {
                                    if (function.compareToSearchTerm(booking.bookingDate.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.bookingStartTime.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.stylistFirstName.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(function.GetFullArrivedStatus(booking.arrived), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.BookingComment.ToString(), searchTerm) == true)
                                    {
                                        addBooking = true;
                                    }

                                    bookingServiceList = handler.getBookingServices(booking.bookingID);
                                    foreach (SP_GetBookingServices bookingService in bookingServiceList)
                                    {
                                        if (function.compareToSearchTerm(bookingService.ServiceName.ToString(), searchTerm) == true ||
                                            function.compareToSearchTerm(bookingService.serviceDescripion.ToString(), searchTerm) == true)
                                        {
                                            addBooking = true;
                                        }
                                    }
                                }
                                //if stylist show only their bookings
                                else if (cookie["UT"].ToString()[0] == 'S' &&
                                         booking.stylistEmployeeID.ToString().Replace(" ", string.Empty) == cookie["ID"].ToString().Replace(" ", string.Empty))
                                {
                                    if (function.compareToSearchTerm(booking.bookingDate.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.bookingStartTime.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.CustFullName.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.BookingComment.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(function.GetFullArrivedStatus(booking.arrived), searchTerm) == true)
                                    {
                                        addBooking = true;
                                    }

                                    bookingServiceList = handler.getBookingServices(booking.bookingID);
                                    foreach (SP_GetBookingServices bookingService in bookingServiceList)
                                    {
                                        if (function.compareToSearchTerm(bookingService.ServiceName.ToString(), searchTerm) == true ||
                                            function.compareToSearchTerm(bookingService.serviceDescripion.ToString(), searchTerm) == true)
                                        {
                                            addBooking = true;
                                        }
                                    }
                                }
                                //if receptionist or manager show only their bookings
                                else if (cookie["UT"].ToString()[0] == 'R' ||
                                         cookie["UT"].ToString()[0] == 'M')
                                {
                                    if (function.compareToSearchTerm(booking.bookingDate.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.bookingStartTime.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.stylistFirstName.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.CustFullName.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(booking.BookingComment.ToString(), searchTerm) == true ||
                                        function.compareToSearchTerm(function.GetFullArrivedStatus(booking.arrived), searchTerm) == true)
                                    {
                                        addBooking = true;
                                    }

                                    bookingServiceList = handler.getBookingServices(booking.bookingID);
                                    foreach (SP_GetBookingServices bookingService in bookingServiceList)
                                    {
                                        if (function.compareToSearchTerm(bookingService.ServiceName.ToString(), searchTerm) == true ||
                                            function.compareToSearchTerm(bookingService.serviceDescripion.ToString(), searchTerm) == true)
                                        {
                                            addBooking = true;
                                        }
                                    }
                                }

                                if (addBooking == true)
                                {
                                    if (bookingCount == 0)
                                    {
                                        createBookingTableHeader();
                                        FillterBookingResults.Visible = true;
                                    }
                                    bookingCount++;
                                    // create a new row in the results table and set the height
                                    TableRow newRow = new TableRow();
                                    newRow.Height = 50;
                                    bookingSearchResults.Rows.Add(newRow);
                                    //fill the row with the data from the results object
                                    //Date
                                    TableCell newCell = new TableCell();
                                    newCell.Text = booking.bookingDate.ToString("dd-MM-yyyy");
                                    bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);
                                    //Services
                                    newCell = new TableCell();
                                    if (bookingServiceList.Count == 1)
                                    {
                                        newCell.Text = "<a href='/cheveux/services.aspx?ProductID=" + bookingServiceList[0].ServiceID.Replace(" ", string.Empty) + "'>"
                                                       + bookingServiceList[0].ServiceName.ToString() + "</a>";
                                    }
                                    else if (bookingServiceList.Count == 2)
                                    {
                                        newCell.Text = "<a href='../ViewBooking.aspx?BookingID=" + booking.bookingID.ToString().Replace(" ", string.Empty) +
                                                       "'>" + bookingServiceList[0].ServiceName.ToString() +
                                                       ", " + bookingServiceList[1].ServiceName.ToString() + "</a>";
                                    }
                                    else if (bookingServiceList.Count > 2)
                                    {
                                        newCell.Text = "<a href='../ViewBooking.aspx?BookingID=" + booking.bookingID.ToString().Replace(" ", string.Empty) +
                                                       "&BookingType=Past'> Multiple </a>";
                                    }
                                    bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);

                                    //if customer show stylist
                                    if (cookie["UT"].ToString()[0] == 'C')
                                    {
                                        //Stylist
                                        newCell      = new TableCell();
                                        newCell.Text = "<a href='Profile.aspx?Action=View" +
                                                       "&empID=" + booking.stylistEmployeeID.ToString().Replace(" ", string.Empty) +
                                                       "'>" + booking.stylistFirstName.ToString() + "</a>";
                                        bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);
                                    }
                                    //if stylist show customer
                                    else if (cookie["UT"].ToString()[0] == 'S')
                                    {
                                        //Customer
                                        newCell      = new TableCell();
                                        newCell.Text = "<a href='Profile.aspx?Action=View" +
                                                       "&UserID=" + booking.CustomerID.ToString().Replace(" ", string.Empty) +
                                                       "'>" + booking.CustFullName.ToString() + "</a>";
                                        bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);
                                    }
                                    //if receptionist or manager customer and stylist
                                    else if (cookie["UT"].ToString()[0] == 'R' ||
                                             cookie["UT"].ToString()[0] == 'M')
                                    {
                                        //Customer
                                        newCell      = new TableCell();
                                        newCell.Text = "<a href='Profile.aspx?Action=View" +
                                                       "&UserID=" + booking.CustomerID.ToString().Replace(" ", string.Empty) +
                                                       "'>" + booking.CustFullName.ToString() + "</a>";
                                        bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);

                                        //Stylist
                                        newCell      = new TableCell();
                                        newCell.Text = "<a href='Profile.aspx?Action=View" +
                                                       "&empID=" + booking.stylistEmployeeID.ToString().Replace(" ", string.Empty) +
                                                       "'>" + booking.stylistFirstName.ToString() + "</a>";
                                        bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);
                                    }

                                    //BTN
                                    newCell      = new TableCell();
                                    newCell.Text = "<button type = 'button' class='btn btn-default'>" +
                                                   "<a href = '../ViewBooking.aspx?BookingID=" + booking.bookingID.ToString().Replace(" ", string.Empty) +
                                                   "&BookingType=Past'" +
                                                   ">View Booking</a></button>";
                                    bookingSearchResults.Rows[bookingCount].Cells.Add(newCell);
                                }
                            }
                        }
                    }
                    else
                    {
                        lCalBookingError.Text      = "Start date must be before end date";
                        lCalBookingError.ForeColor = System.Drawing.Color.Red;
                        lCalBookingError.Visible   = true;
                    }
                    updateBookingHeadings();
                }
            }
        }