public static Employee InsertEmployee(Employee employee) { string sqlQuery = "INSERT INTO EMPLOYEE(EmployeeID,TerritoryID,AddressID,ManagerID,ContactID,Login,PasswordHash,PasswordSalt,Active,CreationDate,LastLoginDate,LastActivityDate) " + " VALUES(@EmployeeID,@TerritoryID,@AddressID,@ManagerID,@ContactID,@Login,@PasswordHash,@PasswordSalt,@Active,@CreationDate,@LastLoginDate,@LastActivityDate);SELECT @@Identity"; if (employee.EmployeeID == Guid.Empty) employee.EmployeeID = Guid.NewGuid(); else return null; DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery); DBHelper.AddInParameter(dbCommand, "EmployeeID", DbType.Guid, employee.TerritoryID); DBHelper.AddInParameter(dbCommand, "TerritoryID", DbType.Guid, employee.TerritoryID); DBHelper.AddInParameter(dbCommand, "AddressID", DbType.Guid, employee.AddressID); DBHelper.AddInParameter(dbCommand, "ManagerID", DbType.Guid, employee.ManagerID); DBHelper.AddInParameter(dbCommand, "ContactID", DbType.Guid, employee.ContactID); DBHelper.AddInParameter(dbCommand, "Login", DbType.String, employee.Login); DBHelper.AddInParameter(dbCommand, "PasswordHash", DbType.String, employee.PasswordHash); DBHelper.AddInParameter(dbCommand, "PasswordSalt", DbType.String, employee.PasswordSalt); DBHelper.AddInParameter(dbCommand, "Active", DbType.Boolean, true); DBHelper.AddInParameter(dbCommand, "CreationDate", DbType.DateTime, employee.CreationDate); DBHelper.AddInParameter(dbCommand, "LastLoginDate", DbType.DateTime, employee.LastLoginDate); DBHelper.AddInParameter(dbCommand, "LastActivityDate", DbType.DateTime, employee.LastActivityDate); return employee; }
public FieldCall(Guid fieldcallid, Dictionary fieldcallstatus, Employee employee, Contact contact, CustomerFacility customerfacility) { this.fieldcallid= fieldcallid; this.fieldcallstatus= fieldcallstatus; this.employee= employee; this.contact= contact; this.customerfacility= customerfacility; }
public Task(Guid taskid, string name, Employee createdby, DateTime datecreated, bool isapproved, Dictionary taskstatus) { this.taskid= taskid; this.name= name; this.createdby= createdby; this.datecreated= datecreated; this.isapproved= isapproved; this.taskstatus= taskstatus; }
public FieldCall(Guid fieldcallid, Dictionary fieldcallstatus, Employee employee, Contact contact, CustomerFacility customerfacility, string fulldescription, DateTime? date, DateTime? starttime, DateTime? endtime) { this.fieldcallid= fieldcallid; this.fieldcallstatus= fieldcallstatus; this.employee= employee; this.contact= contact; this.customerfacility= customerfacility; this.fulldescription= fulldescription; this.date= date; this.starttime= starttime; this.endtime= endtime; }
public static Employee InsertEmployee(string login, string password) { Employee employee = new Employee(); employee.Login = login; employee.PasswordSalt = CreateSalt(5); employee.PasswordHash = CreatePasswordHash(password, employee.PasswordSalt); employee.Active = true; employee.CreationDate = DateTime.Now; employee.LastActivityDate = DateTime.Now; employee.LastLoginDate = DateTime.MinValue; return EmployeeDB.InsertEmployee(employee); }
public Task(Guid taskid, string name, Employee createdby, string fulldescription, DateTime datecreated, DateTime? datemodified, DateTime? dateexecuted, DateTime? datetoendtask, bool isapproved, Dictionary taskstatus) { this.taskid= taskid; this.name= name; this.createdby= createdby; this.fulldescription= fulldescription; this.datecreated= datecreated; this.datemodified= datemodified; this.dateexecuted= dateexecuted; this.datetoendtask= datetoendtask; this.isapproved= isapproved; this.taskstatus= taskstatus; }
public Order(Guid orderid, CustomerFacility customerfacility, Territory territory, Employee employee, Dictionary orderstatus, string identifier, DateTime orderdate, decimal subtotal, decimal taxamount, decimal total) { this.orderid= orderid; this.customerfacility= customerfacility; this.territory= territory; this.employee= employee; this.orderstatus= orderstatus; this.identifier= identifier; this.orderdate= orderdate; this.subtotal= subtotal; this.taxamount= taxamount; this.total= total; }
private static Employee GetEmployeeFromReader(IDataReader dataReader) { Employee employee = new Employee(); employee.EmployeeID = DBHelper.GetGuid(dataReader, "EmployeeID"); employee.TerritoryID = DBHelper.GetGuid(dataReader, "TerritoryID"); employee.AddressID = DBHelper.GetGuid(dataReader, "AddressID"); employee.ManagerID = DBHelper.GetGuid(dataReader, "ManagerID"); employee.ContactID = DBHelper.GetGuid(dataReader, "ContactID"); employee.Login = DBHelper.GetString(dataReader, "Login"); employee.PasswordHash = DBHelper.GetString(dataReader, "PasswordHash"); employee.PasswordSalt = DBHelper.GetString(dataReader, "PasswordSalt"); employee.Active = DBHelper.GetBoolean(dataReader, "Active"); employee.LastActivityDate = DBHelper.GetDateTime(dataReader, "LastActivityDate"); employee.LastLoginDate = DBHelper.GetDateTime(dataReader, "LastLoginDate"); employee.CreationDate = DBHelper.GetDateTime(dataReader, "CreationDate"); return employee; }
public static void UpdateEmployee(Employee employee) { string sqlQuery = "UPDATE EMPLOYEE SET TerritoryID=@TerritoryID, AddressID=@AddressID, ManagerID=@ManagerID, ContactID=@ContactID,Login=@Login,PasswordHash=@PasswordHash,PasswordSalt=@PasswordSalt,Active=@Active, CreationDate=@CreationDate, LastLoginDate=@LastLoginDate, LastActivityDate=@LastActivityDate WHERE EmployeeID='" + employee.EmployeeID+"'"; DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery); DBHelper.AddInParameter(dbCommand, "TerritoryID", DbType.Guid, employee.TerritoryID); DBHelper.AddInParameter(dbCommand, "AddressID", DbType.Guid, employee.AddressID); DBHelper.AddInParameter(dbCommand, "ManagerID", DbType.Guid, employee.ManagerID); DBHelper.AddInParameter(dbCommand, "ContactID", DbType.Guid, employee.ContactID); DBHelper.AddInParameter(dbCommand, "Login", DbType.String, employee.Login); DBHelper.AddInParameter(dbCommand, "PasswordHash", DbType.String, employee.PasswordHash); DBHelper.AddInParameter(dbCommand, "PasswordSalt", DbType.String, employee.PasswordSalt); DBHelper.AddInParameter(dbCommand, "Active", DbType.Boolean, true); DBHelper.AddInParameter(dbCommand, "CreationDate", DbType.DateTime, employee.CreationDate); DBHelper.AddInParameter(dbCommand, "LastLoginDate", DbType.DateTime, employee.LastLoginDate); DBHelper.AddInParameter(dbCommand, "LastActivityDate", DbType.DateTime, employee.LastActivityDate); DBHelper.ExecuteNonQuery(dbCommand); }
public static void UpdateEmployee(Employee employee) { EmployeeDB.UpdateEmployee(employee); }