Beispiel #1
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);
 }
Beispiel #2
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);
 }
 public static UpdateRecordRequest.IBuilderWithResource InitRecordsUpdater(HrbcRecordCreator records, HrbcOptionSearch PhaseSearcher)
 {
     UpdateRecordRequest.IBuilder result = ResourceRequest.UpdateRecords();
     foreach (var value in records.Data.Values.Where(val => val.ResourceType != Enums.ResourceType.Contract))
     {
         result.AddContent(value.ResourceType.ToPrivateEnum(), value.Id,
                           content => content.AddField(
                               new HrbcField(value.ResourceType.ToPrivateEnum(), "P_PhaseDate", ResourceType.Standard), Util.ToString(DateTime.Now)
                               ).
                           AddField(
                               new HrbcField(value.ResourceType.ToPrivateEnum(), "P_Phase", ResourceType.Standard), GetMidPhaseOptionId(value.ResourceType, PhaseSearcher)
                               )
                           );
     }
     return(result as UpdateRecordRequest.IBuilderWithResource);
 }
Beispiel #4
0
 private static UpdateRecordRequest.IBuilderWithResource initRecordsUpdater(HrbcRecordCreator.IRecordEntries records, Dictionary <Enums.ResourceType, ulong> optionIds)
 {
     UpdateRecordRequest.IBuilder result = ResourceRequest.UpdateRecords();
     foreach (var value in records.Values.Where(val => val.ResourceType != Enums.ResourceType.Contract))
     {
         result.AddContent(value.ResourceType.ToPrivateEnum(), value.Id,
                           content => content.AddField(
                               new HrbcField(value.ResourceType.ToPrivateEnum(), "P_PhaseDate", ResourceType.Standard), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                               ).
                           AddField(
                               new HrbcField(value.ResourceType.ToPrivateEnum(), "P_Phase", ResourceType.Standard), optionIds[value.ResourceType]
                               )
                           );
     }
     return(result as UpdateRecordRequest.IBuilderWithResource);
 }