private void SetApproval(string staffNo) { if (string.IsNullOrWhiteSpace(staffNo) == true) { p1ImageBox.Image = null; p1NameEdit.Text = ""; approveButton.Text = "Approve"; } else { staffSet.StaffNo = staffNo; staffSet.Select(); staffSet.Fetch(); if (staffSet.Signature != null) { p1ImageBox.Image = staffSet.Signature; p1NameEdit.Text = staffSet.FirstName + " " + staffSet.LastName; approveButton.Text = "Disapprove"; } else { approveButton.Text = "Approve"; } } }
private void DetailReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { DataSet set = (DataSource as BindingSource).DataSource as DataSet; string staffNo = Convert.ToString(set.Tables["P1"].Rows[0]["staffno"]); if (string.IsNullOrWhiteSpace(staffNo) == false) { staffSet.StaffNo = staffNo; staffSet.Select(); staffSet.Fetch(); if (staffSet.Signature != null) { signImageBox.ImageSource = new ImageSource(staffSet.Signature); signNameLabel.Text = staffSet.FirstName + " " + staffSet.LastName; } } }
private bool IsLogin() { for (int i = 0; i < 3; i++) { DialogLogin dialog = new DialogLogin(); dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { if (string.IsNullOrWhiteSpace(dialog.Passwd) == false) { staffSet.StaffNo = dialog.UserId; staffSet.Select(); staffSet.Fetch(); string passwd = staffSet.Passwd; //string passwd = Encoding.ASCII.GetString(Convert.FromBase64String(staffSet.Passwd)); if (dialog.Passwd == passwd) { AppRes.UserId = dialog.UserId; AppRes.Authority = staffSet.Authority; SetAuthority(); return(true); } } MessageBox.Show("Invalid password!\r\nPlease keyin password again!", AppRes.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { break; } } return(false); }