private void buttonLogin_Click(object sender, EventArgs e) { string hash = string.Empty; using (MD5 md5Hash = MD5.Create()) { hash = Util.GetMd5Hash(md5Hash, textBoxPassword.Text.Trim()); } UserProfile matchedProfile = (from c in dc.GetTable<UserProfile>() where c.userId == textBoxUserName.Text.Trim() && c.Password == hash select c).SingleOrDefault(); if (matchedProfile != null) { this.Hide(); LoggedClientProfile.UserProfileID = matchedProfile.UserProfileId; LoggedClientProfile.UserName = matchedProfile.userId; LoggedClientProfile.UserFullName = matchedProfile.FullName; LoggedClientProfile.IsManager = matchedProfile.IsManger; string machingCode = getMacAddress(); _registeredPC = (from c in dc.PcRegistrations where c.MachineCode == machingCode select c).SingleOrDefault<PcRegistration>(); if (_registeredPC == null) { frmRegisterPC frmPC = new frmRegisterPC(); frmPC.Show(); } else { LoggedClientProfile.UserPCID = _registeredPC.PcRegistrationID; LoggedClientProfile.UserPCName = _registeredPC.Description; LoggedClientProfile.LoginSuccess = true; frmMainManu frm = new frmMainManu(); frm.Show(); } } else { MessageBox.Show("Invalid User Name Or Password"); textBoxPassword.Focus(); textBoxPassword.SelectAll(); return; } }
private void LoadDefaults() { string machingCode = getMacAddress(); _registeredPC = (from c in dc.PcRegistrations where c.MachineCode == machingCode select c).SingleOrDefault<PcRegistration>(); if (_registeredPC == null) { _registeredPC = new PcRegistration(); } else { } }
partial void UpdatePcRegistration(PcRegistration instance);
partial void DeletePcRegistration(PcRegistration instance);
partial void InsertPcRegistration(PcRegistration instance);