private void btnEdit_Click(object sender, EventArgs e) { if (dgvUserDetail.RowCount != 0) { int userId = (int)(dgvUserDetail.SelectedRows[0].Cells[0].Value); UserDialog dlgUser = new UserDialog(); UserBO objUserBO = new UserBO(); UserData objUserData = new UserData(); dlgUser.UserName = (dgvUserDetail.SelectedRows[0].Cells[1].Value).ToString(); dlgUser.Password = (dgvUserDetail.SelectedRows[0].Cells[2].Value).ToString(); dlgUser.FirstName = (dgvUserDetail.SelectedRows[0].Cells[3].Value).ToString(); dlgUser.LastName = (dgvUserDetail.SelectedRows[0].Cells[4].Value).ToString(); dlgUser.EmailId = (dgvUserDetail.SelectedRows[0].Cells[5].Value).ToString(); dlgUser.PhoneNo = (dgvUserDetail.SelectedRows[0].Cells[6].Value).ToString(); dlgUser.IsActive = (bool)(dgvUserDetail.SelectedRows[0].Cells[7].Value); if (dlgUser.ShowDialog() == DialogResult.OK) { objUserData.UserId = userId; objUserData.FirstName = dlgUser.FirstName; objUserData.LastName = dlgUser.LastName; objUserData.EmailId = dlgUser.EmailId; objUserData.PhoneNo = dlgUser.PhoneNo; objUserData.Password = dlgUser.Password; objUserData.IsActive = dlgUser.IsActive; objUserBO.UpdateInUser(objUserData); } dgvUserDetail.DataSource = UserBO.GetUser(); } }
private void btnAdd_Click(object sender, EventArgs e) { if (userDialog.ShowDialog() == DialogResult.OK) { try { user.UserName = userDialog.UserName; user.Password = userDialog.Password; user.FirstName = userDialog.FirstName; user.LastName = userDialog.LastName; user.EmailId = userDialog.EmailId; user.PhoneNo = userDialog.PhoneNo; user.IsActive = userDialog.IsActive; Interaction.AddData(user, 3); } catch (Exception) { MessageBox.Show("check the add in the user"); } } dgvUser.DataSource = Interaction.Getdetails(3); }
private void lkRegister_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { UserDialog dlguser = new UserDialog(); if (dlguser.ShowDialog() == DialogResult.OK) { if (UserBO.IsUserExist(dlguser.UserName)) { UserBO objUserBO = new UserBO(); objUserBO.InsertInUser(dlguser.UserName, dlguser.Password, dlguser.FirstName, dlguser.LastName, dlguser.EmailId, dlguser.PhoneNo, dlguser.IsActive); MessageBox.Show("Ok you are in our system"); } else { MessageBox.Show("Someone already exist with this Name.\nSorry try again"); } } }
private void btnAdd_Click(object sender, EventArgs e) { UserDialog dlgUser = new UserDialog(); if (dlgUser.ShowDialog() == DialogResult.OK) { try { UserBO objUserBO = new UserBO(); objUserBO.InsertInUser(dlgUser.UserName, dlgUser.Password, dlgUser.FirstName, dlgUser.LastName, dlgUser.EmailId, dlgUser.PhoneNo, dlgUser.IsActive); dgvUserDetail.DataSource = UserBO.GetUser(); } catch (Exception) { MessageBox.Show("you are in test 2 user form"); } } }
private void lkRegister_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { UserDialog dialog = new UserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { if (interaction.UniqueUser(dialog.UserName) == false) { detail.UserName = dialog.UserName; detail.Password = dialog.Password; detail.FirstName = dialog.FirstName; detail.LastName = dialog.LastName; detail.EmailId = dialog.EmailId; detail.PhoneNo = dialog.PhoneNo; detail.IsActive = dialog.IsActive; interaction.AddData(detail, 3); } else { MessageBox.Show("Fool you are already in the system.\nGo and "); } } }
private void SearchOnDialog() { try { switch (SearchType) { case eSearchType.None: break; case eSearchType.User: #region User using (UserDialog dlgu = new UserDialog(null)) { if (dlgu.RowCount == 1) { this.selectedrow = dlgu.SelectedData; this.StringValue = dlgu.SelectedData.ID; } else if (dlgu.RowCount > 1) { if (dlgu.ShowDialog(this) == DialogResult.OK) { this.selectedrow = dlgu.SelectedData; this.StringValue = dlgu.SelectedData.ID; } } else { this.selectedrow = null; this.StringValue = null; } } #endregion break; case eSearchType.Customer: #region Customer using (CustomerDialog dlgc = new CustomerDialog(null)) { if (dlgc.RowCount == 1) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlgc.SelectedData.ADDR; } IntV = dlgc.SelectedData.ID; this.selectedrow = dlgc.SelectedData; } else if (dlgc.RowCount > 1) { if (dlgc.ShowDialog(this) == DialogResult.OK) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlgc.SelectedData.ADDR; } IntV = dlgc.SelectedData.ID; this.selectedrow = dlgc.SelectedData; } } else { if (OptionalTextBox != null) { OptionalTextBox.Text = null; } IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.Project: #region Project using (ProjectDialog dlgp = new ProjectDialog(null)) { if (dlgp.RowCount == 1) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlgp.SelectedData.ADDR; } IntV = dlgp.SelectedData.ID; this.selectedrow = dlgp.SelectedData; } else if (dlgp.RowCount > 1) { if (dlgp.ShowDialog(this) == DialogResult.OK) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlgp.SelectedData.ADDR; } IntV = dlgp.SelectedData.ID; this.selectedrow = dlgp.SelectedData; } } else { if (OptionalTextBox != null) { OptionalTextBox.Text = null; } IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.Instrument: #region Instrument using (InstrumentDialog dlgi = new InstrumentDialog(null)) { if (dlgi.RowCount == 1) { IntV = dlgi.SelectedData.ID; this.selectedrow = dlgi.SelectedData; } else if (dlgi.RowCount > 1) { if (dlgi.ShowDialog(this) == DialogResult.OK) { IntV = dlgi.SelectedData.ID; this.selectedrow = dlgi.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.MethodAnalysis: #region MethodAnalysis using (MethodAnalysisDialog dlgm = new MethodAnalysisDialog(null)) { if (dlgm.RowCount == 1) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } else if (dlgm.RowCount > 1) { if (dlgm.ShowDialog(this) == DialogResult.OK) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.ParameterAnalysis: #region ParameterAnalysis using (ParameterAnalysisDialog dlgm = new ParameterAnalysisDialog(null)) { if (dlgm.RowCount == 1) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } else if (dlgm.RowCount > 1) { if (dlgm.ShowDialog(this) == DialogResult.OK) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.ToolPick: #region ToolPick using (ToolPickDialog dlgm = new ToolPickDialog(null)) { if (dlgm.RowCount == 1) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } else if (dlgm.RowCount > 1) { if (dlgm.ShowDialog(this) == DialogResult.OK) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.ToolAnalysis: #region ToolAnalysis using (ToolAnalysisDialog dlgm = new ToolAnalysisDialog(null)) { if (dlgm.RowCount == 1) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } else if (dlgm.RowCount > 1) { if (dlgm.ShowDialog(this) == DialogResult.OK) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.StandardLight: #region StandardLight using (StandardLightDialog dlgm = new StandardLightDialog(null)) { if (dlgm.RowCount == 1) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } else if (dlgm.RowCount > 1) { if (dlgm.ShowDialog(this) == DialogResult.OK) { IntV = dlgm.SelectedData.ID; this.selectedrow = dlgm.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; } if (OnSelected != null) { OnSelected(this, null); } } catch (Exception ex) { throw ex; } }
private void TextChange() { int?tmp = this.IntV; if (this.Text.IsNull()) { this.IntV = null; return; } if (this.Text == GetTextDisplay()) { return; } switch (SearchType) { case eSearchType.None: break; case eSearchType.User: #region User using (UserDialog dlg = new UserDialog(this.TextValue)) { if (dlg.RowCount == 1) { this.StringValue = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { this.StringValue = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { this.StringValue = null; this.selectedrow = null; } } #endregion break; case eSearchType.Customer: #region Customer using (CustomerDialog dlg = new CustomerDialog(this.TextValue)) { if (dlg.RowCount == 1) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlg.SelectedData.ADDR; } IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlg.SelectedData.ADDR; } IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { if (OptionalTextBox != null) { OptionalTextBox.Text = null; } IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.Project: #region Project using (ProjectDialog dlg = new ProjectDialog(this.TextValue)) { if (dlg.RowCount == 1) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlg.SelectedData.ADDR; } IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { if (OptionalTextBox != null) { OptionalTextBox.Text = dlg.SelectedData.ADDR; } IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { if (OptionalTextBox != null) { OptionalTextBox.Text = null; } IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.Instrument: #region Instrument using (InstrumentDialog dlg = new InstrumentDialog(this.TextValue)) { if (dlg.RowCount == 1) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.MethodAnalysis: #region MethodAnalysis using (MethodAnalysisDialog dlg = new MethodAnalysisDialog(this.Text)) { if (dlg.RowCount == 1) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.ParameterAnalysis: #region ParameterAnalysis using (ParameterAnalysisDialog dlg = new ParameterAnalysisDialog(this.Text)) { if (dlg.RowCount == 1) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.ToolPick: #region ToolPick using (ToolPickDialog dlg = new ToolPickDialog(this.Text)) { if (dlg.RowCount == 1) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.ToolAnalysis: #region ToolAnalysis using (ToolAnalysisDialog dlg = new ToolAnalysisDialog(this.Text)) { if (dlg.RowCount == 1) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; case eSearchType.StandardLight: #region StandardLight using (StandardLightDialog dlg = new StandardLightDialog(this.Text)) { if (dlg.RowCount == 1) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } else if (dlg.RowCount > 1) { if (dlg.ShowDialog(this) == DialogResult.OK) { IntV = dlg.SelectedData.ID; this.selectedrow = dlg.SelectedData; } } else { IntV = null; this.selectedrow = null; } } #endregion break; } if (OnSelected != null) { OnSelected(this, null); } }
/// <summary> /// Executes output actions specified in Analysis output. /// </summary> /// <param name="results"></param> private void PostProcess(Epi.CommandProcessorResults results) { if (results != null) { foreach (Action actionId in results.Actions) { switch (actionId) { case Action.Beep: Helpers.MessageBeep(0x0); break; case Action.Quit: OnExit(); break; case Action.GridTable: case Action.Update: DataGridForm gridForm = new DataGridForm(this); dockManager1.DockWindow(gridForm, DockStyle.Fill); gridForm.SendToOutput(results, actionId); gridForm.TopMost = true; gridForm.ReadOnly = (actionId == Action.GridTable); break; case Action.SimpleDialog: { UserDialog dlg = new UserDialog(this, results.XmlOutput); /*void*/ dlg.ShowDialog(this); } break; case Action.UserDialog: { using (UserDialog dlg = new UserDialog(this, results.XmlOutput)) { if (dlg.ShowDialog(this) != DialogResult.Cancel) { ExecAssign(results.XmlOutput.DocumentElement); } } } break; case Action.FileOpenDialog: case Action.DatabasesDialog: { FileDialog dlg = new OpenFileDialog(); dlg.Title = results.XmlOutput.DocumentElement.GetAttribute("Title"); dlg.Filter = "All files (*.*)|*.*"; if (actionId == Action.DatabasesDialog) { dlg.Filter = "Access Databases (*.mdb)|*.mdb|" + dlg.Filter; } if (dlg.ShowDialog(this) == DialogResult.OK) { results.XmlOutput.DocumentElement.SetAttribute("VarValue", dlg.FileName); ExecAssign(results.XmlOutput.DocumentElement); } dlg.Dispose(); } break; case Action.FileSaveDialog: { FileDialog dlg = new SaveFileDialog(); dlg.Title = results.XmlOutput.DocumentElement.GetAttribute("Title"); dlg.ShowDialog(this); if (dlg.ShowDialog(this) == DialogResult.OK) { results.XmlOutput.DocumentElement.SetAttribute("VarValue", dlg.FileName); ExecAssign(results.XmlOutput.DocumentElement); } dlg.Dispose(); } break; case Action.OutTable: { try { if (results.XmlOutput == null) { IProjectHost host = Module.GetService(typeof(IProjectHost)) as IProjectHost; Project currentProject = host.CurrentProject; DataTable outTable = results.DsOutput.Tables["OutTable"]; if (outTable != null) { if (currentProject.CollectedData.TableExists(results.OutTableName)) { currentProject.CollectedData.DeleteTable(results.OutTableName); } currentProject.CollectedData.CreateTable(results.OutTableName, outTable); } } } catch (NotImplementedException ex) { Epi.Windows.MsgBox.ShowError(ex.Message); } } break; case Action.Print: outputWindow.Printout(); break; default: break; } } } }