コード例 #1
0
ファイル: CustomerVM.cs プロジェクト: tieptv/EntityProject
        /*   public ObservableCollection<CUSTOMER> UpdateListview()
         * {
         *     List<EMPLOYEE> listp = CustomerDao.Instance().getAll();
         *
         *     ObservableCollection<CUSTOMER> result = new ObservableCollection<CUSTOMER>();
         *     foreach (EMPLOYEE p in listp)
         *     {
         *         CUSTOMER pv = new CUSTOMER(p);
         *         result.Add(pv);
         *     }
         *     return result;
         *
         * }
         */
        private void SelectedItem(CUSTOMER p)
        {
            ResetView();
            OFFICER    of  = OfficerDao.Instance().SelectbyCustId(p.CUST_ID);
            BUSINESS   bu  = BusinessDao.Instance().SelectbyId(p.CUST_ID);
            INDIVIDUAL ind = IndividualDao.Instance().SelectbyId(p.CUST_ID);

            if (ind != null)
            {
                In_lastname  = ind.LAST_NAME;
                In_firstname = ind.FIRST_NAME;
                In_birthdate = ind.BIRTH_DATE.ToString();
            }
            if (of != null)
            {
                Of_lastname  = of.LAST_NAME;
                Of_firstname = of.FIRST_NAME;
                Of_title     = of.TITLE;
                Of_startdate = of.START_DATE.ToString();
                Of_enddate   = of.END_DATE.ToString();
            }
            if (bu != null)
            {
                Bu_name       = bu.NAME;
                Bu_stateid    = bu.STATE_ID;
                Bu_incorpdate = bu.INCORP_DATE.ToString();
            }
        }
コード例 #2
0
ファイル: CustomerVM.cs プロジェクト: tieptv/EntityProject
        private void Find(FrameworkElement p)
        {
            string id = "";

            if (p != null)
            {
                var fe = p as Grid;
                if (fe != null)
                {
                    foreach (var item in fe.Children)
                    {
                        var tx = item as TextBox;
                        if (tx != null)
                        {
                            if (tx.Name.Equals("txtSearch"))
                            {
                                id = tx.Text;
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(id))
            {
                String key = id.ToLower();
                ObservableCollection <CUSTOMER> result = new ObservableCollection <CUSTOMER>();
                foreach (CUSTOMER c in CustomerLists)
                {
                    OFFICER    of   = OfficerDao.Instance().SelectbyCustId(c.CUST_ID);
                    BUSINESS   bu   = BusinessDao.Instance().SelectbyId(c.CUST_ID);
                    INDIVIDUAL ind  = IndividualDao.Instance().SelectbyId(c.CUST_ID);
                    String     temp = c.CUST_ID.ToString() + " " + c.ADDRESS + " " + c.CITY + " " + c.FED_ID + " " + c.POSTAL_CODE + " " + c.STATE + " ";
                    if (of != null && bu != null)
                    {
                        temp +=
                            of.FIRST_NAME + " " + of.LAST_NAME + " " + of.OFFICER_ID + " " + of.TITLE + " " + of.START_DATE.ToString() + " " + of.END_DATE.ToString() + " " +
                            bu.NAME + "  " + bu.STATE_ID + " " + bu.INCORP_DATE.ToString() + " ";
                    }
                    if (ind != null)
                    {
                        temp += ind.LAST_NAME + " " + ind.FIRST_NAME + " " + ind.BIRTH_DATE.ToString();
                    }
                    temp.ToLower();
                    if (temp.Contains(key))
                    {
                        result.Add(c);
                    }
                }
                CustomerLists = result;
            }
            else
            {
                CustomerLists = new ObservableCollection <CUSTOMER>(CustomerDao.Instance().getAll());
            }
        }
コード例 #3
0
        public static List <BUSINESS> getLista()
        {
            string sql = "select * from business";

            DataTable dt = ConexionBD.ExecuteQuery(sql);

            List <BUSINESS> lista = new List <BUSINESS>();

            foreach (DataRow fila in dt.Rows)
            {
                BUSINESS u = new BUSINESS();
                u.idBussiness = Convert.ToInt32(fila[0].ToString());
                u.name        = fila[1].ToString();
                u.description = fila[2].ToString();

                lista.Add(u);
            }
            return(lista);
        }
コード例 #4
0
        private void OKevent(Window p)
        {
            if (validate_customer() == true)
            {
                CUSTOMER cus = new CUSTOMER();
                cus.ADDRESS      = Cus_address;
                cus.CITY         = Cus_city;
                cus.CUST_TYPE_CD = Cus_custype;
                cus.FED_ID       = Cus_fedid;
                cus.POSTAL_CODE  = Cus_postalcode;
                cus.STATE        = Cus_state;
                if (cv == "insert")
                {
                    CustomerDao.Instance().Insert(cus);
                    off = new OFFICER();
                    ind = new INDIVIDUAL();
                    bus = new BUSINESS();
                    int last_cus = CustomerDao.Instance().LastCUST().CUST_ID;
                    off.CUST_ID = last_cus;
                    ind.CUST_ID = last_cus;
                    bus.CUST_ID = last_cus;
                    if (Cus_custype == "I")
                    {
                        if (validate_individual() == true)
                        {
                            if (In_birthdate.Equals(""))
                            {
                                ind.BIRTH_DATE = null;
                            }
                            else
                            {
                                ind.BIRTH_DATE = Convert.ToDateTime(In_birthdate);
                            }
                            ind.FIRST_NAME = In_firstname;
                            ind.LAST_NAME  = In_lastname;

                            IndividualDao.Instance().Insert(ind);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Individual!", "Thông báo");
                        }
                    }
                    else
                    {
                        if (validate_officer() == true && validate_business() == true)
                        {
                            bus.NAME     = Bu_name;
                            bus.STATE_ID = Bu_stateid;
                            if (Bu_incorpdate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                bus.INCORP_DATE = Convert.ToDateTime(Bu_incorpdate);
                            }
                            off.LAST_NAME  = Of_lastname;
                            off.FIRST_NAME = Of_firstname;
                            off.TITLE      = Of_title;
                            off.START_DATE = Convert.ToDateTime(Of_startdate);
                            if (Of_enddate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                off.END_DATE = Convert.ToDateTime(Of_enddate);
                            }

                            OfficerDao.Instance().Insert(off);
                            BusinessDao.Instance().Insert(bus);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Officer và Business!", "Thông báo");
                        }
                    }
                }
                else
                {
                    cus.CUST_ID = custid;
                    if (Cus_custype == "I")
                    {
                        if (validate_individual() == true)
                        {
                            if (In_birthdate.Equals(""))
                            {
                                ind.BIRTH_DATE = null;
                            }
                            else
                            {
                                ind.BIRTH_DATE = Convert.ToDateTime(In_birthdate);
                            }
                            ind.FIRST_NAME = In_firstname;
                            ind.LAST_NAME  = In_lastname;
                            CustomerDao.Instance().Update(cus);
                            IndividualDao.Instance().Update(ind);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Individual!", "Thông báo");
                        }
                    }
                    else
                    {
                        if (validate_officer() == true && validate_business() == true)
                        {
                            bus.NAME     = Bu_name;
                            bus.STATE_ID = Bu_stateid;
                            if (Bu_incorpdate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                bus.INCORP_DATE = Convert.ToDateTime(Bu_incorpdate);
                            }
                            off.LAST_NAME  = Of_lastname;
                            off.FIRST_NAME = Of_firstname;
                            off.TITLE      = Of_title;
                            off.START_DATE = Convert.ToDateTime(Of_startdate);
                            if (Of_enddate.Equals(""))
                            {
                                bus.INCORP_DATE = null;
                            }
                            else
                            {
                                off.END_DATE = Convert.ToDateTime(Of_enddate);
                            }
                            CustomerDao.Instance().Update(cus);
                            OfficerDao.Instance().Update(off);
                            BusinessDao.Instance().Update(bus);
                        }
                        else
                        {
                            MessageBox.Show("Bạn điền thiếu thông tin Officer và Business!", "Thông báo");
                        }
                    }
                }
                p.Close();
                vm.CustomerLists = new ObservableCollection <CUSTOMER>(CustomerDao.Instance().getAll());
            }
            else
            {
                MessageBox.Show("Customer:Bạn điền thiếu thông tin!", "Thông báo");
            }
        }
コード例 #5
0
        public CustomerEditVM(CUSTOMER c, CustomerVM vm)
        {
            if (c == null)
            {
                this.In_firstname = "";
                this.In_lastname  = "";
                this.In_birthdate = "";

                this.Bu_name       = "";
                this.Bu_stateid    = "";
                this.Bu_incorpdate = "";

                this.Of_enddate   = "";
                this.Of_firstname = "";
                this.Of_startdate = "";
                this.Of_title     = "";
                this.Of_lastname  = "";

                this.Cus_address    = "";
                this.Cus_city       = "";
                this.Cus_custype    = "";
                this.Cus_postalcode = "";
                this.Cus_fedid      = "";
                this.Cus_state      = "";
                this.cv             = "insert";
            }
            else
            {
                ind = IndividualDao.Instance().SelectbyId(c.CUST_ID);
                bus = BusinessDao.Instance().SelectbyId(c.CUST_ID);
                off = OfficerDao.Instance().SelectbyCustId(c.CUST_ID);
                if (ind != null)
                {
                    In_lastname  = ind.LAST_NAME;
                    In_firstname = ind.FIRST_NAME;
                    In_birthdate = ind.BIRTH_DATE.ToString();
                }
                if (off != null && bus != null)
                {
                    Of_lastname   = off.LAST_NAME;
                    Of_firstname  = off.FIRST_NAME;
                    Of_title      = off.TITLE;
                    Of_startdate  = off.START_DATE.ToString();
                    Of_enddate    = off.END_DATE.ToString();
                    Bu_name       = bus.NAME;
                    Bu_stateid    = bus.STATE_ID;
                    Bu_incorpdate = bus.INCORP_DATE.ToString();
                }

                this.Cus_address    = c.ADDRESS;
                this.Cus_city       = c.CITY;
                this.Cus_custype    = c.CUST_TYPE_CD;
                this.Cus_postalcode = c.POSTAL_CODE;
                this.Cus_fedid      = c.FED_ID;
                this.Cus_state      = c.STATE;
                this.cv             = "update";
                this.custid         = c.CUST_ID;
            }
            this.vm       = vm;
            OKCommand     = new RelayCommand <Window>((p) => { return(p != null ? true : false); }, (p) => { OKevent(p); });
            CancelCommand = new RelayCommand <Window>((p) => true, (p) => { p.Close(); });
        }
コード例 #6
0
        private void loadInvoice()
        {
            //display the invoice
            int rowCount = 0;

            //get the details from the db
            try
            {
                //get booking deatils
                SP_GetCustomerBooking BookingDetails = handler.getCustomerPastBookingDetails(SaleID);
                SALE invoice = handler.getSale(SaleID);
                List <SP_getInvoiceDL> invoicDetailLines = handler.getInvoiceDL(SaleID);

                if (invoicDetailLines.Count != 0)
                {
                    #region Company Details / Invoice Date
                    //diaplay a heading
                    TableRow newRow = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);
                    TableCell newCell = new TableCell();
                    newCell.Font.Bold = true;
                    newCell.Font.Bold = true;
                    newCell.Text      = "<a class='navbar-brand js-scroll-trigger' href='#' onClick='window.print()'>Cheveux </a>";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    #region EmptyCells
                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    #endregion
                    newCell           = new TableCell();
                    newCell.Font.Bold = true;
                    newCell.Text      = "Invoice";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    #region Break Line
                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);
                    newCell      = new TableCell();
                    newCell.Text = "<br/>";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    newCell      = new TableCell();
                    newCell.Text = "<br/>";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //increment row count
                    rowCount++;
                    #endregion

                    //from address
                    BUSINESS bUSINESS = handler.getBusinessTable();
                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);
                    newCell      = new TableCell();
                    newCell.Text = bUSINESS.AddressLine1 + "<br/>" + bUSINESS.AddressLine2;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    #region EmptyCells
                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    #endregion

                    #region  date
                    newCell = new TableCell();

                    newCell.Text = invoice.Date.ToString("HH:mm dd MMM yyyy");
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    #endregion

                    //increment row count
                    rowCount++;
                    #endregion

                    #region Billed To
                    //Billed to
                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);
                    newCell           = new TableCell();
                    newCell.Font.Bold = true;
                    newCell.Text      = "Billed To:";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    newCell      = new TableCell();
                    newCell.Text = handler.GetUserDetails(invoice.CustID).FirstName.ToString() + " " +
                                   handler.GetUserDetails(invoice.CustID).LastName.ToString();
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //increment row count
                    rowCount++;
                    #endregion

                    #region Stylist
                    if (BookingDetails != null)
                    {
                        newRow        = new TableRow();
                        newRow.Height = 50;
                        tblInvoice.Rows.Add(newRow);
                        newCell           = new TableCell();
                        newCell.Font.Bold = true;
                        newCell.Text      = "Services Renderd By:";
                        tblInvoice.Rows[rowCount].Cells.Add(newCell);
                        newCell      = new TableCell();
                        newCell.Text = BookingDetails.stylistFirstName;
                        tblInvoice.Rows[rowCount].Cells.Add(newCell);

                        //increment row count
                        rowCount++;
                    }
                    #endregion

                    //calculate total price
                    double total = 0.0;

                    #region Items
                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);

                    #region header
                    //fill in the item
                    newCell           = new TableCell();
                    newCell.Text      = "Item";
                    newCell.Font.Bold = true;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    newCell           = new TableCell();
                    newCell.Text      = "Qty";
                    newCell.Font.Bold = true;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    newCell                 = new TableCell();
                    newCell.Text            = "Unit Price";
                    newCell.Font.Bold       = true;
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //fill in the Qty, unit price & TotalPrice
                    newCell                 = new TableCell();
                    newCell.Text            = "Total";
                    newCell.Font.Bold       = true;
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //increment row count
                    rowCount++;
                    #endregion

                    foreach (SP_getInvoiceDL item in invoicDetailLines)
                    {
                        newRow        = new TableRow();
                        newRow.Height = 50;
                        tblInvoice.Rows.Add(newRow);

                        //fill in the item
                        newCell      = new TableCell();
                        newCell.Text = item.itemName.ToString();
                        tblInvoice.Rows[rowCount].Cells.Add(newCell);

                        newCell      = new TableCell();
                        newCell.Text = item.Qty.ToString();
                        tblInvoice.Rows[rowCount].Cells.Add(newCell);

                        newCell = new TableCell();
                        newCell.HorizontalAlign = HorizontalAlign.Right;
                        newCell.Text            = "R" + string.Format("{0:#.00}", item.price);
                        tblInvoice.Rows[rowCount].Cells.Add(newCell);

                        //fill in the Qty, unit price & TotalPrice
                        newCell = new TableCell();
                        newCell.HorizontalAlign = HorizontalAlign.Right;
                        newCell.Text            = "R" + string.Format("{0:#.00}", item.Qty * item.price);
                        tblInvoice.Rows[rowCount].Cells.Add(newCell);

                        //increment final price
                        total += item.Qty * item.price;

                        //increment row count
                        rowCount++;
                    }
                    #endregion

                    #region Excluding Vat Info
                    // get vat info
                    Tuple <double, double> vatInfo = function.getVat(total);

                    //display total including and Excluding VAT
                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);

                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    newCell = new TableCell();
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    newCell.Text            = "<br/> Excluding VAT: &nbsp; ";
                    newCell.Font.Bold       = true;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    //fill in total ExcludingVAT
                    newCell = new TableCell();
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    newCell.Text            = " <br/> R " + string.Format("{0:#.00}", vatInfo.Item1, 2);
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //increment row count
                    rowCount++;
                    #endregion

                    #region VAT RAte
                    //get the vat rate
                    double VATRate = -1;
                    try
                    {
                        VATRate = handler.GetVATRate().VATRate;
                    }
                    catch (Exception Err)
                    {
                        function.logAnError(Err.ToString());
                    }

                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);

                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //fill in total VAT due
                    newCell = new TableCell();
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    newCell.Text            = "VAT @" + VATRate + "% &nbsp; ";
                    newCell.Font.Bold       = true;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    newCell = new TableCell();
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    newCell.Text            = "R " + string.Format("{0:#.00}", vatInfo.Item2, 2).ToString();
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //increment row count
                    rowCount++;
                    #endregion

                    #region Total
                    //display the total due
                    newRow        = new TableRow();
                    newRow.Height = 50;
                    tblInvoice.Rows.Add(newRow);

                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    newCell      = new TableCell();
                    newCell.Text = "";
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);

                    //fill in total
                    newCell = new TableCell();
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    newCell.Text            = "<br/> Total Due: &nbsp; ";
                    newCell.Font.Bold       = true;
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    newCell = new TableCell();
                    newCell.HorizontalAlign = HorizontalAlign.Right;
                    newCell.Text            = "<br/> R " + string.Format("{0:#.00}", total).ToString();
                    tblInvoice.Rows[rowCount].Cells.Add(newCell);
                    #endregion
                }
                else
                {
                    function.logAnError("Error Loading Print Invoice ");
                    Response.Redirect("Error.aspx?Error='An Error Occured Communicating With The Data Base, Try Again Later'");
                }
            }
            catch (Exception Err)
            {
                function.logAnError("Error Loading Print Invoice | Error: " + Err.ToString());
                Response.Redirect("Error.aspx?Error='An Error Occured Communicating With The Data Base, Try Again Later'");
            }
        }
コード例 #7
0
 public MaskedInvalidaException(BUSINESS.UTIL.TipoMasked TipoMasked)
 {
     _mensagem = "Campo " + TipoMasked.ToString() + " incompleto!";
 }
コード例 #8
0
        private void loadHomePage()
        {
            #region Redirect
            //rediret to product page or stylist profile with product id
            //check if a redirect has been requested
            String goTo = Request.QueryString["Goto"];
            if (goTo != null)
            {
                features = null;
                try
                {
                    //get the home page featurs
                    features = handler.GetHomePageFeatures();
                }
                catch (Exception err)
                {
                    function.logAnError("unable to load featurd items from the DB on default.aspx for redirect: " +
                                        err);
                }

                if (goTo == "Prod1")
                {
                    if (features == null)
                    {
                        Response.Redirect("/Cheveux/Products.aspx");
                    }
                    else
                    {
                        Response.Redirect("/Cheveux/Products.aspx?ProductID=" + features[0].ItemID.ToString());
                    }
                }
                else if (goTo == "Prod2")
                {
                    if (features == null)
                    {
                        Response.Redirect("/Cheveux/Products.aspx");
                    }
                    else
                    {
                        Response.Redirect("/Cheveux/Products.aspx?ProductID=" + features[1].ItemID.ToString());
                    }
                }
                else if (goTo == "Prod3")
                {
                    if (features == null)
                    {
                        Response.Redirect("/Cheveux/Products.aspx");
                    }
                    else
                    {
                        Response.Redirect("/Cheveux/Products.aspx?ProductID=" + features[2].ItemID.ToString());
                    }
                }
                else if (goTo == "Sty1")
                {
                    if (features == null)
                    {
                        Response.Redirect("/Cheveux/Stylists.aspx");
                    }
                    else
                    {
                        Response.Redirect("Profile.aspx?Action=View&empID=" + features[7].ItemID.ToString());
                    }
                }
                else if (goTo == "Sty2")
                {
                    if (features == null)
                    {
                        Response.Redirect("/Cheveux/Stylists.aspx");
                    }
                    else
                    {
                        Response.Redirect("Profile.aspx?Action=View&empID=" + features[8].ItemID.ToString());
                    }
                }
                else if (goTo == "Sty3")
                {
                    if (features == null)
                    {
                        Response.Redirect("/Cheveux/Stylists.aspx");
                    }
                    else
                    {
                        Response.Redirect("Profile.aspx?Action=View&empID=" + features[9].ItemID.ToString());
                    }
                }
                else if (goTo == "Phone")
                {
                    if (features == null)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('Error.aspx','_newtab');", true);
                        Response.Redirect("Error.aspx");
                    }
                    else
                    {
                        Response.Redirect("tel:" + features[10].contactNo.ToString());
                    }
                }
                else if (goTo == "Email")
                {
                    if (features == null)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('Error.aspx','_newtab');", true);
                        Response.Redirect("Error.aspx");
                    }
                    else
                    {
                        Response.Redirect("mailto:" + features[11].email.ToString());
                    }
                }
            }

            #endregion

            #region access control
            HttpCookie UserID = Request.Cookies["CheveuxUserID"];
            //send the user to the correct page based on their usertype
            if (UserID != null)
            {
                string userType = UserID["UT"].ToString();
                if ("R" == userType)
                {
                    //Receptionist
                    Response.Redirect("/Receptionist/Receptionist.aspx");
                }
                else if (userType == "M")
                {
                    //Manager
                    Response.Redirect("/Manager/Dashboard.aspx");
                }
                else if (userType == "S")
                {
                    //stylist
                    Response.Redirect("/Stylist/Stylist.aspx");
                }
                else if (userType == "C")
                {
                    //customer
                    //allowed access to this page
                    //Response.Redirect("Default.aspx");
                }
                else
                {
                    function.logAnError("Unknown user type found during Loading of default.aspx: " +
                                        UserID["UT"].ToString());
                }
            }
            #endregion

            #region Home Page Info
            //load home page info
            #region Welcom Back
            //welcome back existing users
            string name = Request.QueryString["WB"];
            if (name != null)
            {
                Welcome.Text = "Welcome Back To Cheveux " + name;
            }
            else
            {
                //welcome new customers
                name = Request.QueryString["NU"];
                if (name != null)
                {
                    Welcome.Text = "Congratulations " + name
                                   + "  You Are Now Registered With Cheveux";
                }
            }
            #endregion

            #region booking Confirimation
            //confirm booking
            string   stylistID = Request.QueryString["Sty"];
            string   Date      = Request.QueryString["D"];
            string   slotNo    = Request.QueryString["T"];
            DateTime Time      = Convert.ToDateTime("2001/01/01");

            try
            {
                if (stylistID != null &&
                    Date != null &&
                    slotNo != null)
                {
                    List <SP_GetSlotTimes> TSL = handler.BLL_GetAllTimeSlots();
                    foreach (SP_GetSlotTimes TS in TSL)
                    {
                        if (TS.SlotNo.Replace(" ", string.Empty) == slotNo.Replace(" ", string.Empty))
                        {
                            Time = TS.Time;
                        }
                    }
                    Welcome.Text = "You are now booked to see "
                                   + handler.viewEmployee(stylistID.Replace(" ", string.Empty)).firstName
                                   + " at " + Time.ToString("HH:mm")
                                   + " on the " + Convert.ToDateTime(Date).ToString("dd MMM yyyy");
                }
            }
            catch (Exception err)
            {
                function.logAnError("unable to load booking confirmaton on default.aspx." +
                                    "stylist ID : " + stylistID +
                                    " | Date : " + Date +
                                    " | Slot No. : " + slotNo +
                                    " | Time : " + Time +
                                    " | CustID : " + UserID["ID"].ToString() +
                                    " | Error : " + err);
            }
            #endregion

            #region Home Page Features
            features = null;
            try
            {
                //get the home page featurs
                features = handler.GetHomePageFeatures();
            }
            catch (Exception err)
            {
                function.logAnError("unable to load featurd items from the DB on default.aspx: " +
                                    err);
            }

            #region Featured hairstyles
            try
            {
                LService1Header.Text = "<a class='btn btn-light' href='cheveux/services.aspx?ProductID=" +
                                       features[3].ItemID.ToString()
                                       + "'>" + features[3].Name.ToString() + "</a></font>";
                LService1Description.Text = features[3].description.ToString()
                                            + " from R" + features[3].price.ToString();

                LService2Header.Text = "<a class='btn btn-light' href='cheveux/services.aspx?ProductID=" +
                                       features[4].ItemID.ToString()
                                       + "'>" + features[4].Name.ToString() + "</a></font>";
                LService2Description.Text = features[4].description.ToString()
                                            + " from R" + features[4].price.ToString();

                LService3Header.Text = "<a class='btn btn-light' href='cheveux/services.aspx?ProductID=" +
                                       features[5].ItemID.ToString()
                                       + "'>" + features[5].Name.ToString() + "</a></font>";
                LService3Description.Text = features[5].description.ToString()
                                            + " from R" + features[5].price.ToString();

                LService4Header.Text = "<a class='btn btn-light' href='cheveux/services.aspx?ProductID=" +
                                       features[6].ItemID.ToString()
                                       + "'>" + features[6].Name.ToString() + "</a>";
                LService4Description.Text = features[6].description.ToString()
                                            + " from R" + features[6].price.ToString();
            }
            catch (Exception err)
            {
                function.logAnError("unable to display featured hairstyls on default.aspx: " +
                                    err);
            }
            #endregion

            #region Featured Products
            //Load Products
            try
            {
                phProductImage1.Controls.Add(new LiteralControl
                                                 ("<img width='650' height='650' src='http://sict-iis.nmmu.ac.za/beauxdebut/Theam/img/" + features[0].ItemID + ".jpg'/>"));
                lProductHeader1.Text      = features[0].Name.ToString();
                LProductDescription1.Text = features[0].description.ToString()
                                            + " from R" + features[0].price.ToString();

                phProductImage2.Controls.Add(new LiteralControl
                                                 ("<img width='650' height='650' src='http://sict-iis.nmmu.ac.za/beauxdebut/Theam/img/" + features[1].ItemID + ".jpg'/>"));
                lProductHeader2.Text      = features[1].Name.ToString();
                LProductDescription2.Text = features[1].description.ToString()
                                            + " from R" + features[1].price.ToString();

                phProductImage3.Controls.Add(new LiteralControl
                                                 ("<img width='650' height='650' src='http://sict-iis.nmmu.ac.za/beauxdebut/Theam/img/" + features[2].ItemID + ".jpg'/>"));
                lProductHeader3.Text      = features[2].Name.ToString();
                LProductDescription3.Text = features[2].description.ToString()
                                            + " from R" + features[2].price.ToString();
            }
            catch (Exception err)
            {
                function.logAnError("unable to display featured products on default.aspx: " +
                                    err);
            }
            #endregion

            #region Featured Stylists
            //Load Products
            try
            {
                phStylistImage1.Controls.Add(new LiteralControl
                                                 ("<img width='650' height='650' src='http://sict-iis.nmmu.ac.za/beauxdebut/Theam/img/" + features[4].ItemID + ".jpg'/>"));
                lStylistHeader1.Text      = features[7].firstName.ToString();
                lStylistDescription1.Text = "Specializes in "
                                            + handler.viewStylistSpecialisationAndBio(features[7].ItemID.ToString()).serviceName;

                phStylistImage2.Controls.Add(new LiteralControl
                                                 ("<img width='650' height='650' src='http://sict-iis.nmmu.ac.za/beauxdebut/Theam/img/" + features[8].ItemID + ".jpg'/>"));
                lStylistHeader2.Text      = features[8].firstName.ToString();
                lStylistDescription2.Text = "Specializes in "
                                            + handler.viewStylistSpecialisationAndBio(features[8].ItemID.ToString()).serviceName;

                phStylistImage3.Controls.Add(new LiteralControl
                                                 ("<img width='650' height='650' src='http://sict-iis.nmmu.ac.za/beauxdebut/Theam/img/" + features[9].ItemID + ".jpg'/>"));
                lStylistHeader3.Text      = features[9].firstName.ToString();
                lStylistDescription3.Text = "Specializes in "
                                            + handler.viewStylistSpecialisationAndBio(features[9].ItemID.ToString()).serviceName;
            }
            catch (Exception err)
            {
                function.logAnError("unable to display featured stylist on default.aspx: " +
                                    err);
            }
            #endregion

            #region Operating Hours
            try
            {
                //get the operating hourse from the db
                BUSINESS operatingHours = handler.getBusinessTable();
                //display the opperating hours

                //add hours - weekday
                lWeekdaye.Text = operatingHours.WeekdayStart.ToString("HH:mm") + " - " + operatingHours.WeekdayEnd.ToString("HH:mm");

                //add hours - weekend
                lWeekend.Text = operatingHours.WeekendStart.ToString("HH:mm") + " - " + operatingHours.WeekendEnd.ToString("HH:mm");

                //add hours - public holiday
                lPublicHol.Text = operatingHours.PublicHolStart.ToString("HH:mm") + " - " + operatingHours.PublicHolEnd.ToString("HH:mm");
            }
            catch (Exception err)
            {
                function.logAnError("unable to load operating hours on default.aspx: " +
                                    err);
            }
            #endregion
            #endregion
            #endregion
        }