//修改員工資料到DB public void UpdateEmployee(Employee emp) { string str = "update [AMS_Employee] set Name=@Name,JobTitle=@JobTitle,RoleID=@RoleID,departmentID=@departmentID,DutyDate=@DutyDate," + "Birthday=@Birthday,EXT=@EXT,Email=@Email,PhoneNumber=@PhoneNumber,Address=@Address,Password=@Password," + "Image=@Image, StartDate=@StartDate,EndDate=@EndDate where EmployeeID=@EmployeeID;"; DatabaseTier dt = new DatabaseTier(); dt.SQLHelperNonQuery(str, new Dictionary <string, object>() { { "@Name", emp.EmployeeName }, { "@JobTitle", emp.JobTitle }, { "@RoleID", emp.RoleID }, { "@departmentID", emp.DepatmentID }, { "@DutyDate", emp.DutyDate }, { "@Birthday", emp.Birthday }, { "@EXT", emp.EXT }, { "@Email", emp.Email }, { "@PhoneNumber", emp.Cellphone }, { "@Address", emp.Address }, { "@EmployeeID", emp.EmployeeID }, { "@Password", emp.Password }, { "@Image", emp.ImageBytes }, { "@StartDate", emp.StartDate }, { "@EndDate", emp.EndDate } }); }
//新增員工資料到DB public void InsertEmployee(Employee emp) { string str = "insert into [AMS_Employee] values(@EmployeeID,@Password,@Name,@JobTitle,@RoleID,@departmentID,@DutyDate," + "@Birthday,@EXT,@Email,@PhoneNumber,@Address,@Image,@StartDate,@EndDate)"; DatabaseTier dt = new DatabaseTier(); dt.SQLHelperNonQuery(str, new Dictionary <string, object>() { { "@EmployeeID", emp.EmployeeID }, { "@Password", emp.Password }, { "@Name", emp.EmployeeName }, { "@JobTitle", emp.JobTitle }, { "@RoleID", emp.RoleID }, { "@departmentID", emp.DepatmentID }, { "@DutyDate", emp.DutyDate }, { "@Birthday", emp.Birthday }, { "@EXT", emp.EXT }, { "@Email", emp.Email }, { "@PhoneNumber", emp.Cellphone }, { "@Address", emp.Address }, { "@Image", emp.ImageBytes }, { "@StartDate", emp.StartDate }, { "@EndDate", emp.EndDate } }); }
public DatabaseProfile(DatabaseType databaseType, string sku, DatabaseTier tier) { if (sku == null) { throw new ArgumentNullException(nameof(sku)); } DatabaseType = databaseType; Sku = sku; Tier = tier; }
public List <Sub> GetSub() { List <Sub> list = new List <Sub>(); DatabaseTier dt = new DatabaseTier(); DataTable dataTable = dt.GetSubFromDatabase(); foreach (DataRow item in dataTable.Rows) { list.Add(new Sub((int)item[0], (int)item[1], item[2].ToString(), item[3].ToString())); } return(list); }
public List <Role> GetRoleData() { List <Role> list = new List <Role>(); DatabaseTier dt = new DatabaseTier(); DataTable dataTable = dt.GetRoleDataFromDatabase(); foreach (DataRow item in dataTable.Rows) { list.Add(new Role((int)item[0], item[1].ToString())); } return(list); }
public List <Permissions> GetPermissionsData() { List <Permissions> list = new List <Permissions>(); DatabaseTier dt = new DatabaseTier(); DataTable dataTable = dt.GetPermissionsDataFromDatabase(); foreach (DataRow item in dataTable.Rows) { list.Add(new Permissions((int)item[0], (int)item[1], (bool)item[2])); } return(list); }
//取得employeePermission的物件LIST public List <EmployeePermissions> GetEmployeePermissionList() { DatabaseTier dt = new DatabaseTier(); DataTable dataTable = dt.GetEmployeePermission(); List <EmployeePermissions> empPermissionList = new List <EmployeePermissions>(); foreach (DataRow item in dataTable.Rows) { empPermissionList.Add(new EmployeePermissions(item[0].ToString(), (int)item[1], (bool)item[2])); } return(empPermissionList); }
public List <Department> GetDepartmentData() { List <Department> departmentList = new List <Department>(); DatabaseTier dt = new DatabaseTier(); DataTable dataTable = dt.GetDepartmentDataFromDatabase(); foreach (DataRow item in dataTable.Rows) { departmentList.Add(new Department((int)item[0], item[1].ToString())); } return(departmentList); }
//新增員工個別權限至DB public void InsertEmployeePermission(EmployeePermissions employeePermission) { string str = "insert into [AMS_EmployeePermission] values(@EmployeeID,@SiteId,@Enable)"; DatabaseTier dt = new DatabaseTier(); dt.SQLHelperNonQuery(str, new Dictionary <string, object>() { { "@EmployeeID", employeePermission.EmployeeId }, { "@SiteId", employeePermission.SiteId }, { "@Enable", employeePermission.Enable }, }); }
internal DatabaseProfile(DatabaseType databaseType, string serverName, string version, string sku, DatabaseTier tier, HAEnabled?haEnabled, string storageSku, long?storageInGB, long?storageIops, int?backupRetentionDays, EnableSslEnforcement?sslEnforcementEnabled, ResourceIdentifier serverResourceId) { DatabaseType = databaseType; ServerName = serverName; Version = version; Sku = sku; Tier = tier; HAEnabled = haEnabled; StorageSku = storageSku; StorageInGB = storageInGB; StorageIops = storageIops; BackupRetentionDays = backupRetentionDays; SslEnforcementEnabled = sslEnforcementEnabled; ServerResourceId = serverResourceId; }
public List <Employee> GetEmployeeList() { DatabaseTier dt = new DatabaseTier(); DataTable dataTable = dt.GetEmployeesFromDatabase(); List <Employee> empList = new List <Employee>(); foreach (DataRow item in dataTable.Rows) { empList.Add(new Employee( item[0].ToString(), item[1].ToString(), item[2].ToString(), item[3].ToString(), (int)item[4], (int)item[5], DateTime.Parse(item[6].ToString()).ToShortDateString(), DateTime.Parse(item[7].ToString()).ToShortDateString(), item[8].ToString(), item[9].ToString(), item[10].ToString(), item[11].ToString(), (byte[])item[12], DateTime.Parse(item[13].ToString()).ToShortDateString(), DateTime.Parse(item[14].ToString()).ToShortDateString())); } return(empList); }
public void UpdateEmployee(Employee emp) { DatabaseTier dt = new DatabaseTier(); dt.UpdateEmployee(emp); }
public void InsertEmployee(Employee emp) { DatabaseTier dt = new DatabaseTier(); dt.InsertEmployee(emp); }
//新增employeePermission的物件 public void InsertEmployeePermission(EmployeePermissions empPermission) { DatabaseTier dt = new DatabaseTier(); dt.InsertEmployeePermission(empPermission); }
public static string ToSerialString(this DatabaseTier value) => value switch {
internal static DatabaseProfile DeserializeDatabaseProfile(JsonElement element) { DatabaseType type = default; Optional <string> serverName = default; Optional <string> version = default; string sku = default; DatabaseTier tier = default; Optional <HAEnabled> haEnabled = default; Optional <string> storageSku = default; Optional <long> storageInGB = default; Optional <long> storageIops = default; Optional <int> backupRetentionDays = default; Optional <EnableSslEnforcement> sslEnforcementEnabled = default; Optional <ResourceIdentifier> serverResourceId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = new DatabaseType(property.Value.GetString()); continue; } if (property.NameEquals("serverName")) { serverName = property.Value.GetString(); continue; } if (property.NameEquals("version")) { version = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { sku = property.Value.GetString(); continue; } if (property.NameEquals("tier")) { tier = property.Value.GetString().ToDatabaseTier(); continue; } if (property.NameEquals("haEnabled")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } haEnabled = new HAEnabled(property.Value.GetString()); continue; } if (property.NameEquals("storageSku")) { storageSku = property.Value.GetString(); continue; } if (property.NameEquals("storageInGB")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } storageInGB = property.Value.GetInt64(); continue; } if (property.NameEquals("storageIops")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } storageIops = property.Value.GetInt64(); continue; } if (property.NameEquals("backupRetentionDays")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } backupRetentionDays = property.Value.GetInt32(); continue; } if (property.NameEquals("sslEnforcementEnabled")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sslEnforcementEnabled = new EnableSslEnforcement(property.Value.GetString()); continue; } if (property.NameEquals("serverResourceId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } serverResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } } return(new DatabaseProfile(type, serverName.Value, version.Value, sku, tier, Optional.ToNullable(haEnabled), storageSku.Value, Optional.ToNullable(storageInGB), Optional.ToNullable(storageIops), Optional.ToNullable(backupRetentionDays), Optional.ToNullable(sslEnforcementEnabled), serverResourceId.Value)); }