/// <summary> /// 添加 /// </summary> /// <param name="workReportEntity">实体</param> /// <returns>主键</returns> private string AddEntity(BaseWorkReportEntity workReportEntity) { string returnValue = string.Empty; BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper); string sequence = sequenceManager.GetSequence(BaseWorkReportTable.TableName); workReportEntity.SortCode = sequence; //获取职员的部门主键和公司主键 BaseStaffManager staffManager = new BaseStaffManager(DbHelper, UserInfo); string CompanyId = staffManager.GetProperty(workReportEntity.StaffId, BaseStaffTable.FieldCompanyId); string DepartmentId = staffManager.GetProperty(workReportEntity.StaffId, BaseStaffTable.FieldDepartmentId); SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginInsert(BaseWorkReportTable.TableName); sqlBuilder.SetValue(BaseWorkReportTable.FieldId, sequence); sqlBuilder.SetValue(BaseWorkReportTable.FieldCompanyId, CompanyId); sqlBuilder.SetValue(BaseWorkReportTable.FieldDepartmentId, DepartmentId); this.SetEntity(sqlBuilder, workReportEntity); sqlBuilder.SetValue(BaseWorkReportTable.FieldCreateUserId, UserInfo.Id); sqlBuilder.SetDBNow(BaseWorkReportTable.FieldCreateOn); returnValue = sqlBuilder.EndInsert() > 0 ? sequence : string.Empty; return(returnValue); }