public int Insert() { //Step 1 - Define a connection to the database by getting // the connection string from App.config string DBConnect = ConfigurationManager.ConnectionStrings["AS_DB"].ConnectionString; SqlConnection myConn = new SqlConnection(DBConnect); // Step 2 - Create a SqlCommand object to add record with INSERT statement string sqlStmt = "INSERT INTO [User] (first_name, last_name, password_hash, password_salt, email, credit_card_info, iv, [key], dob, account_lock, password_max_age)" + "VALUES (@paraFirstName, @paraLastName, @paraPasswordHash, @paraPasswordSalt, @paraEmail, @paraCreditCardInfo, @paraIV, @paraKey, @paraDOB, @paraAccLock, @paraPWDMaxAge)"; SqlCommand sqlCmd = new SqlCommand(sqlStmt, myConn); // Step 3 : Add each parameterised variable with value sqlCmd.Parameters.AddWithValue("@paraFirstName", FirstName); sqlCmd.Parameters.AddWithValue("@paraLastName", LastName); sqlCmd.Parameters.AddWithValue("@paraPasswordHash", PasswordHash); sqlCmd.Parameters.AddWithValue("@paraPasswordSalt", PasswordSalt); sqlCmd.Parameters.AddWithValue("@paraEmail", Email); sqlCmd.Parameters.AddWithValue("@paraCreditCardInfo", CreditCardInfo); sqlCmd.Parameters.AddWithValue("@paraIV", IV); sqlCmd.Parameters.AddWithValue("@paraKey", Key); sqlCmd.Parameters.AddWithValue("@paraDOB", DOB.ToShortDateString()); sqlCmd.Parameters.AddWithValue("@paraAccLock", 0); sqlCmd.Parameters.AddWithValue("@paraPWDMaxAge", DateTime.Now.AddMinutes(15)); // Step 4 Open connection the execute NonQuery of sql command myConn.Open(); int result = sqlCmd.ExecuteNonQuery(); // Step 5 :Close connection myConn.Close(); return(result); }
public override string ToString() { return(Name + "\n" + Gender.ToString() + ", " + GetCurrentAge().ToString() + "\n" + DOB.ToShortDateString() + "\n" + Education.ToString()); }
public override string ShowInfo() { StringBuilder textResult = new StringBuilder(); textResult.AppendLine($"*** Receptionist's Id: {EmpId} ***"); textResult.AppendLine($"Name: {Firstname} {Lastname}"); textResult.AppendLine($"Dob: {DOB.ToShortDateString()}"); return(textResult.ToString()); }
//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); }
public string[] ToListViewItem() { return new string[] { ID.ToString("000000"), Name, Address, DOB.ToShortDateString() }; }
public override string ToString() { var rv = Name + ", dob-" + DOB.ToShortDateString() + "(" + Age + "yo), " + FormatGradeLevel(GradeLevel) + ", since:" + DateEnrolled.ToShortDateString(); if (DateWithdrawn != null) { rv += ", withdrawn:" + DateWithdrawn.Value.ToShortDateString(); } return(rv); }
// return student data public override string ToString() { string studentStatus = String.Format("{0}", Status == true ? "Undergraduate" : "Postgraduate"); StringBuilder buffer = new StringBuilder(); buffer.AppendLine($"Student ID: {ID}"); buffer.AppendLine($"Status: {studentStatus}"); buffer.AppendLine($"Name: {Name}"); buffer.AppendLine($"Date of birth: {DOB.ToShortDateString()}"); buffer.AppendLine($"PPSN: {PPSN}"); buffer.AppendLine($"Email: {Email}"); buffer.AppendLine($"Address: {PostalAddress}"); buffer.AppendLine($"Fees: {CalculateCourseFee():C}"); return(buffer.ToString()); }
public override string ToString() { var res = new StringBuilder(); res.AppendLine(PERSON_DATA); res.AppendLine(); res.AppendLine("Salary = " + GetSalary()); res.AppendLine("Phone = " + GetPhone()); res.AppendLine("Name = " + Name); res.AppendLine("DOB = " + DOB.ToShortDateString()); res.AppendLine("Height = " + Height); res.AppendLine("Country = " + Country); res.AppendLine("Ages of children = " + bytesToString()); res.AppendLine(@"// Instance of configuration node"); res.AppendLine("Address[\"zipcode\"] = " + Address["zipcode"].Value); res.AppendLine("Address.AttrByName(\"city\") = " + Address.AttrByName("city").Value); return(res.ToString()); }
public override string ToString() { return($"{{ user: '******', rating: '{Subscribers}', dob: '{DOB.ToShortDateString()}' }}"); }
public string Display() { string details = name + "\t " + DOB.ToShortDateString() + "\t " + fact + "\t" + age; return(details); }
public override string ToString() { return("Id: " + Id + " Name: " + Name + " (" + DOB.ToShortDateString() + ")"); }
public override string ToString() { return(String.Format("{0}, {1}, {2}", Name, DOB.ToShortDateString(), Category)); }
public string ToCSV() { string result = $"{StudentId},{FirstName},{LastName},{DOB.ToShortDateString()},{Image_Data}"; return(result); }
public override string ToString() { return(string.Format("{0} - {1} - {2}", Breed, Gender, DOB.ToShortDateString())); }
/// <summary> /// Returns all student data split by separator. /// </summary> /// <param name="separator"></param> /// <returns></returns> public string GetDisplayText(string separator) { return($"{LastName},{FirstName}{separator}" + $"{DOB.ToShortDateString()}{separator}"); }
public override string ToString() { return("PatientID: " + PatientId + "\tNHSNumber: " + NHSNumber + "\tFirst Name: " + FirstName + "\tLastName: " + LastName + "\tDOB: " + DOB.ToShortDateString() + "\tAddress: " + Address + "\tMedical Condition: " + MedicalCondition); }