public async Task<StatusData<string>> UpdateEmployment(UpdateEmployeeRequest request, SystemSession session)
        {
            var serviceRequest = new Employment
            {
                Mode = (byte)SystemDbStatus.Updated,
                City = new City { CityId = request.CityId },
                PersonEmploymentId = request.PersonEmploymentId,
                // RequestId = request.RequestId != 0 ? request.RequestId : 0,
                UserId = session.UserId,
                EmployeeInfo = new CompanyEmployeeInfo { CompanyId = request.CompanyId ?? 0, CompanyName = request.CompanyName, Position = request.Position, StartDate = request.StartDate.ToString(), EndDate = request.EndDate != null ? request.EndDate.ToString() : null, EmployeeTypeId = (int)request.EmployeeTypeId }
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.upsertEmployeementHistory(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new StatusData<string> { Status = (SystemDbStatus)response.DbStatus.DbStatusCode, Message = response.DbStatus.DbStatusMsg, SubStatus = response.DbStatus.DbSubStatusCode };

            if (!request.EndDate.HasValue && result.Status.IsOperationSuccessful())
            {
                var empSch = new EmployeeWorkScheduleUpdateRequest { PersonEmploymentId = response.PersonEmploymentId, ScheduleType = request.WorkSchedule.ScheduleType, Schedules = request.WorkSchedule.Schedules };
                await UpdateEmployeeWorkSchedule(empSch, session).ConfigureAwait(false);
            }

            return result;
        }
        public async Task<StatusData<string>> DeleteEmployment(SingleData<int> request, SystemSession session)
        {
            var serviceRequest = new Employment
            {
                UserId = session.UserId,
                Mode = (byte)SystemDbStatus.Deleted,
                PersonEmploymentId = request.Data
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.upsertEmployeementHistory(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new StatusData<string> { Status = (SystemDbStatus)response.DbStatus.DbStatusCode, Message = response.DbStatus.DbStatusMsg, SubStatus = response.DbStatus.DbSubStatusCode };

            return result;
        }
示例#3
0
 public void send_upsertEmployeementHistory(Employment employement, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("upsertEmployeementHistory", TMessageType.Call, seqid_));
   upsertEmployeementHistory_args args = new upsertEmployeementHistory_args();
   args.Employement = employement;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
示例#4
0
 public IAsyncResult send_upsertEmployeementHistory(AsyncCallback callback, object state, Employment employement, Session session)
示例#5
0
      public Employment upsertEmployeementHistory(Employment employement, Session session)
      {
        #if !SILVERLIGHT
        send_upsertEmployeementHistory(employement, session);
        return recv_upsertEmployeementHistory();

        #else
        var asyncResult = Begin_upsertEmployeementHistory(null, null, employement, session);
        return End_upsertEmployeementHistory(asyncResult);

        #endif
      }
示例#6
0
 public IAsyncResult Begin_upsertEmployeementHistory(AsyncCallback callback, object state, Employment employement, Session session)
 {
   return send_upsertEmployeementHistory(callback, state, employement, session);
 }
示例#7
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 0:
         if (field.Type == TType.Struct) {
           Success = new Employment();
           Success.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 1:
         if (field.Type == TType.Struct) {
           Ex = new UserException();
           Ex.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Se = new SessionException();
           Se.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }