public Result SendChangeInterviewInfo(AppointmentInterviewInfo info) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendChangeInterviewInfo; log.Time = DateTime.Now; try { var model = new ChangeInterviewInfo(); model.hocVienID = info.ContactId; var infoContact = ContactRepository.GetInfo(info.ContactId); model.hoTenHocVien = infoContact.Fullname; model.ngayHenPV = (DateTime)info.AppointmentDate; model.khungGioID = info.TimeSlotId; model.ghiChuLichHen = info.Notes; var phones = PhoneRepository.GetByContact(info.ContactId); foreach (var phone in phones) { if (phone.IsPrimary == 1) { model.dienThoaiHV = phone.PhoneNumber; break; } } //model.dienThoaiHV = infoContact.Mobile1; model.kieuGV = info.TeacherTypeId; model.levelTester = info.LevelTesterId; //model.UserId = infoContact.UserConsultantId; var infoUser = UserRepository.GetInfo(info.UserId); model.AccountTVTS = infoUser.UserName; var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = ws.ChangeInterviewInfo(input); var result = JsonConvert.DeserializeObject <Result>(output); log.Description = result.Description + "_" + input; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Có lỗi xảy ra trong quá trình đặt lịch phỏng vấn. Error: " + ex.Message; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return(result); } }
public Result SendChangeInterviewInfo(AppointmentInterviewInfo info) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendChangeInterviewInfo; log.Time = DateTime.Now; try { var model = new ChangeInterviewInfo(); model.hocVienID = info.ContactId; var infoContact = ContactRepository.GetInfo(info.ContactId); model.hoTenHocVien = infoContact.Fullname; model.ngayHenPV = (DateTime)info.AppointmentDate; model.khungGioID = info.TimeSlotId; model.ghiChuLichHen = info.Notes; var phones = PhoneRepository.GetByContact(info.ContactId); foreach (var phone in phones) { if (phone.IsPrimary == 1) { model.dienThoaiHV = phone.PhoneNumber; break; } } //model.dienThoaiHV = infoContact.Mobile1; model.kieuGV = info.TeacherTypeId; //model.UserId = infoContact.UserConsultantId; var infoUser = UserRepository.GetInfo(info.UserId); model.AccountTVTS = infoUser.UserName; var ws = new WsCRMSoapClient("WsCRMSoap"); var input = JsonConvert.SerializeObject(model); var output = ws.ChangeInterviewInfo(input); // Sửa tên Hàm của CongNN viết var result = JsonConvert.DeserializeObject<Result>(output); log.Description = result.Description + "_" + input; log.Status = result.Code; TmpLogServiceRepository.Create(log); return result; } catch (Exception ex) { var result = new Result(); result.Code = 1; result.Description = "Không gửi được thông tin đặt lịch phỏng vấn mới cho chuyên môn"; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return result; } }