public static void DisplayEmployeeHashTable() { var employees = new EmployeeInformation[100]; var employee1 = new EmployeeInformation(20120003, 42); var employee2 = new EmployeeInformation(20120012, 33); var employee3 = new EmployeeInformation(20120049, 47); employees[employee1.HashNumber] = employee1; employees[employee2.HashNumber] = employee2; employees[employee3.HashNumber] = employee3; employee1 = employees[20120003 % 100]; employee2 = employees[20120012 % 100]; employee3 = employees[20120049 % 100]; Console.WriteLine("Employee No. : " + employee1.Number + " Age : " + employee1.Age); Console.WriteLine("Employee No. : " + employee2.Number + " Age : " + employee2.Age); Console.WriteLine("Employee No. : " + employee3.Number + " Age : " + employee3.Age); }
public IActionResult CreateEmployee(EmployeeInformationViewModel employee) { if (ModelState.IsValid) { var Employee = new EmployeeInformation() { Id = Guid.NewGuid(), FirstName = employee.FirstName, LastName = employee.LastName, Age = employee.Age, Designation = employee.Designation, Salary = employee.Salary, Date = DateTime.Now, Rating = 10, UserId = userId() }; _employee.Create(Employee); return(RedirectToAction("Directory")); } return(View("EmployeeForm", employee)); }
public async Task UpdateEmployee(EmployeeInformation employee, CancellationToken token) { if (employee == null) { throw new ArgumentNullException(nameof(employee)); } await using var db = new HumanResourcesDataContext(Options); var e = await db.Employees.SingleOrDefaultAsync(x => x.Id == employee.Id && !x.Deleted, token).ConfigureAwait(false); if (e == null) { // throw some kind of 'NotFound' exception here throw new Exception(); } e.Update(employee); db.Employees.Update(e); await db.SaveChangesAsync(token).ConfigureAwait(false); }
public ActionResult InputInfo([Bind(Include = "EmployeeInfoID,FirstName,LastName,Phone,Address,City,State,ZipCode,Email")] EmployeeInformation employeeInformation) { if (ModelState.IsValid) { EmployeeInformation employeeInformationOne = new EmployeeInformation { FirstName = employeeInformation.FirstName, LastName = employeeInformation.LastName, Phone = employeeInformation.Phone, Address = employeeInformation.Address, City = employeeInformation.City, State = employeeInformation.State, ZipCode = employeeInformation.ZipCode, Email = User.Identity.Name, }; db.EmployeeInformation.Add(employeeInformationOne); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employeeInformation)); }
public void GeneratePayslipForEmployee_TestInvalidData_ReturnsNullForPayslip() { //Arrange var mockTaxCalculator = new Mock <ITaxCalculatorService>(); IPayslipService _payslipService = new PayslipService(mockTaxCalculator.Object); var data = new EmployeeInformation() { EmployeeFirstName = "David", EmployeeLastName = "Rudd", AnnualSalary = 60050, PayslipFrequency = Enums.CalculationFrequency.Monthly, SuperRate = 52, // << Invalid PayPeriod = "01 Jan-31 Jan" }; //Act var payslip = _payslipService.GeneratePayslipForEmployee(data); //Assert Assert.IsNull(payslip); }
public async Task <int> Handle(SaveInfoCommand request, CancellationToken cancellationToken) { EmployeeInformation _employeeInformation = new EmployeeInformation { FirstName = request.employeeInformation.FirstName, MiddleName = request.employeeInformation.MiddleName, LastName = request.employeeInformation.LastName, Address = request.employeeInformation.Address, DateOfBirth = request.employeeInformation.DateOfBirth, Age = request.employeeInformation.Age }; //if (_employeeInformation.Age > 1) //{ // throw new Exception(); //} dbContext.EmployeeInformation.Add(_employeeInformation); await dbContext.SaveChangesAsync(); return(_employeeInformation.ID); }
public void Get_ReturnsAllEmployeeInformationObject() { //Arrange List <EmployeeInformation> listOdExpectedResult = new List <EmployeeInformation>(); EmployeeInformation ExcpectedResult = Utility.ParseJSONArray <EmployeeInformation>(ReadJsonFromFile()); listOdExpectedResult.Add(ExcpectedResult); _employeeData.Setup(x => x.Get()).Returns(listOdExpectedResult); var controller = new EmployeeDataController(_employeeData.Object); //Act var controllerResult = (OkObjectResult)controller.Get(); List <EmployeeInformation> ActualResult = Utility.ParseJSONArray <List <EmployeeInformation> >(controllerResult.Value.ToString()); //Assert Assert.AreEqual(listOdExpectedResult.Count, ActualResult.Count); }
public List <EmployeeInformation> GetEmployee() { List <EmployeeInformation> newemployee = new List <EmployeeInformation>(); using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("GetEmployee", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { EmployeeInformation employee = new EmployeeInformation(); employee.Id = Convert.ToInt32(rdr["EmployeeID"]); employee.Name = rdr["Name"].ToString(); employee.City = rdr["City"].ToString(); employee.Department = rdr["Department"].ToString(); employee.Gender = rdr["Gender"].ToString(); newemployee.Add(employee); } con.Close(); } return(newemployee); }
static async Task Main(string[] args) { var _services = new ServiceCollection(); var _builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true); var _config = _builder.Build(); _services.AddDbContext <EManagerDbContext>(options => { options.UseSqlServer(_config.GetConnectionString("EManagerConStr")); }) .AddScoped <IEManagerDbContext>(provider => provider.GetService <EManagerDbContext>()); var _serviceProvider = _services.BuildServiceProvider(); Console.WriteLine("EMPLOYEE INFORMATION SYSTEM"); Console.WriteLine("YOUR OPTIONS"); Console.WriteLine("1 - ADD EMPLOYEE INFORMATION"); Console.WriteLine("2 - UPDATE EMPLOYEE INFORMATION"); Console.WriteLine("3 - DELETE EMPLOYEE INFORMATION"); Console.WriteLine("4 - VIEW EMPLOYEES INFORMATIONS"); start: Console.Write("Please enter a command: "); string _cmdNumber = Console.ReadLine(); switch (_cmdNumber) { case "1": Console.WriteLine("ADD EMPLOYEE INFORMATION"); Console.WriteLine("FIRST NAME"); var firstName = Console.ReadLine(); Console.WriteLine("MIDDLE NAME"); var middleName = Console.ReadLine(); Console.WriteLine("LAST NAME"); var lastName = Console.ReadLine(); EmployeeInformation employeeInformation = new EmployeeInformation { FirstName = firstName, MiddleName = middleName, LastName = lastName }; var res = await Mediator.Send(new SaveInfoCommand(employeeInformation)); if (res == true) { Console.WriteLine("INFORMATION SAVED"); } else { Console.WriteLine("INFORMATION NOT SAVED"); } goto start; case "2": goto start; case "3": goto start; case "4": goto start; case "5": default: Console.WriteLine("Invalid Command!"); goto start; } }
// this method updates employee information public void Update(EmployeeInformation employee) { _empStorage.Update(employee); }
// this method first add a new emp an then return a list of employess including newly created employee public void Create(EmployeeInformation employee) { _empStorage.CreateEmp(employee); }
public EmployeeInformation GetAllEmployeeInformationForSpecificEmployee(string empId) { try { connection.Open(); string selectQuery = @"SELECT [emp_nid] ,[emp_first_name] ,[emp_middle_name] ,[emp_last_name] ,[emp_catagory] ,[emp_designation_id] ,[emp_department_id] ,convert(varchar,[emp_joining_date],103)[emp_joining_date] ,[emp_gender] ,convert(varchar,[emp_dateof_birth],103) [emp_dateof_birth] ,[emp_religion] ,[emp_blood] ,[emp_marital_status] ,[emp_service_Preiord] ,[emp_job_status] ,[emp_tin] ,[emp_pasport] , isnull([emp_bed],0) AS [emp_bed] ,isnull([emp_med],0) AS [emp_med] ,isnull([emp_ntrc],0) AS [emp_ntrc] ,isnull([emp_na],0) AS [emp_na] ,[emp_extra_currlm1] ,[emp_extra_currlm2] ,[emp_extra_currlm3] ,[emp_per_house] ,[emp_per_thana] ,[emp_per_District] ,[emp_per_zip_code] ,[emp_per_contact_no] ,[emp_mail_house] ,[emp_mail_thana] ,[emp_mail_district] ,[emp_mail_zip_code] ,[emp_mail_mobile] ,[emp_mail_email] ,[emp_fathers_name] ,[emp_mothers_name] ,[emp_spouse_name] ,[emp_occupation] ,[emp_childe_info1] ,[emp_childe_info2] ,[emp_childe_info3] ,[emp_bank_id] ,[emp_branch_name] ,[emp_account_no] ,[emp_account_type] FROM [tbl_employee_information] WHERE [emp_employee_id]='" + empId + "'"; SqlCommand command = new SqlCommand(selectQuery, connection); SqlDataReader reader = command.ExecuteReader(); EmployeeInformation aEmployeeInformationObj = new EmployeeInformation(); if (reader.HasRows) { while (reader.Read()) { aEmployeeInformationObj.NID = reader[0].ToString(); aEmployeeInformationObj.FirstName = reader[1].ToString(); aEmployeeInformationObj.MiddleName = reader[2].ToString(); aEmployeeInformationObj.LastName = reader[3].ToString(); aEmployeeInformationObj.EmployeeCategory = reader[4].ToString(); aEmployeeInformationObj.Designation = reader[5].ToString(); aEmployeeInformationObj.Section = reader[6].ToString(); //aEmployeeInformationObj.JoiningDate =Convert.ToDateTime(reader[7]); aEmployeeInformationObj.JoiningDate = reader[7].ToString(); aEmployeeInformationObj.Sex = reader[8].ToString(); //aEmployeeInformationObj.DateOfBirth =Convert.ToDateTime(reader[9]); aEmployeeInformationObj.DateOfBirth = reader[9].ToString(); aEmployeeInformationObj.Religion = reader[10].ToString(); aEmployeeInformationObj.BloodGroup = reader[11].ToString(); aEmployeeInformationObj.MaritalStatus = reader[12].ToString(); aEmployeeInformationObj.ServicePeriod = reader[13].ToString(); aEmployeeInformationObj.Jobstatus = reader[14].ToString(); aEmployeeInformationObj.TIN = reader[15].ToString(); aEmployeeInformationObj.Pasport = reader[16].ToString(); aEmployeeInformationObj.BEd = Convert.ToBoolean(reader[17]); aEmployeeInformationObj.MEd = Convert.ToBoolean(reader[18]); aEmployeeInformationObj.NTRCA = Convert.ToBoolean(reader[19]); aEmployeeInformationObj.NA = Convert.ToBoolean(reader[20]); aEmployeeInformationObj.ExtraCurrlm1 = reader[21].ToString(); aEmployeeInformationObj.ExtraCurrlm2 = reader[22].ToString(); aEmployeeInformationObj.ExtraCurrlm3 = reader[23].ToString(); aEmployeeInformationObj.PerHouseNo = reader[24].ToString(); aEmployeeInformationObj.PerThana = reader[25].ToString(); aEmployeeInformationObj.PerDistrict = reader[26].ToString(); aEmployeeInformationObj.PerZipCode = reader[27].ToString(); aEmployeeInformationObj.PerContact = reader[28].ToString(); aEmployeeInformationObj.MailHouse = reader[29].ToString(); aEmployeeInformationObj.MailThana = reader[30].ToString(); aEmployeeInformationObj.MailDistrict = reader[31].ToString(); aEmployeeInformationObj.MailZipCode = reader[32].ToString(); aEmployeeInformationObj.MailMobile = reader[33].ToString(); aEmployeeInformationObj.MailEmail = reader[34].ToString(); aEmployeeInformationObj.FathersName = reader[35].ToString(); aEmployeeInformationObj.MothersName = reader[36].ToString(); aEmployeeInformationObj.SpouseName = reader[37].ToString(); aEmployeeInformationObj.Occupation = reader[38].ToString(); aEmployeeInformationObj.Childe1 = reader[39].ToString(); aEmployeeInformationObj.Childe2 = reader[40].ToString(); aEmployeeInformationObj.Childe3 = reader[41].ToString(); aEmployeeInformationObj.BankId = reader[42].ToString(); aEmployeeInformationObj.BranchName = reader[43].ToString(); aEmployeeInformationObj.AccountNo = reader[44].ToString(); aEmployeeInformationObj.AccountType = reader[45].ToString(); } } return(aEmployeeInformationObj); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } } }
public SaveInfoCommand(EmployeeInformation employeeInformation) { this.employeeInformation = employeeInformation; }
public void UpdateTheEmployeeInformation(EmployeeInformation aEmployeeInformation, List <ExamTitle> etList, List <EmployeeExperience> EmpExperienceList, List <RefrenceInfo> EmpRefrenceList, byte[] image, byte[] sig) { aEmployeeGatewayObj.UpdateTheEmployeeInformation(aEmployeeInformation, etList, EmpExperienceList, EmpRefrenceList, image, sig); }
public IHttpActionResult GetStaffPhoenixDetails(string employeeID) { List <EmployeeInformation> employees = new List <EmployeeInformation>(); string connectionString = ConfigurationManager.ConnectionStrings["sybaseconnection"].ToString(); string queryString = "select b.user_id as user_id," + "b.status as status," + "convert(varchar(4), a.branch_no) as branch_no," + "a.employee_id as employee_id," + "c.name_1 as name_1," + "a.empl_class_code as empl_class_code," + "convert(varchar,a.last_logon_dt) as last_logon_dt," + "a.state as state," + "a.user_name as user_name," + "a.name as name," + "b.acct_no as acct_no," + "b.email_address as email_address " + "FROM phoenix..ad_gb_rsm a ," + "zenbase..zib_applications_users b ," + "phoenix..ad_gb_branch c " + " WHERE b.user_id = a.user_name " + " AND A.branch_no = c.branch_no " + " AND b.staff_id = '" + employeeID + "'"; try { logwriter.WriteTolog("In try"); using (AseConnection connection = new AseConnection(connectionString)) { AseCommand command = new AseCommand(queryString, connection); connection.Open(); AseDataReader reader = command.ExecuteReader(); while (reader.Read()) { var employeeinfo = new EmployeeInformation() { user_id = reader["user_id"].ToString(), status = reader["status"].ToString().Trim(), branch_no = reader["branch_no"].ToString(), employee_id = reader["employee_id"].ToString(), name_1 = reader["name_1"].ToString(), empl_class_code = reader["empl_class_code"].ToString(), last_logon_dt = reader["last_logon_dt"].ToString(), state = reader["state"].ToString(), user_name = reader["user_name"].ToString(), name = reader["name"].ToString(), acct_no = reader["acct_no"].ToString(), email_address = reader["email_address"].ToString() }; employees.Add(employeeinfo); } reader.Close(); } } catch (Exception ex) { logwriter.WriteTolog("Error in inner exception: " + ex.InnerException); logwriter.WriteTolog("Error in message: " + ex.Message); } return(Ok(employees)); }
public ActionResult Delete(int Id) { EmployeeInformation empInfo = eContext.EmployeeInformations.Find(Id); return(View(empInfo)); }
public ActionResult Edit(EmployeeInformation empInfo) { eContext.employeeUpdate(empInfo.Sno, empInfo.Name, empInfo.Address, empInfo.DepartmentID); eContext.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(EmployeeInformation employee) { eContext.employeeAdd(employee.Name, employee.Address, employee.DepartmentID); eContext.SaveChanges(); return(RedirectToAction("Index")); }
public string Create(EmployeeInformation employee) { _eManager.Create(employee.FirstName, employee.LastName, employee.Age, employee.Designation, employee.Salary); return("employee created"); }
protected override void OnInitialized() { employee = EmployeeCRUD.FetchSingleEmployee(this.EmployeeNumber); }
internal void UpdateTheEmployeeInformation(EmployeeInformation aEmployeeInformationObj, List <ExamTitle> etList, List <EmployeeExperience> EmpExperienceList, List <RefrenceInfo> EmpRefrenceList, byte[] image, byte[] sig) { try { connection.Open(); transection = connection.BeginTransaction(); SqlCommand command = new SqlCommand(); command.Connection = connection; command.Transaction = transection; command.CommandText = @"UPDATE [tbl_employee_information] SET [emp_nid] = '" + aEmployeeInformationObj.NID + "',[emp_first_name] = '" + aEmployeeInformationObj.FirstName + "' ,[emp_middle_name] ='" + aEmployeeInformationObj.MiddleName + "',[emp_last_name] = '" + aEmployeeInformationObj.LastName + "',[emp_catagory] ='" + aEmployeeInformationObj.EmployeeCategory + "',[emp_designation_id] ='" + aEmployeeInformationObj.Designation + "',[emp_department_id] ='" + aEmployeeInformationObj.Section + "',[emp_joining_date] ='" + aEmployeeInformationObj.JoiningDate + "',[emp_gender] ='" + aEmployeeInformationObj.Sex + "' ,[emp_dateof_birth] ='" + aEmployeeInformationObj.DateOfBirth + "',[emp_religion] = '" + aEmployeeInformationObj.Religion + "',[emp_blood] ='" + aEmployeeInformationObj.BloodGroup + "',[emp_marital_status] = '" + aEmployeeInformationObj.MaritalStatus + "',[emp_service_Preiord] = '" + aEmployeeInformationObj.ServicePeriod + "',[emp_job_status] ='" + aEmployeeInformationObj.Jobstatus + "',[emp_tin] ='" + aEmployeeInformationObj.TIN + "',[emp_pasport] ='" + aEmployeeInformationObj.Pasport + "',[emp_bed] ='" + aEmployeeInformationObj.BEd + "',[emp_med] ='" + aEmployeeInformationObj.MEd + "',[emp_ntrc] ='" + aEmployeeInformationObj.NTRCA + "',[emp_na] ='" + aEmployeeInformationObj.NA + "',[emp_extra_currlm1] ='" + aEmployeeInformationObj.ExtraCurrlm1 + "',[emp_extra_currlm2] = '" + aEmployeeInformationObj.ExtraCurrlm2 + "',[emp_extra_currlm3] ='" + aEmployeeInformationObj.ExtraCurrlm3 + "',[emp_per_house] ='" + aEmployeeInformationObj.PerHouseNo + "',[emp_per_thana] ='" + aEmployeeInformationObj.PerThana + "',[emp_per_District] ='" + aEmployeeInformationObj.PerDistrict + "',[emp_per_zip_code] ='" + aEmployeeInformationObj.PerZipCode + "',[emp_per_contact_no] ='" + aEmployeeInformationObj.PerContact + "',[emp_mail_house] ='" + aEmployeeInformationObj.MailHouse + "',[emp_mail_thana] ='" + aEmployeeInformationObj.MailThana + "',[emp_mail_district] ='" + aEmployeeInformationObj.MailDistrict + "',[emp_mail_zip_code] ='" + aEmployeeInformationObj.MailZipCode + "',[emp_mail_mobile] ='" + aEmployeeInformationObj.MailMobile + "',[emp_mail_email] ='" + aEmployeeInformationObj.MailEmail + "',[emp_fathers_name] ='" + aEmployeeInformationObj.FathersName + "',[emp_mothers_name] ='" + aEmployeeInformationObj.MothersName + "',[emp_spouse_name] ='" + aEmployeeInformationObj.SpouseName + "',[emp_occupation] ='" + aEmployeeInformationObj.Occupation + "',[emp_childe_info1] = '" + aEmployeeInformationObj.Childe1 + "',[emp_childe_info2] = '" + aEmployeeInformationObj.Childe2 + "',[emp_childe_info3] ='" + aEmployeeInformationObj.Childe3 + "',[emp_bank_id] ='" + aEmployeeInformationObj.BankId + "',[emp_branch_name] ='" + aEmployeeInformationObj.BranchName + "',[emp_account_no] = '" + aEmployeeInformationObj.AccountNo + "',[emp_account_type] ='" + aEmployeeInformationObj.AccountType + "',[emp_image] =@image,[emp_signature] =@sig WHERE [emp_employee_id] = '" + aEmployeeInformationObj.EmployeeId + "' SELECT @@IDENTITY "; command.Parameters.AddWithValue("@image", image); command.Parameters.AddWithValue("@sig", sig); command.ExecuteNonQuery(); command.CommandText = @"DELETE FROM [tbl_employee_education_info] WHERE [edi_employee_id]='" + aEmployeeInformationObj.EmployeeId + "' "; command.ExecuteNonQuery(); command.CommandText = @"DELETE FROM [tbl_employee_experience_information] WHERE [empexp_employee_id]='" + aEmployeeInformationObj.EmployeeId + "' "; command.ExecuteNonQuery(); command.CommandText = @"DELETE FROM [tbl_employee_refrence_information] WHERE [empref_emp_id]='" + aEmployeeInformationObj.EmployeeId + "' "; command.ExecuteNonQuery(); foreach (ExamTitle ext in etList) { command.CommandText = @"INSERT INTO [tbl_employee_education_info] ([edi_serial] ,[edi_employee_id] ,[edi_exam_title_id] ,[edi_institute_name] ,[edi_gpa] ,[edi_grade],[edi_group],[edi_board],[edi_passing_year]) VALUES ((SELECT ISNULL(MAX([edi_serial]),0) FROM [tbl_employee_education_info])+1,'" + aEmployeeInformationObj.EmployeeId + "','" + ext.ExamId + "','" + ext.Inistitute + "','" + ext.GPA + "','" + ext.Grade + "','" + ext.Group + "','" + ext.Board + "','" + ext.PassingYear + "')"; command.ExecuteNonQuery(); } foreach (EmployeeExperience empExp in EmpExperienceList) { command.CommandText = @"INSERT INTO [tbl_employee_experience_information] ([empexp_serial] ,[empexp_organization_name] ,[empexp_position] ,[empexp_duration] ,[empexp_employee_id],[empexp_reasn_for_leave]) VALUES ((SELECT ISNULL(MAX([empexp_serial]),0) FROM [tbl_employee_experience_information])+1,'" + empExp.OrganizationName + "','" + empExp.Position + "','" + empExp.Duration + "','" + aEmployeeInformationObj.EmployeeId + "','" + empExp.ReasonForLeave + "')"; command.ExecuteNonQuery(); } foreach (RefrenceInfo aRefrenceInfoObj in EmpRefrenceList) { command.CommandText = @"INSERT INTO [tbl_employee_refrence_information] ([empref_serial] ,[empref_name] ,[empref_designation] ,[empref_organization] ,[empref_contactno] ,[empref_emp_id]) VALUES ((SELECT ISNULL(MAX([empref_serial]),0) FROM [tbl_employee_refrence_information])+1,'" + aRefrenceInfoObj.Name + "','" + aRefrenceInfoObj.Designation + "','" + aRefrenceInfoObj.Organization + "','" + aRefrenceInfoObj.Contact + "','" + aEmployeeInformationObj.EmployeeId + "')"; command.ExecuteNonQuery(); } transection.Commit(); } catch (Exception ex) { transection.Rollback(); throw new Exception(ex.Message); } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } } }
static async Task Main(string[] args) { await Mediator.Send(new SaveInfoCommand(new EmployeeInformation { Age = 15, FirstName = "Vincent" })); Console.WriteLine("EMPLOYEE INFORMATION SYSTEM"); Console.WriteLine("YOUR OPTIONS"); Console.WriteLine("1 - ADD EMPLOYEE"); Console.WriteLine("2 - VIEW EMPLOYEES"); Console.WriteLine("3 - DELETE EMPLOYEE"); Console.WriteLine("4 - UPDATE EMPLOYEE LASTNAME"); Console.WriteLine("5 - UPDATE EMPLOYEE MIDDLENAME"); Console.WriteLine("6 - UPDATE EMPLOYEE ADDRESS"); Console.WriteLine("7 - SEARCH EMPLOYEE"); Console.WriteLine("5 - SEARCH EMPLOYEE"); start: Console.Write("Please enter a command: "); string _cmdNumber = Console.ReadLine(); switch (_cmdNumber) { case "1": Console.WriteLine("ADD EMPLOYEE INFORMATION"); Console.WriteLine("FIRST NAME"); var firstName = Console.ReadLine(); Console.WriteLine("MIDDLE NAME"); var middleName = Console.ReadLine(); Console.WriteLine("LAST NAME"); var lastName = Console.ReadLine(); Console.WriteLine("DATE OF BIRTH: dd/MM/yyyy"); DateTime born = DateTime.Parse(Console.ReadLine()); TimeSpan age = DateTime.Today - born; var agee = Math.Floor(age.Days / 365.255); var employeeAge = Convert.ToInt32(agee); Console.WriteLine("ADDRESS"); var employeeAddress = Console.ReadLine(); EmployeeInformation employeeInformation = new EmployeeInformation { FirstName = firstName, MiddleName = middleName, LastName = lastName, Address = employeeAddress, Age = employeeAge, DateOfBirth = born }; var _res = await Mediator.Send(new SaveInfoCommand(new EmployeeInformation { Age = 2 })); var checkRes = await Mediator.Send(new CheckEmployeeAgeCommand(employeeInformation.Age)); if (checkRes == true) { var res = await Mediator.Send(new SaveInfoCommand(employeeInformation)); if (res > 0) { Console.WriteLine("SAVED"); } goto start; } else { Console.WriteLine("CAN'T SAVE!! UNDER AGE"); goto start; } case "2": Console.WriteLine("ALL EMPLOYEES "); var _return = await Mediator.Send(new FetchAllInfoQuery()); Console.WriteLine("ID# - NAME - ADDRESS"); foreach (var item in _return) { Console.WriteLine("{0} {1} {2} {3} {4}", item.ID, item.FirstName, item.MiddleName, item.LastName, item.Address); } goto start; case "3": Console.WriteLine("EMPLOYEES INFORMATION"); var _retValue = await Mediator.Send(new FetchAllInfoQuery()); foreach (var item in _retValue) { Console.WriteLine("{0} {1} {2} {3}", item.ID, item.FirstName, item.MiddleName, item.LastName); } Console.WriteLine("ENTER EMPLOYEE ID NUMBER TO DELETE"); var _idChosen = Console.ReadLine(); int _selectedID = int.Parse(_idChosen); DeleteInfoCommand deleteInfoCommand = new DeleteInfoCommand(_selectedID); var _returnVal = await Mediator.Send(deleteInfoCommand); if (_returnVal == true) { Console.WriteLine("DELETED"); } goto start; case "4": Console.WriteLine("ALL EMPLOYEES"); var _returnValue = await Mediator.Send(new FetchAllInfoQuery()); foreach (var item in _returnValue) { Console.WriteLine("{0} {1} {2} {3}", item.ID, item.FirstName, item.MiddleName, item.LastName); } Console.WriteLine("ENTER EMPLOYEE ID TO UPDATE LASTNAME"); var _id = Console.ReadLine(); int _employeeID = int.Parse(_id); Console.WriteLine("ENTER NEW LASTNAME"); var newLastname = Console.ReadLine(); var _r = await Mediator.Send(new UpdateEmployeeLastNameCommand(_employeeID, newLastname)); if (_r == true) { Console.WriteLine("LASTNAME UPDATED"); } goto start; case "5": Console.WriteLine("ALL EMPLOYEES"); var _employeeSelection = await Mediator.Send(new FetchAllInfoQuery()); foreach (var item in _employeeSelection) { Console.WriteLine("{0} {1} {2} {3}", item.ID, item.FirstName, item.MiddleName, item.LastName); } Console.WriteLine("ENTER EMPLOYEE ID TO UPDATE LASTNAME"); var _newID = Console.ReadLine(); int _idNumber = int.Parse(_newID); Console.WriteLine("ENTER NEW LASTNAME"); var newMiddleName = Console.ReadLine(); var _newResult = await Mediator.Send(new UpdateEmployeeMiddleNameCommand(_idNumber, newMiddleName)); if (_newResult == true) { Console.WriteLine("MIDDLENAME UPDATED"); } goto start; case "6": Console.WriteLine("ALL EMPLOYEES"); var _allEmployee = await Mediator.Send(new FetchAllInfoQuery()); foreach (var item in _allEmployee) { Console.WriteLine("{0} {1} {2} {3}", item.ID, item.FirstName, item.MiddleName, item.LastName); } Console.WriteLine("ENTER EMPLOYEE ID TO UPDATE ADDRESS"); var _newIDToUpdare = Console.ReadLine(); int _idSelected = int.Parse(_newIDToUpdare); Console.WriteLine("ENTER NEW LASTNAME"); var newAddress = Console.ReadLine(); var _addressResult = await Mediator.Send(new UpdateEmployeeMiddleNameCommand(_idSelected, newAddress)); if (_addressResult == true) { Console.WriteLine("ADDRESS UPDATED"); } goto start; case "7": Console.WriteLine("SEARCH EMPLOYEE"); Console.WriteLine("ENTRY"); var searchEntry = Console.ReadLine(); var searchedEntries = await Mediator.Send(new SearchEmployeeQuery(searchEntry)); foreach (var item in searchedEntries) { Console.WriteLine("{0} {1} {2} {3} {4}", item.LastName, item.FirstName, item.MiddleName, item.DateOfBirth, item.Address); } goto start; case "8": default: Console.WriteLine("Invalid Command!"); goto start; } }
public void SubmitHIPPCaseSubmissionWorker(IWebDriver context, bool renewal) { #region Pages and Sections HouseholdInformation householdInformation = new HouseholdInformation(context); HIPPSubmitApplicationPageWorker submitApp = new HIPPSubmitApplicationPageWorker(context); ApplicationOverview applicationOverview = new ApplicationOverview(context); EmploymentStatusHiringDetails hiringdetails = new EmploymentStatusHiringDetails(context); CompanyInformation companyInformation = new CompanyInformation(context); PlanInformation planInformation = new PlanInformation(context); CoverageAreasInformation coverageAreasInformation = new CoverageAreasInformation(context); OpenEnrollmentInformation openEnrollmentInformation = new OpenEnrollmentInformation(context); InsuranceType insuranceType = new InsuranceType(context); PlanBenefit planBenefit = new PlanBenefit(context); EmployerAndResourcesInformation employerAndResourcesInformation = new EmployerAndResourcesInformation(context); PolicyHolderEmployeeInformation policyHolderEmployeeInformation = new PolicyHolderEmployeeInformation(context); EmployeeInformation employeeInformation = new EmployeeInformation(context); MembershipInformation membershipInformation = new MembershipInformation(context); WorkItemComponent workitem = new WorkItemComponent(context); Generic generic = new Generic(context); Utility utility = new Utility(context); #endregion DateTime now = DateTime.Today; #region New or Renewal Logic if (renewal) { applicationOverview.ApplicationOverviewInput( DateTime.Today.AddMonths(+2).AddYears(-1).ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"), DateTime.Today.AddMonths(-6).ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"), utility.RandomNumericString(9), "New" ); } else { applicationOverview.ApplicationOverviewInput( now.ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"), DateTime.Today.AddMonths(-6).ToString("MM/dd/yyyy"), DateTime.Today.AddDays(1).ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"), utility.RandomNumericString(9), "New" ); } #endregion #region Required Input generic.CheveronClick("10"); householdInformation.HouseHoldInformationInput( "Self", utility.GetRandomFirstName(), "", utility.GetRandomSurName(), now.AddYears(-35).ToString("MM/dd/yyyy"), utility.RandomNumberAlphaString(10), utility.RandomNumericString(9), "Yes", "Yes");; generic.CheveronClick("10"); generic.CheveronClick("9"); policyHolderEmployeeInformation.PolicyHolderEmployerInformationInput( utility.GetRandomFirstName(), "", utility.GetRandomSurName(), "233 Buchanan St", "Apt101", utility.GetRandomCity(), "VA", "22314", "703" + utility.RandomNumericString(7), "703" + utility.RandomNumericString(7), "202" + utility.RandomNumericString(7), "*****@*****.**");; generic.CheveronClick("9"); generic.CheveronClick("11"); generic.CheveronClick("12"); hiringdetails.EmploymentStatusHiringInput( "Yes", now.AddYears(-9).ToString("MM/dd/yyyy"), "No", "Yes", "No"); generic.CheveronClick("12"); generic.CheveronClick("13"); employerAndResourcesInformation.EmploymentHumanResourcesInformationInput( utility.GetRandomCompanyName(), utility.RandomNumericString(9), "Made Up Street", "Apt101", utility.GetRandomCity(), "VA", "22314", utility.GetRandomFirstName() + utility.GetRandomSurName(), "technology", "2022213300");; generic.CheveronClick("13"); generic.CheveronClick("14"); generic.CheveronClick("15"); companyInformation.CompanyInformationInput( utility.GetRandomCompanyName(), utility.RandomNumericString(9), "Address Line One", "Address line two", utility.GetRandomCity(), "VA", "23019", utility.GetRandomFirstName() + utility.GetRandomSurName(), "8883930023");; generic.CheveronClick("15"); generic.CheveronClick("16"); planInformation.PlanInformationInput( "COBRA", "No", now.AddYears(-12).ToString("MM/dd/yyyy"), "Monthly", utility.RandomNumericString(3)); generic.CheveronClick("16"); generic.CheveronClick("14"); generic.CheveronClick("17"); generic.CheveronClick("18"); employeeInformation.EmployeeInformationInput( "Employee", "Middle", "Worker", "4942005931", now.AddYears(-43).ToString("MM/dd/yyyy"), now.AddYears(-12).ToString("MM/dd/yyyy"), "No", "No", "No"); generic.CheveronClick("18"); generic.CheveronClick("19"); membershipInformation.EmployeeMemberInput( "No", utility.GetRandomFirstName(), "Middle", utility.GetRandomSurName(), DateTime.Today.AddYears(-25).ToString("MM/dd/yyyy"), "Guardian" ); generic.CheveronClick("19"); generic.CheveronClick("20"); coverageAreasInformation.CoverageSelection(utility.RandomNumericString(1)); coverageAreasInformation.CoverageSelection(utility.RandomNumericString(1)); coverageAreasInformation.CoverageSelection(utility.RandomNumericString(1)); generic.CheveronClick("20"); generic.CheveronClick("21"); openEnrollmentInformation.OpenEnrollmentInformationInput( DateTime.Today.ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy"), DateTime.Today.ToString("MM/dd/yyyy") ); Thread.Sleep(2000); generic.CheveronClick("21"); generic.CheveronClick("22"); insuranceType.InsuranceTypeInput( "Medical", utility.GetRandomCompanyName(), "Address One St.", "101", "Alexandria", "VA", "22314", "7034049911", "86903954"); Thread.Sleep(2000); insuranceType.InsuranceTypeInput( "Dental", utility.GetRandomCompanyName(), "Maker St.", "202", utility.GetRandomCity(), "VA", "22" + utility.RandomNumericString(3), "7039837771", "86903954"); Thread.Sleep(2000); planBenefit.PlanBenifitsInput( "Yes", utility.RandomNumericString(3), utility.RandomNumericString(4) ); planBenefit.SelectTypeOfHealthPlan(utility.RandomNumericString(1)); planBenefit.SelectTypeOfHealthPlan(utility.RandomNumericString(1)); planBenefit.SelectServicesUnderHealthPlan(utility.RandomNumericString(1)); planBenefit.SelectServicesUnderHealthPlan(utility.RandomNumericString(1)); Thread.Sleep(2000); submitApp.ClickSave(); Thread.Sleep(2000); generic.HoverByElement(workitem.txtWorkItemType); #endregion #region Approve/Deny/Pend Logic #endregion }