public NewLetterForm(List<EmployeeInfo> employeesList, EmployeeInfo currentUser) { InitializeComponent(); _currentUser = currentUser; comboBoxEmployees.DataSource = new BindingSource(ConvertToDataSource(employeesList), null); comboBoxEmployees.DisplayMember = "Item1"; comboBoxEmployees.ValueMember = "Item2"; }
public void EditEmployee(EmployeeInfo employee) { SqlParameter id = new SqlParameter(EmployeeSqlProcedures.Args.Id, employee.Id); SqlParameter firstName = new SqlParameter(EmployeeSqlProcedures.Args.FirstName, employee.FirstName); SqlParameter lastName = new SqlParameter(EmployeeSqlProcedures.Args.LastName, employee.LastName); SqlParameter userName = new SqlParameter(EmployeeSqlProcedures.Args.UserName, employee.UserName); SqlParameter role = new SqlParameter(EmployeeSqlProcedures.Args.Role, employee.Role); _dbImpl.ExecuteStoredProcedureNonQuery(EmployeeSqlProcedures.EditEmployee, id, firstName, lastName, userName, role); }
private void DoTest(EmployeeInfo currentUser) { Random sleepRand = new Random(); for (int i = 0; i < MailCountPerTask; i++) { MailInfo info = GenerateMail(currentUser, i); EmployeeInfo destinationUser = _employees.First(x => x.Id == info.To); Log.Message("Sending mail from {0} to {1}", currentUser.UserName, destinationUser.UserName); _mailServer.SendMail(info); Thread.Sleep(sleepRand.Next(1000, 2000)); } }
public void AddEmployee(EmployeeInfo employee) { SqlParameter idParameter = new SqlParameter(EmployeeSqlProcedures.Args.Id, employee.Id); SqlParameter firstNameParameter = new SqlParameter(EmployeeSqlProcedures.Args.FirstName, employee.FirstName); SqlParameter lastNameParameter = new SqlParameter(EmployeeSqlProcedures.Args.LastName, employee.LastName); SqlParameter loginParameter = new SqlParameter(EmployeeSqlProcedures.Args.UserName, employee.UserName); SqlParameter role = new SqlParameter(EmployeeSqlProcedures.Args.Role, (Int32)employee.Role); _dbImpl.ExecuteStoredProcedureNonQuery(EmployeeSqlProcedures.AddEmployee, idParameter, firstNameParameter, lastNameParameter, loginParameter, role); }
private void btnLogin_Click(object sender, EventArgs e) { string userName = this.userNameBox.Text; string serverName = this.serverNameBox.Text; try { ServerConnection = ProxyConnection.ConnectToServer(serverName); UserInfo = ServerConnection.ResolveUserByName(userName); } catch (Exception ex) { InnerException = ex; } if (InnerException != null) this.DialogResult = System.Windows.Forms.DialogResult.No; else this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public void DeleteEmployee(EmployeeInfo employee) { SqlParameter id = new SqlParameter(EmployeeSqlProcedures.Args.Id, employee.Id); _dbImpl.ExecuteStoredProcedureNonQuery(EmployeeSqlProcedures.DeleteEmployee, id); }
private MailInfo GenerateMail(EmployeeInfo sourceUser, int iteration) { Random rand = new Random(); EmployeeInfo randDestination = _employees[rand.Next(_employees.Count - 1)]; return MailInfo.CreateNewMail(sourceUser.Id, randDestination.Id, "iteration" + 1, Content); }
public void AddEmployee(EmployeeInfo info) { _employeeHive.AddEmployee(info); }
private void AddEmployeeToDataView(EmployeeInfo employeeInfo) { _internalDataView.Rows.Add( employeeInfo.Id, employeeInfo.FirstName, employeeInfo.LastName, employeeInfo.UserName); }