private void btnshowuserinfo_Click(object sender, EventArgs e)
        {
            //if (!pnluserinfo.Controls.Contains(ucUserInfo.Instance1))
            //{
            //    pnluserinfo.Controls.Add(ucUserInfo.Instance1);
            //    ucUserInfo.Instance1.Dock = DockStyle.Fill;
            //    ucUserInfo.Instance1.BringToFront();
            //}
            //else
            //{
            //    ucUserInfo.Instance1.BringToFront();
            //}

            //check and show
            LoginInfo         log   = new LoginInfo();
            CustomerInfoLogic show  = new CustomerInfoLogic();
            custregTable      show2 = new custregTable();

            //show.ShowUserInfo(show2.username);
            show2            = show.ShowUserInfo("polin");
            txtusername.Text = show2.username;

            txtfirstName.Text = show2.firstname;
            txtLastname.Text  = show2.lastname;
            txtage.Text       = Convert.ToString(show2.age);
            txtPass.Text      = show2.password;
            txtEmail.Text     = show2.email;
            txtaddress.Text   = show2.address;
        }
        private void metroButton1_Click(object sender, EventArgs e)
        {
            CustomerInfoLogic confirm      = new CustomerInfoLogic();
            custregTable      CustregTable = new custregTable();

            if (!string.IsNullOrEmpty(txtUsername.Text) && !string.IsNullOrEmpty(txtFirstName.Text) &&
                !string.IsNullOrEmpty(txtLastName.Text) && !string.IsNullOrEmpty(txtLastName.Text) && !string.IsNullOrEmpty(txtPassword.Text) &&
                !string.IsNullOrEmpty(txtConfirmPass.Text) && !string.IsNullOrEmpty(txtEmail.Text) &&
                !string.IsNullOrEmpty(txtAddress.Text) && !string.IsNullOrEmpty(txtAge.Text) && !string.IsNullOrEmpty(txtPhoneNumber.Text))
            {
                var username    = txtUsername.Text.Trim();
                var firstname   = txtFirstName.Text.Trim();
                var lastname    = txtLastName.Text.Trim();
                var password    = txtPassword.Text.Trim();
                var Confirmpass = txtConfirmPass.Text.Trim();
                var email       = txtEmail.Text.Trim();
                var address     = txtAddress.Text.Trim();
                var age         = txtAge.Text.Trim();
                var phonenum    = txtPhoneNumber.Text.Trim();

                CustregTable.firstname       = firstname;
                CustregTable.lastname        = lastname;
                CustregTable.username        = username;
                CustregTable.password        = password;
                CustregTable.confirmpassword = Confirmpass;
                if (password == Confirmpass)
                {
                    CustregTable.email       = email;
                    CustregTable.address     = address;
                    CustregTable.age         = Convert.ToInt32(age);
                    CustregTable.phonenumber = Convert.ToInt32(phonenum);

                    confirm.AddCustomer(CustregTable);

                    MetroMessageBox.Show(this, "Saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MetroMessageBox.Show(this, "Ooops!!!Password Missmatch!!Please Re-Check your Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            else
            {
                MetroMessageBox.Show(this, "You Need To FillUp All Field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        protected void txtCustomerCode_TextChanged(object sender, EventArgs e)
        {
            var code = txtCustomerCode.Text.Trim();

            lblCustomerNameError.Text = "";
            txtCustomerID.Value       = "";
            lblCustomerName.Text      = "";
            if (!string.IsNullOrEmpty(code))
            {
                var customer = CustomerInfoLogic.GetCustomerInfoByCode(code);
                if (customer != null)
                {
                    lblCustomerName.Text = customer.CompanyName.Replace(code + " ", "");
                    txtCustomerID.Value  = customer.PKID.ToString();
                }
                else
                {
                    lblCustomerNameError.Text = "²»´æÔڸñàºÅ";
                    txtCustomerID.Value       = "";
                    lblCustomerName.Text      = "";
                }
            }
            btnCustomerCodeChange(sender, e);
        }