コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: HelpUtils.cs プロジェクト: haoas/CRMTPE
        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;
            }
        }