public Employee(string email, EnumTypeEmployee type, string firstName, string lastName, string address, long contact, DateTime birthDate, DateTime initWork, decimal salary, string passWord, long userId) { this.id = generateId(); this.email = email; this.authHash = GetHash(passWord); this.lastDateLogin = lastDateLogin; this.type = type; this.firstName = firstName; this.lastName = lastName; this.address = address; this.contact = contact; this.birthDate = birthDate; this.initWork = initWork; this.salary = salary; this.Added = DateTime.Now; this.AddedBy = userId; }
public Employee(long id, string email, string authHash, DateTime lastDateLogin, EnumTypeEmployee type, string firstName, string lastName, string address, long contact, DateTime birthDate, DateTime initWork, decimal salary, DateTime Added, long AddedBy, DateTime Updated, long UpdatedBy) { this.id = id; this.email = email; this.authHash = authHash; this.lastDateLogin = lastDateLogin; this.type = type; this.firstName = firstName; this.lastName = lastName; this.address = address; this.contact = contact; this.birthDate = birthDate; this.initWork = initWork; this.salary = salary; this.Added = Added; this.AddedBy = AddedBy; this.Updated = Updated; this.UpdatedBy = UpdatedBy; }
public void List() { try { this.listEmployees.Clear(); using (StreamReader streamReader = new StreamReader(Path)) { while (!streamReader.EndOfStream) { string lineTXT = streamReader.ReadLine(); long id = Convert.ToInt64(lineTXT.Split("|")[0]); string firstName = lineTXT.Split("|")[1]; string lastName = lineTXT.Split("|")[2]; string address = lineTXT.Split("|")[3]; long contact = Convert.ToInt64(lineTXT.Split("|")[4]); DateTime birthDate = Convert.ToDateTime(lineTXT.Split("|")[5]); DateTime initWork = Convert.ToDateTime(lineTXT.Split("|")[6]); decimal salary = Convert.ToDecimal(lineTXT.Split("|")[7]); string email = lineTXT.Split("|")[8]; string authHash = lineTXT.Split("|")[9]; DateTime lastDateLogin = Convert.ToDateTime(lineTXT.Split("|")[10]); EnumTypeEmployee type = (EnumTypeEmployee)Convert.ToInt32(lineTXT.Split("|")[11]); DateTime Added = Convert.ToDateTime(lineTXT.Split("|")[12]); long AddedBy = Convert.ToInt64(lineTXT.Split("|")[13]); DateTime Updated = Convert.ToDateTime(lineTXT.Split("|")[14]); long UpdatedBy = Convert.ToInt64(lineTXT.Split("|")[15]); listEmployees.Add(new Employee(id, email, authHash, lastDateLogin, type, firstName, lastName, address, contact, birthDate, initWork, salary, Added, AddedBy, Updated, UpdatedBy)); } } } catch (Exception ex) { } }