예제 #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
        }
예제 #2
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
        }