private void dgvOperatorList_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridView dgv = (DataGridView)sender; //Open EditOperator form if (dgv.Columns[e.ColumnIndex].Name == FindingsEditor.Properties.Resources.Edit) { if (!uckyFunctions.canEdit("operator", "operator_id", "LIKE", "'" + dgv.Rows[e.RowIndex].Cells[2].Value.ToString() + "'")) { MessageBox.Show(FindingsEditor.Properties.Resources.PermissionDenied, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EditOperator eo = new EditOperator(false, dgv.Rows[e.RowIndex].Cells[2].Value.ToString()); eo.ShowDialog(this); opList.Rows.Clear(); showOperatorList(); resizeColumns(); return; } //Delete operator if (dgv.Columns[e.ColumnIndex].Name == FindingsEditor.Properties.Resources.Delete) { examOperator examOp = new examOperator(dgv.Rows[e.RowIndex].Cells[2].Value.ToString(), false); switch (examOp.examCount()) { case -1: MessageBox.Show(FindingsEditor.Properties.Resources.DataBaseError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case 0: if (MessageBox.Show(FindingsEditor.Properties.Resources.ConfirmDel, "Information", MessageBoxButtons.YesNo) == DialogResult.Yes) { examOp.deleteExamOp(); opList.Rows.Clear(); showOperatorList(); resizeColumns(); break; } else { break; } default: MessageBox.Show(FindingsEditor.Properties.Resources.CouldntDelOp, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } } }
public EditOperator(Boolean _isNew, string _operator_id) { InitializeComponent(); //cbCategory initialization this.cbCategory.DataSource = CLocalDB.localDB.Tables["op_category"]; this.cbCategory.ValueMember = "opc_no"; this.cbCategory.DisplayMember = "opc_name"; //cbDepartment initialization this.cbDepartment.DataSource = CLocalDB.localDB.Tables["department"]; this.cbDepartment.ValueMember = "code"; this.cbDepartment.DisplayMember = "name1"; isNew = _isNew; if (isNew) { examOp = new examOperator(null, true); this.tbOperatorID.ReadOnly = false; this.cbCategory.SelectedIndex = -1; this.cbDepartment.SelectedIndex = -1; examOp.op_order = 9998; } else { examOp = new examOperator(_operator_id); this.tbOperatorID.Text = examOp.operator_id; this.tbOperatorID.ReadOnly = true; this.tbOperatorName.Text = examOp.op_name; this.cbCategory.SelectedValue = examOp.op_category; this.cbDepartment.SelectedValue = examOp.department; this.cbAllowFc.Checked = examOp.allow_fc; this.cbOperatorVisible.Checked = examOp.op_visible; this.cbAdminOp.Checked = examOp.admin_op; this.tbOperatorPw.Text = examOp.pw; this.tbConfirmPw.Text = examOp.pw; #region timer uckyFunctions.updateLockTimeIP("operator", "operator_id", "LIKE", "'" + examOp.operator_id + "'"); //Below timer procedure timer.Interval = 30000; //Unit is msec timer.Tick += new EventHandler(timer_Tick); timer.Start(); #endregion } }
private void btCopy2ClipBoard_Click(object sender, EventArgs e) { string str = ""; str = "<" + exam.getExamTypeName() + ">" + Environment.NewLine; int i = 0; foreach (DataGridViewRow dr in dgvDiagnoses.Rows) { i++; str += "#" + i.ToString() + ". " + dr.Cells["name"].Value.ToString() + Environment.NewLine; } str += tbFindings.Text.ToString() + Environment.NewLine; string op_id; examOperator temp_op; if (!string.IsNullOrWhiteSpace(cbDiagnosed.Text.ToString())) { op_id = cbDiagnosed.SelectedValue.ToString(); temp_op = new examOperator(op_id); string opNames = getOperatorNames(); if (temp_op.op_name != opNames) { str += "<" + Properties.Resources.Operators + ">" + opNames; } str += "<" + Properties.Resources.DiagnosedDr + ">" + temp_op.op_name + Environment.NewLine; } else { str += "<" + Properties.Resources.Operators + ">" + getOperatorNames(); } if (!string.IsNullOrWhiteSpace(tbComment.Text.ToString())) { str += Properties.Resources.Comment + ":" + Environment.NewLine + tbComment.Text.ToString() + Environment.NewLine; } if (!string.IsNullOrWhiteSpace(cbChecker.Text.ToString())) { op_id = cbChecker.SelectedValue.ToString(); temp_op = new examOperator(op_id); str += "<" + Properties.Resources.Checker + ">" + temp_op.op_name + Environment.NewLine; } Clipboard.SetDataObject(str); }
private string getOperatorNames() { string op_id; examOperator temp_op; string operatorNames = ""; if (!String.IsNullOrWhiteSpace(cbOperator1.Text.ToString())) { op_id = cbOperator1.SelectedValue.ToString(); temp_op = new examOperator(op_id); operatorNames += temp_op.op_name; } if (!String.IsNullOrWhiteSpace(cbOperator2.Text.ToString())) { if (!String.IsNullOrWhiteSpace(operatorNames)) { operatorNames += "/"; } op_id = cbOperator2.SelectedValue.ToString(); temp_op = new examOperator(op_id); operatorNames += temp_op.op_name; } if (!String.IsNullOrWhiteSpace(cbOperator3.Text.ToString())) { if (!String.IsNullOrWhiteSpace(operatorNames)) { operatorNames += "/"; } op_id = cbOperator3.SelectedValue.ToString(); temp_op = new examOperator(op_id); operatorNames += temp_op.op_name; } if (!String.IsNullOrWhiteSpace(cbOperator4.Text.ToString())) { if (!String.IsNullOrWhiteSpace(operatorNames)) { operatorNames += "/"; } op_id = cbOperator4.SelectedValue.ToString(); temp_op = new examOperator(op_id); operatorNames += temp_op.op_name; } if (!String.IsNullOrWhiteSpace(cbOperator5.Text.ToString())) { if (!String.IsNullOrWhiteSpace(operatorNames)) { operatorNames += "/"; } op_id = cbOperator5.SelectedValue.ToString(); temp_op = new examOperator(op_id); operatorNames += temp_op.op_name; } return operatorNames; }
private void dgvOperatorList_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridView dgv = (DataGridView)sender; //Open EditOperator form if (dgv.Columns[e.ColumnIndex].Name == Properties.Resources.Edit) { if (!uckyFunctions.canEdit("operator", "operator_id", "LIKE", "'" + dgv.Rows[e.RowIndex].Cells[2].Value.ToString() + "'")) { MessageBox.Show(Properties.Resources.PermissionDenied, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EditOperator eo = new EditOperator(false, dgv.Rows[e.RowIndex].Cells[2].Value.ToString()); eo.ShowDialog(this); opList.Rows.Clear(); showOperatorList(); resizeColumns(); return; } //Delete operator if (dgv.Columns[e.ColumnIndex].Name == Properties.Resources.Delete) { examOperator examOp = new examOperator(dgv.Rows[e.RowIndex].Cells[2].Value.ToString(), false); switch (examOp.examCount()) { case -1: MessageBox.Show(Properties.Resources.DataBaseError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case 0: if (MessageBox.Show(Properties.Resources.ConfirmDel, "Information", MessageBoxButtons.YesNo) == DialogResult.Yes) { examOp.deleteExamOp(); opList.Rows.Clear(); showOperatorList(); resizeColumns(); break; } else { break; } default: MessageBox.Show(Properties.Resources.CouldntDelOp, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } } }