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 Result Schedule(FormDataCollection form) { var contactId = form.Get("contactId").ToInt32(); var entityDbs = AppointmentInterviewRepository.GetAllByContactId(contactId); var entity = new AppointmentInterviewInfo { ContactId = contactId, Notes = form.Get("notes"), NotesCM = form.Get("notesCM"), UserId = UserContext.GetCurrentUser().UserID, TimeSlotId = form.Get("timeSlotId").ToInt32(), TeacherTypeId = form.Get("teacherTypeId").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); if (result.Code == 0) { result.Tag = entity.StatusInterviewId; AppointmentInterviewRepository.Create(entity); ContactLevelInfoRepository.UpdateHasAppointmentInterview(entity.ContactId, true); } return result; }
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 Result SendInterviewInfo(AppointmentInterviewInfo info) { 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.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.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 = "Không gửi được thông tin đặt lịch phỏng vấn cho chuyên môn"; log.Description = result.Description; log.Status = result.Code; TmpLogServiceRepository.Create(log); return result; } }