private static string QuerySaveLogEmployee(EmployeeLog employee) { List <QuerySource> querySources = new List <QuerySource>(); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.Firstname), Value = StringFormatHelper.GetSingleQuote(employee.Firstname) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.Lastname), Value = StringFormatHelper.GetSingleQuote(employee.Lastname) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.DateOfBirth), Value = StringFormatHelper.GetSingleQuote(StringFormatHelper.GetShortEnDateFormat(employee.DateOfBirth)) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.StartWorkDate), Value = StringFormatHelper.GetSingleQuote(StringFormatHelper.GetShortEnDateFormat(employee.StartWorkDate)) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.Salary), Value = (employee.Salary) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.ProvidentFundRate), Value = (employee.ProvidentFundRate) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLog.ProvidentFundCollectAmount), Value = (employee.ProvidentFundCollectAmount) }); var fieldNames = querySources.Select(a => a.FieldName).ToArray(); var values = querySources.Select(a => a.Value).ToArray(); string query = "INSERT INTO provident.employeelog ( " + string.Join(",", fieldNames) + ") VALUES ( " + string.Join(",", values) + " " + ");" ; return(query); }
private static string QuerySaveLogEmployeeDetail(EmployeeLogDetail employeeDetail) { List <QuerySource> querySources = new List <QuerySource>(); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.EmployeeLogID), Value = (employeeDetail.EmployeeLogID) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.WorkYear), Value = StringFormatHelper.GetSingleQuote(employeeDetail.WorkYear) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.Month), Value = (employeeDetail.Month) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.Salary), Value = (employeeDetail.Salary) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.PVDRate), Value = (employeeDetail.PVDRate) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.CompanyPaidPercent), Value = (employeeDetail.CompanyPaidPercent) }); querySources.Add(new QuerySource { FieldName = nameof(EmployeeLogDetail.ProvidentFundCollect), Value = (employeeDetail.ProvidentFundCollect) }); var fieldNames = querySources.Select(a => a.FieldName).ToArray(); var values = querySources.Select(a => a.Value).ToArray(); string query = "INSERT INTO provident.employeelogdetail ( " + string.Join(",", fieldNames) + ") VALUES ( " + string.Join(",", values) + " " + ");" ; return(query); }