示例#1
0
        public updateInfo(cHome cstHome, string newUserId)
        {
            InitializeComponent();
            this.cstHome   = cstHome;
            this.newUSerId = newUserId;

            using (ProjectDatabaseEntities db = new ProjectDatabaseEntities())
            {
                model         = db.Customers.Where(x => x.customerName == newUSerId).FirstOrDefault();
                nameShow.Text = model.customerName;
                phnShow.Text  = model.phoneNumber;
                addShow.Text  = model.address;
            }
        }
示例#2
0
        private void LogInStaffBtn_Click(object sender, EventArgs e)
        {
            ProjectDatabaseEntities cnn = new ProjectDatabaseEntities();
            List <Login>            emp = cnn.Logins.ToList();

            var data = (from a in emp where (a.userId.Equals(usernameTextbox.Text) && a.password.Equals(passwordTextbox.Text)) select a).FirstOrDefault();

            if (data != null)
            {
                this.Visible = false;
                MessageBox.Show("Valid!");

                if (data.status == 2)
                {
                    newUSerId            = usernameTextbox.Text;
                    usernameTextbox.Text = string.Empty;
                    passwordTextbox.Text = string.Empty;
                    sHome home = new sHome(this, newUSerId);
                    home.Visible = true;
                }
                else if (data.status == 1)
                {
                    newUSerId            = usernameTextbox.Text;
                    usernameTextbox.Text = string.Empty;
                    passwordTextbox.Text = string.Empty;
                    eHome home = new eHome(this, newUSerId);
                    home.Visible = true;
                }
                else if (data.status == 0)
                {
                    newUSerId            = usernameTextbox.Text;
                    usernameTextbox.Text = string.Empty;
                    passwordTextbox.Text = string.Empty;
                    cHome home = new cHome(this, newUSerId);
                    home.Visible = true;
                }
            }
            else
            {
                MessageBox.Show("invalid!");
            }
        }
 public buyItem(cHome ch)
 {
     InitializeComponent();
     this.ch = ch;
 }