public Result SendInterviewInfo(AppointmentInterviewInfo info, bool isVip) { var log = new TmpLogServiceInfo(); log.Status = 0; log.CallType = (int)CallType.SendInterviewInfo; log.Time = DateTime.Now; try { //gọi link của CongNN truyền vào các tham số contactId, Account, Password trên var model = new InterviewInfo(); 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 = isVip == true?ws.UpdateTTPhongVanForVip(input) : ws.UpdateTTPhongVan(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 Schedule(FormDataCollection form) { var contactId = form.Get("contactId").ToInt32(); var entityDbs = AppointmentInterviewRepository.GetAllByContactId(contactId); string noteConsulant = ""; var userConsulant = UserContext.GetCurrentUser(); noteConsulant = userConsulant.IsDATester == false?form.Get("notes") : "VIP+: " + form.Get("notes"); var entity = new AppointmentInterviewInfo { ContactId = contactId, Notes = noteConsulant, NotesCM = form.Get("notesCM"), UserId = userConsulant.UserID, TimeSlotId = form.Get("timeSlotId").ToInt32(), TeacherTypeId = form.Get("teacherTypeId").ToInt32(), LevelTesterId = form.Get("levelTesterId").ToInt32(), StatusInterviewId = form.Get("statusInterviewId").ToInt32(), CasecAccountId = entityDbs.IsNullOrEmpty() ? 0 : entityDbs[0].CasecAccountId, AppointmentDate = form.Get("appointmentDate").ToDateTime("ddMMyyyy") ?? DateTime.Now, }; var reSchedule = form.Get("reSchedule").ToBoolean(); entity.StatusInterviewId = reSchedule ? (int)StatusInterviewType.HocVienDoiLichPhongVan : (int)StatusInterviewType.DaDatHang; var result = reSchedule ? (new HelpUtils()).SendChangeInterviewInfo(entity) : (new HelpUtils()).SendInterviewInfo(entity, userConsulant.IsDATester); if (result.Code == 0) { result.Tag = entity.StatusInterviewId; AppointmentInterviewRepository.Create(entity); ContactLevelInfoRepository.UpdateHasAppointmentInterview(entity.ContactId, true); } return(result); }
private static List <AppointmentInterviewInfo> FillAppointmentInterviewCollection(IDataReader reader, out int totalRecords) { var retVal = new List <AppointmentInterviewInfo>(); totalRecords = 0; try { while (reader.Read()) { //fill business object var info = new AppointmentInterviewInfo(); /* * * * info.ContactId = ConvertHelper.ToInt32(reader["ContactId"]); * * * * * info.UserId = ConvertHelper.ToInt32(reader["UserId"]); * * * * * * * * * * info.TimeSlotId = ConvertHelper.ToInt32(reader["TimeSlotId"]); * * * * info.Notes = ConvertHelper.ToString(reader["Notes"]); * * * * * * info.StatusInterviewId = ConvertHelper.ToInt32(reader["StatusInterviewId"]); * * * * * info.TeacherTypeId = ConvertHelper.ToInt32(reader["TeacherTypeId"]); * * * * * info.CasecAccountId = ConvertHelper.ToInt32(reader["CasecAccountId"]); * * * */ retVal.Add(info); } //Get the next result (containing the total) reader.NextResult(); //Get the total no of records from the second result if (reader.Read()) { totalRecords = Convert.ToInt32(reader[0]); } } finally { //close datareader ObjectHelper.CloseDataReader(reader, true); } return(retVal); }
public static void Update(AppointmentInterviewInfo info) { DataProvider.Instance().AppointmentInterview_Update(info.ContactId, info.UserId, info.AppointmentDate, info.TimeSlotId, info.Notes, info.NotesCM, info.StatusInterviewId, info.TeacherTypeId, info.CasecAccountId); }
public static int Create(AppointmentInterviewInfo info) { return(DataProvider.Instance().AppointmentInterview_Insert(info.ContactId, info.UserId, info.AppointmentDate, info.TimeSlotId, info.Notes, info.NotesCM, info.StatusInterviewId, info.TeacherTypeId, info.CasecAccountId, info.LevelTesterId)); }