Exemple #1
0
 /// <summary>
 /// Update all records to last phase
 /// </summary>
 /// <param name="records">HrbcGetPhaseIdRecordCreator</param>
 /// <returns></returns>
 public static UpdateRecordRequest.IBuilderWithResource InitRecordsDefaultUpdater(HrbcGetPhaseIdRecordCreator records)
 {
     UpdateRecordRequest.IBuilder result = ResourceRequest.UpdateRecords();
     foreach (var value in records.Data.Values.Where(val => val.Records.ResourceType != Enums.ResourceType.Contract))
     {
         result.AddContent(value.Records.ResourceType.ToPrivateEnum(), value.Records.Id,
                           content => content.AddField(
                               new HrbcField(value.Records.ResourceType.ToPrivateEnum(), "P_PhaseDate", ResourceType.Standard), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                               ).
                           AddField(
                               new HrbcField(value.Records.ResourceType.ToPrivateEnum(), "P_Phase", ResourceType.Standard), PhaseHelper.GetLastPhaseOptionId(value.Records.ResourceType)
                               )
                           );
     }
     return(result as UpdateRecordRequest.IBuilderWithResource);
 }
Exemple #2
0
 /// <summary>
 /// Update record that specified resource type and hrbc record to index of phase list
 /// </summary>
 /// <param name="records">HrbcGetPhaseIdRecordCreator</param>
 /// <param name="resourceType">Resource type</param>
 /// <param name="resourceIndex">Resource index</param>
 /// <param name="index">Index of phase list</param>
 /// <returns></returns>
 public static UpdateRecordRequest.IBuilderWithResource InitRecordsUpdater(HrbcGetPhaseIdRecordCreator records, Enums.ResourceType resourceType, int resourceIndex = 0, int index = 0)
 {
     UpdateRecordRequest.IBuilder result = ResourceRequest.UpdateRecords();
     result.AddContent(resourceType.ToPrivateEnum(), records.Data[$"{resourceType.ToPrivateEnum()}{resourceIndex}"].Records.Id,
                       content => content.AddField(
                           new HrbcField(resourceType.ToPrivateEnum(), "P_PhaseDate", ResourceType.Standard), DateTime.Now.AddSeconds(index).ToString("yyyy-MM-dd HH:mm:ss")
                           ).
                       AddField(
                           new HrbcField(resourceType.ToPrivateEnum(), "P_Phase", ResourceType.Standard), PhaseHelper.GetLastPhaseOptionId(resourceType, index)
                           )
                       );
     return(result as UpdateRecordRequest.IBuilderWithResource);
 }