public ourCustomerList SearchRecord(string updateitem, string itemdetail)
        {
            ourCustomerList searchresult = new ourCustomerList();
            SqlDataReader   sqlsearchresult;
            var             sqlsearchcustomer = "SELECT * FROM customer WHERE " + updateitem.ToLower() + " = @_Detail";

            try
            {
                using (var cmd = new SqlCommand(sqlsearchcustomer, conn))
                {
                    cmd.Parameters.AddWithValue("@_Detail", itemdetail);
                    sqlsearchresult = cmd.ExecuteReader();
                    if (sqlsearchresult.HasRows)
                    {
                        while (sqlsearchresult.Read())
                        {
                            DateTime    dt        = DateTime.Parse(sqlsearchresult[DOB].ToString());
                            ourCustomer acustomer = new ourCustomer(int.Parse(sqlsearchresult[CUSTOMERID].ToString()));
                            acustomer.FirstName     = sqlsearchresult[FRISTNAME].ToString();
                            acustomer.LastName      = sqlsearchresult[LASTNAME].ToString();
                            acustomer.Email         = sqlsearchresult[EMAIL].ToString();
                            acustomer.Website       = sqlsearchresult[WEBSITE].ToString();
                            acustomer.DOB           = dt.Day + "-" + dt.Month + "-" + dt.Year;
                            acustomer.LoyaltyMember = (sqlsearchresult[LOYALTYMEMBER].ToString().CompareTo("True") == 0) ? "true" : "false";
                            acustomer.Phone         = sqlsearchresult[PHONE].ToString();
                            acustomer.Mobile        = sqlsearchresult[MOBILE].ToString();
                            acustomer.Fax           = sqlsearchresult[FAX].ToString();
                            acustomer.MemberCard    = sqlsearchresult[MEMBERCARD].ToString();
                            //
                            searchresult.Addcustomer(acustomer);
                        }
                    }
                }
                if (searchresult != null)
                {
                    return(searchresult);
                }
                else
                {
                    throw new ApplicationException("[Error] Cannot retrieve the data!");
                }
            }
            catch
            {
                throw new ApplicationException("[Error] Cannot retrieve the SQL server!");
            }
        }
        public ourCustomerList RetrievalCustomerList(string sortItem, Boolean desc)
        {//SELECT * FROM CUSTOMER ORDER BY firstname DESC;
            ourCustomerList customerlist       = new ourCustomerList();
            string          storMode           = (desc == true) ? "DESC" : "ASC";
            var             sqlgetcustomerlist = "SELECT * FROM CUSTOMER ORDER BY " + sortItem + " " + storMode;
            SqlDataReader   customerreader;

            using (var cmd = new SqlCommand(sqlgetcustomerlist, conn))
            {
                customerreader = cmd.ExecuteReader();
                if (customerreader.HasRows)
                {
                    while (customerreader.Read())
                    {
                        DateTime    dt        = DateTime.Parse(customerreader[DOB].ToString());
                        ourCustomer acustomer = new ourCustomer(int.Parse(customerreader[CUSTOMERID].ToString()));
                        acustomer.FirstName     = customerreader[FRISTNAME].ToString();
                        acustomer.LastName      = customerreader[LASTNAME].ToString();
                        acustomer.Email         = customerreader[EMAIL].ToString();
                        acustomer.Website       = customerreader[WEBSITE].ToString();
                        acustomer.DOB           = dt.Day + "-" + dt.Month + "-" + dt.Year;
                        acustomer.LoyaltyMember = (customerreader[LOYALTYMEMBER].ToString().CompareTo("True") == 0) ? "true" : "false";
                        acustomer.Phone         = customerreader[PHONE].ToString();
                        acustomer.Mobile        = customerreader[MOBILE].ToString();
                        acustomer.Fax           = customerreader[FAX].ToString();
                        acustomer.MemberCard    = customerreader[MEMBERCARD].ToString();

                        customerlist.Addcustomer(acustomer);
                    }
                    return(customerlist);
                }
                else
                {
                    throw new ApplicationException("[Error] Cannot retrieve the data!");
                }
            }
        }