static void Main(string[] args) { try { Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure); var client = new AccountService.AccountServiceClient(channel); EmployeeName empName = client.GetEmployeeName(new EmployeeNameRequest { EmpId = "1" }); if (empName == null || string.IsNullOrWhiteSpace(empName.FirstName) || string.IsNullOrWhiteSpace(empName.LastName)) { Console.WriteLine("Employee not found."); } else { Console.WriteLine($"The employee name is {empName.FirstName} {empName.LastName}."); } channel.ShutdownAsync().Wait(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine($"Exception encountered: {ex}"); } }
public JsonResult EmployeeName(string Name) { List <EmployeeName> t = new List <EmployeeName>(); string conn = ConfigurationManager.ConnectionStrings["kalingaPPDO"].ConnectionString; using (SqlConnection cn = new SqlConnection(conn)) { string myQuery = "select empid from EmpMasterProfile where CONCAT(FirstName, ' ', MiddleName, ' ', LastName) LIKE @Name"; SqlCommand cmd = new SqlCommand() { CommandText = myQuery, CommandType = CommandType.Text }; cmd.Parameters.AddWithValue("@Name", Name); cmd.Connection = cn; cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { int counter = 0; while (dr.Read()) { EmployeeName tsData = new EmployeeName() { EmployeeID = dr["empid"].ToString() }; t.Add(tsData); counter++; } } } return(Json(t, JsonRequestBehavior.AllowGet)); }
public override int GetHashCode() { int hash = 1; if (EmployeeName.Length != 0) { hash ^= EmployeeName.GetHashCode(); } if (Address.Length != 0) { hash ^= Address.GetHashCode(); } if (Phone != 0) { hash ^= Phone.GetHashCode(); } if (Email.Length != 0) { hash ^= Email.GetHashCode(); } if (Status != false) { hash ^= Status.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private void ExistingPersonSearchField_TextUpdate(object sender, EventArgs e) { // Reset the Reference as a value may not be a employee ExistingPersonReference = null; // Refresh before removing ExistingPersonSearchField.Items.Clear(); foreach (String ExistingName in ExistingEmployees) { ExistingPersonSearchField.Items.Add(ExistingName); } // Resets the cursor ExistingPersonSearchField.SelectionStart = ExistingPersonSearchField.Text.Length; // Update List to only contain names with the text in the text box String NewText = ExistingPersonSearchField.Text; List <String> ToRemove = new List <String>(); if (NewText != "") { foreach (String EmployeeName in ExistingPersonSearchField.Items) { if (!EmployeeName.Contains(NewText)) { ToRemove.Add(EmployeeName); } } } foreach (String RemovedName in ToRemove) { ExistingPersonSearchField.Items.Remove(RemovedName); } }
internal string ValidName() { Console.WriteLine("FirstName : "); EmployeeName = Console.ReadLine(); if (EmployeeName.Length < 2 && EmployeeName.Length > 20) { Console.WriteLine("The name is not valid try again.."); EmployeeName = ValidName(); } Regex check = new Regex(@"^([A-Z][a-z-A-Z])$"); bool valid = check.IsMatch(EmployeeName); //Regex check1 = new Regex(@"^([0-9])$"); if (check.IsMatch(EmployeeName) == true) { valid = false; } char[] charName = EmployeeName.ToCharArray(); for (int i = 0; i < charName.Length - 2; i++) { if ((charName[i] == charName[i + 1]) && (charName[i + 1] == charName[i + 2])) { valid = false; break; } } if ((valid != false)) { Console.WriteLine("Name is Invalid.."); EmployeeName = ValidName(); } return(EmployeeName); }
public AddEmployeeForm() : base("AddEmployeeForm") { EmployeeName = AddTextInput(nameof(EmployeeName)); EmployeeName.MaxLength = 100; EmployeeName.SetValue(""); BirthDate = AddDateInput(nameof(BirthDate)); Department = AddInt32DropDown ( nameof(Department), new DropDownItem <int?>(1, "HR"), new DropDownItem <int?>(2, "IT") ); Department.ItemCaption = "Select..."; Department.MustNotBeNull(); Address = AddComplex(nameof(Address), (p, n) => new AddressInput(p, n)); SSN = AddInt32Input(nameof(SSN)); SSN.IsProtected = true; SSN.AddConstraints(Int32RangeConstraint.FromAbove(0).ToBelow(1000000000)); HireDate = AddDateDropDown ( nameof(HireDate), new DropDownItem <DateTimeOffset?>(DateTimeOffset.Now.Date.AddDays(-1), "Yesterday"), new DropDownItem <DateTimeOffset?>(DateTimeOffset.Now.Date, "Today"), new DropDownItem <DateTimeOffset?>(DateTimeOffset.Now.Date.AddDays(1), "Tomorrow") ); IsTemp = AddBooleanDropDown(nameof(IsTemp)); EmployeeID = AddInt32Hidden(nameof(EmployeeID), 32); }
private void FillNameFields(EmployeeName name) { firstName.Text = name.firstName; lastName.Text = name.lastName; middleName.Text = name.middleName; familyName.Text = name.familyName; }
public void Post(EmployeeName value) { using (var context = new Context.BlogContext()) { value.Id = new Random().Next(1, 100000); context.EmployeeNames.Add(value); context.SaveChanges(); } }
public void SetEmployeeName(string employeeName) { SwitchToFrame(); EmployeeName.Clear(); EmployeeName.SendKeys(employeeName); SwitchToParent(); driver.SwitchTo().Frame("noncoreIframe"); Employee.Click(); SwitchToParent(); }
public EmployeeResultInformationPage SearchForEmployeeName(string employeeName) { Console.WriteLine("Find for the form to search"); Utils.FindElementVisible(By.Id("empsearch_employee_name_empName")); Console.WriteLine("Fill employeeName value: " + employeeName); EmployeeName.SendKeys(employeeName); Console.WriteLine("Click on Search button"); ButtonSearch.Click(); return(new EmployeeResultInformationPage()); }
// If Equals() returns true for a pair of objects // then GetHashCode() must return the same value for these objects. public override int GetHashCode() { //Get hash code for the Name field if it is not null. int hashEmployeeName = EmployeeName == null ? 0 : EmployeeName.GetHashCode(); //Get hash code for the Code field. int hashEmployeeCode = EmployeeName.GetHashCode(); //Calculate the hash code for the product. return(hashEmployeeName ^ hashEmployeeCode); }
//Adds all Names to names list public void AddName() { EmployeeName.Add("John Landry"); EmployeeName.Add("Angela Rush"); EmployeeName.Add("Bill Marsh"); EmployeeName.Add("Peggy Simon"); EmployeeName.Add("Call Yost"); EmployeeName.Add("Joe Miles"); EmployeeName.Add("Joan Jefferies"); EmployeeName.Add("George Mills"); EmployeeName.Add("Gary Cooper"); EmployeeName.Add("Mary Millicent"); }
public void Put(int id, EmployeeName value) { using (var context = new Context.BlogContext()) { //context.EmployeeNames.Remove var updateentity = context.EmployeeNames.Where(e => e.Id == id).FirstOrDefault(); updateentity.Designation = value.Designation; updateentity.Lastname = value.Lastname; updateentity.Name = value.Name; context.EmployeeNames.Update(updateentity); context.SaveChanges(); } }
private void NewRecord_Click(object sender, EventArgs e) { empl_ID.Clear(); EmployeeName.Clear(); Address.Clear(); MobileNo.Clear(); Email.Clear(); BloodGroup.ResetText(); Department.ResetText(); DateOfJoining.ResetText(); Salary.Clear(); BasicWorkingTime.Clear(); //this.Close(); //EmployeeRegistration emp_registration = new EmployeeRegistration(); //emp_registration.Show(); }
public bool Equals(StaffMaster other) { //Check whether the compared object is null. if (Object.ReferenceEquals(other, null)) { return(false); } //Check whether the compared object references the same data. if (Object.ReferenceEquals(this, other)) { return(true); } //Check whether the products' properties are equal. return(EmployeeName.Equals(other.EmployeeName)); }
public EmployeeInfo GetEmployee(int i) { var name = EmployeeName[r.Next(EmployeeName.Count() - 1)]; return(new EmployeeInfo() { EmployeeID = 1000 + i, Name = name, Rating = r.Next(4, 10), ContactID = r.Next(1001, 2000), Gender = gender[name], Title = title[r.Next(title.Count() - 1)], BirthDate = new DateTime(r.Next(1975, 1985), r.Next(1, 12), r.Next(1, 28)), SickLeaveHours = r.Next(15, 70), Salary = new decimal(Math.Round(r.NextDouble() * 6000.5, 2)) }); }
public void WriteXMLToFields(XElement root) { AgencyName.Write(root.Element("AgencyName").Value); EmployeeName.Write(root.Element("NomineeName").Value); EmployeeClassTitle.Write(root.Element("ClassTitle").Value); EmployeeDivision.Write(root.Element("Division").Value); switch (root.Element("ComponentViewName").Value) { case "GoodConduct": SpecialAchievementAward.Write("X"); GrantOfLeave.Write("X"); GrantOfLeaveCount.Write("2"); OtherRecognition.Write("X"); OtherRecognitionSpecified.Write("Award Ribbon"); GoodConductAppraisalMinimumRatingRequirement.Write("X"); GoodConductApprovalObtained.Write("X"); GoodConductApprovalObtainedDate.Write(Convert.ToDateTime(root.Element("EligibilityConfirmationDate").Value).ToString("MM/dd/yy")); break; case "Exemplary": ExemplaryPerformanceAward.Write("X"); ExemplaryPerformanceDateRange.Write($"{Convert.ToDateTime(root.Element("StartDate").Value).ToString("MM/yy")} - {Convert.ToDateTime(root.Element("EndDate").Value).ToString("MM/yy")}"); GrantOfLeave.Write("X"); GrantOfLeaveCount.Write(root.Element("SelectedAwardType").Value); switch (root.Element("SelectedAwardType").Value) { case "1": OutstandingPerformance1.Write("X"); break; case "2": OutstandingPerformance2.Write("X"); break; case "3": OutstandingPerformance3.Write("X"); break; } break; default: throw new NotImplementedException("The Award Type specified in the XML Form Data is not recognized."); } }
// Save/Add button. private void saveButton_Click(object sender, EventArgs e) { bool hasOnlyWhite = EmployeeName.Length > 0 && EmployeeName.Trim().Length == 0; if (hasOnlyWhite || EmployeeName.Equals("")) { labelName.ForeColor = Color.Red; MessageBox.Show(EmptyWarningMessage, EmptyWarningTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } labelName.ForeColor = Color.Black; if (editID != -1) { DialogResult result = MessageBox.Show(SaveConfirmMessage, SaveConfirmTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { pEmployee.Save(editID); EmployeeRefresh?.Invoke(this, new EventArgs()); MessageBox.Show(SaveConfirmOk); } } else { DialogResult result = MessageBox.Show(CreateConfirmMessage, CreateConfirmTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { pEmployee.Save(editID); EmployeeRefresh?.Invoke(this, new EventArgs()); MessageBox.Show(CreateConfirmOk); } } }
public EmployeeName GetEmployeeName(EmployeeNameRequest request) { EmployeeName empName = new EmployeeName(); switch (request.EmpId) { case "1": empName.FirstName = "John"; empName.LastName = "Doe"; break; case "2": empName.FirstName = "Dave"; empName.LastName = "Williams"; break; default: break; } return(empName); }
public async Task Start() { try { EmployeeName empName = _accountServiceClient.GetEmployeeName(new EmployeeNameRequest { EmpId = "1" }); if (empName == null || string.IsNullOrWhiteSpace(empName.FirstName) || string.IsNullOrWhiteSpace(empName.LastName)) { Console.WriteLine("Employee not found."); } else { Console.WriteLine($"The employee name is {empName.FirstName} {empName.LastName}."); } } catch (Exception ex) { Console.WriteLine($"Exception encountered: {ex}"); } }
public void EqualsAndGetHashCodeAndEqualityOperators() { var alice = new EmployeeName("Alice", "Crypto"); var bob = new EmployeeName("Bob", "Crypto"); var aliceNumber = new EmployeeNumber(1); var bobNumber = new EmployeeNumber(2); var aliceEmail = new EmailAddress("*****@*****.**"); var bobEmail = new EmailAddress("*****@*****.**"); var a = new EmployeeInfo(aliceNumber, alice, aliceEmail); var b = new EmployeeInfo(aliceNumber, alice, aliceEmail); var c = new EmployeeInfo(aliceNumber, alice, aliceEmail); var otherNumber = new EmployeeInfo(bobNumber, alice, aliceEmail); var otherName = new EmployeeInfo(aliceNumber, bob, aliceEmail); var otherEmail = new EmployeeInfo(aliceNumber, alice, bobEmail); TestHelpers.EqualityTesting.TestEqualsAndGetHashCode(a, b, c, otherNumber, otherName, otherEmail); TestHelpers.EqualityTesting.TestEqualityOperators(a, b, c, otherNumber, otherName, otherEmail); }
public EmployeeName GetEmployeeName(EmployeeNameRequest request) { EmployeeName empName = new EmployeeName(); switch (request.EmpId) { case "1": empName.FirstName = "Scott"; empName.LastName = "Gu"; break; case "2": empName.FirstName = "Scott"; empName.LastName = "Hanselman"; break; default: empName.FirstName = "Damien"; empName.LastName = "Edward"; break; } return(empName); }
public string AddUser(UserRole role, string employeeName, string userName, Status status, string password) { SelectElement select = new SelectElement(Role); select.SelectByText(role.ToString()); EmployeeName.Clear(); EmployeeName.SendKeys(employeeName); UserName.Clear(); UserName.SendKeys(userName); select = new SelectElement(Status); select.SelectByText(status.ToString()); Password.Clear(); Password.SendKeys(userName); ConfirmPassword.Clear(); ConfirmPassword.SendKeys(userName); SaveBtn.Click(); try { return(string.Format("Error validating employee name: {0}", EmpNameValidationError.Text)); } catch (NoSuchElementException) { } try { return(string.Format("Error validating user name: {0}", UsrNameValidationError.Text)); } catch (NoSuchElementException) { } return("Success"); }
public string ViewAttendanceRecord(string employeeName, string date, out List <string> records) { records = new List <string>(); EmployeeName.Clear(); EmployeeName.SendKeys(employeeName); Date.Clear(); Date.SendKeys(date); ViewBtn.Click(); try { return(ValidationError.Text); } catch (NoSuchElementException) { } IList <IWebElement> tableRows = ResultTable.FindElements(By.TagName("tr")); if (tableRows.Count < 2) { return("No Records Found"); } if (tableRows[1].Text == "No Records Found" | tableRows[1].Text.Contains("No attendance records to display")) { return("No Records Found"); } for (int i = 1; i < tableRows.Count; i++) { records.Add(tableRows[i].Text); } return("Success"); }
/// <summary> /// Returns true if Employee instances are equal /// </summary> /// <param name="other">Instance of Employee to be compared</param> /// <returns>Boolean</returns> public bool Equals(Employee other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EmployeeId == other.EmployeeId || EmployeeId != null && EmployeeId.Equals(other.EmployeeId) ) && ( EmployeeCode == other.EmployeeCode || EmployeeCode != null && EmployeeCode.Equals(other.EmployeeCode) ) && ( EmployeeName == other.EmployeeName || EmployeeName != null && EmployeeName.Equals(other.EmployeeName) ) && ( Gender == other.Gender || Gender.Equals(other.Gender) ) && ( DateOfBirth == other.DateOfBirth || DateOfBirth != null && DateOfBirth.Equals(other.DateOfBirth) ) && ( PhoneNumber == other.PhoneNumber || PhoneNumber != null && PhoneNumber.Equals(other.PhoneNumber) ) && ( DepartmentId == other.DepartmentId || DepartmentId != null && DepartmentId.Equals(other.DepartmentId) ) && ( DepartmentName == other.DepartmentName || DepartmentName != null && DepartmentName.Equals(other.DepartmentName) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( Salary == other.Salary || Salary.Equals(other.Salary) ) && ( WorkStatus == other.WorkStatus || WorkStatus.Equals(other.WorkStatus) ) && ( PositionId == other.PositionId || PositionId != null && PositionId.Equals(other.PositionId) ) && ( PositionName == other.PositionName || PositionName != null && PositionName.Equals(other.PositionName) ) && ( TaxCode == other.TaxCode || TaxCode != null && TaxCode.Equals(other.TaxCode) ) && ( JoinDate == other.JoinDate || JoinDate != null && JoinDate.Equals(other.JoinDate) ) && ( IdentityNumber == other.IdentityNumber || IdentityNumber != null && IdentityNumber.Equals(other.IdentityNumber) ) && ( IdentityDate == other.IdentityDate || IdentityDate != null && IdentityDate.Equals(other.IdentityDate) ) && ( IdentityPlace == other.IdentityPlace || IdentityPlace != null && IdentityPlace.Equals(other.IdentityPlace) )); }
private void ClearFields() { EmployeeName.Clear(); EmployeeID.Clear(); }
private void button1_Click(object sender, EventArgs e) { string error_caption = "Error"; if (string.IsNullOrEmpty(EmployeeName.Text)) { var emp_error = MessageBox.Show("Employee Name cannot be left empty", error_caption, MessageBoxButtons.OK); EmployeeName.Focus(); } else if (!BirthDate.MaskCompleted || !BirthDate.MaskFull) { var emp_error = MessageBox.Show("Birth date is not filled or not finished yet", error_caption, MessageBoxButtons.OK); BirthDate.Focus(); } else if (string.IsNullOrEmpty(Address.Text)) { var emp_error = MessageBox.Show("Address is cannot be left empty", error_caption, MessageBoxButtons.OK); Address.Focus(); } else if (City.SelectedIndex < 0) { var emp_error = MessageBox.Show("Please choose a city", error_caption, MessageBoxButtons.OK); City.Focus(); } else if (Country.SelectedIndex < 0) { var emp_error = MessageBox.Show("Please choose your nation", error_caption, MessageBoxButtons.OK); Country.Focus(); } else if (Qualification.SelectedIndex < 0) { var emp_error = MessageBox.Show("Please choose your highest qualification", error_caption, MessageBoxButtons.OK); Qualification.Focus(); } else if (!Phone.MaskCompleted) { var emp_error = MessageBox.Show("Please enter your phone number", error_caption, MessageBoxButtons.OK); Phone.Focus(); } else if (string.IsNullOrEmpty(Email.Text)) { var emp_error = MessageBox.Show("Please enter your Email", error_caption, MessageBoxButtons.OK); Email.Focus(); } else if (JoinDate.Text.Length == 0) { var emp_error = MessageBox.Show("When did you join this company?", error_caption, MessageBoxButtons.OK); JoinDate.Focus(); } else { string message = "Employee Name: " + this.EmployeeName.Text + "\nDate of birth: " + this.BirthDate.Text + "\nAddress: " + this.Address.Text + "\nCity: " + this.City.Text + "\nCountry: " + this.Country.Text + "\nQualification: " + this.Qualification.Text + "\nPhone: " + this.Phone.Text + "\nEmail: " + this.Email.Text + "\nDate of joining: " + this.JoinDate.Text; string caption = "Information detail"; var result = MessageBox.Show(message, caption, MessageBoxButtons.OK); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (EmployeeId != null) { hashCode = hashCode * 59 + EmployeeId.GetHashCode(); } if (EmployeeCode != null) { hashCode = hashCode * 59 + EmployeeCode.GetHashCode(); } if (EmployeeName != null) { hashCode = hashCode * 59 + EmployeeName.GetHashCode(); } hashCode = hashCode * 59 + Gender.GetHashCode(); if (DateOfBirth != null) { hashCode = hashCode * 59 + DateOfBirth.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } if (DepartmentId != null) { hashCode = hashCode * 59 + DepartmentId.GetHashCode(); } if (DepartmentName != null) { hashCode = hashCode * 59 + DepartmentName.GetHashCode(); } if (Email != null) { hashCode = hashCode * 59 + Email.GetHashCode(); } hashCode = hashCode * 59 + Salary.GetHashCode(); hashCode = hashCode * 59 + WorkStatus.GetHashCode(); if (PositionId != null) { hashCode = hashCode * 59 + PositionId.GetHashCode(); } if (PositionName != null) { hashCode = hashCode * 59 + PositionName.GetHashCode(); } if (TaxCode != null) { hashCode = hashCode * 59 + TaxCode.GetHashCode(); } if (JoinDate != null) { hashCode = hashCode * 59 + JoinDate.GetHashCode(); } if (IdentityNumber != null) { hashCode = hashCode * 59 + IdentityNumber.GetHashCode(); } if (IdentityDate != null) { hashCode = hashCode * 59 + IdentityDate.GetHashCode(); } if (IdentityPlace != null) { hashCode = hashCode * 59 + IdentityPlace.GetHashCode(); } return(hashCode); } }
private void buttonItem3_Click(object sender, EventArgs e) { EmployeeName employeeName = new EmployeeName(); SetTabShow("员工名称", employeeName); }