} // end Parameterized constructor /// <summary> /// To override the ToString method so object property values are returned /// </summary> /// <returns>The string containing the object property values</returns> public override string ToString() { return "\r\n" + FirstName.ToString() + " " + LastName.ToString() + ":\r\n\t" + "Type: " + EmpType.ToString().ToLowerInvariant() + "\r\n\t" + "ID: " + EmpID.ToString() + "\r\n\t" + "Hourly Rate: " + HourlyRate.ToString("C") + "\n"; } // end method ToString()
} // end Parameterized constructor /// <summary> /// To override the ToString method so object property values are returned /// </summary> /// <returns>The string containing the object property values</returns> public override string ToString() { return "\r\n" + FirstName.ToString() + " " + LastName.ToString() + ":\r\n\t" + "Type: " + EmpType.ToString().ToLowerInvariant() + "\r\n\t" + "ID: " + EmpID.ToString() + "\r\n\t" + "Monthly Salary: " + MonthlySalary.ToString("C") + "\n"; } // end method ToString()
public string ToString(int a) { return("EMP" + EmpID.ToString().PadLeft(3, '0').PadRight(5, ' ') + FirstName.PadRight(10, ' ') + LastName.PadRight(10, ' ') + Phone); }
//methods public override string ToString() { return("EMP" + EmpID.ToString().PadLeft(3, '0').PadRight(7, ' ') + " " + FirstName.PadRight(10, ' ') + " " + LastName.PadRight(10, ' ') + " " + WorkDate.ToShortDateString().PadRight(15, ' ') + " " + Hours.ToString().PadRight(10, ' ')); }
//method -- override toString to show info of object public override string ToString() { return("EMP" + EmpID.ToString().PadLeft(3, '0').PadRight(7, ' ') + FirstName.PadRight(10, ' ') + LastName.PadRight(10, ' ') + Email.PadRight(25, ' ') + DOB.ToShortDateString().PadRight(15, ' ') + Phone); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ProjectAccess obj = new ProjectAccess(); List <int> EmpIDList = obj.GetEmployeeID(); int i = 0; foreach (int EmpID in EmpIDList) { EmployeeIDDropDownList.Items.Insert(i, new ListItem(EmpID.ToString())); i++; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EmployeeDataAccess empobj = new EmployeeDataAccess(); List <int> EmpIDList = empobj.GetEmployeeID(); int i = 0; foreach (int EmpID in EmpIDList) { EmployeeIDDropDownList.Items.Insert(i, new ListItem(EmpID.ToString())); i++; } } UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; }
protected void Page_Load(object sender, EventArgs e) { //This is to redirect the page if the user is not logged in if (string.IsNullOrEmpty((string)Session["role"])) { Response.Redirect("~/"); } if (!IsPostBack) { SqlConnection connection = new SqlConnection(Strcon); connection.Open(); SqlCommand Command = new SqlCommand("SELECT allocatedquarter.emp_id from allocatedquarter INNER JOIN rent ON allocatedquarter.emp_id=rent.emp_id WHERE rent.rent_status='Due'", connection); EmpID.DataSource = Command.ExecuteReader(); EmpID.DataBind(); EmpID.Items.Insert(0, new ListItem("Select a employee ID", "")); RentGrid.DataBind(); connection.Close(); } }
protected void Page_Load(object sender, EventArgs e) { //This is to redirect the page if the user is not logged in if (string.IsNullOrEmpty((string)Session["role"])) { Response.Redirect("~/"); } if (!IsPostBack) { SqlConnection connection = new SqlConnection(Strcon); connection.Open(); SqlCommand Command = new SqlCommand("SELECT employee.emp_id from employee LEFT JOIN allocatedquarter ON allocatedquarter.emp_id=employee.emp_id WHERE allocatedquarter.emp_id IS NULL;", connection); SqlCommand Command2 = new SqlCommand("SELECT quarterlist.quarter_id from quarterlist LEFT JOIN allocatedquarter ON allocatedquarter.quarter_id=quarterlist.quarter_id WHERE allocatedquarter.quarter_id IS NULL;", connection); EmpID.DataSource = Command.ExecuteReader(); QuarterID.DataSource = Command2.ExecuteReader(); EmpID.DataBind(); QuarterID.DataBind(); QuarterID.Items.Insert(0, new ListItem("Select a quarter ID", "")); EmpID.Items.Insert(0, new ListItem("Select a employee ID", "")); QuarterInfo.DataBind(); connection.Close(); } }
protected void btnReset_Click(object sender, EventArgs e) { EmpID.Text = EmpName.Text = EmpDept.Text = EmpDOJ.Text = EmpSalary.Text = Empmob.Text = EmpAddress.Text = ""; EmpID.Focus(); }
//2 objects are said to be equal if their hashcodes are same and the equals method returns true.... public override int GetHashCode() { return(EmpID.GetHashCode()); }
private void SaveEmpID() { File.WriteAllText("empid.txt", EmpID.ToString()); }
public override string ToString() { return(EmpID.ToString()); }