Esempio n. 1
0
        public Result SendRequestSB100(int ContactId, int feePackageType) // tuy chon, thoa thich
        {
            var log = new TmpLogServiceInfo();

            log.Status   = 0;
            log.CallType = (int)CallType.SendRequestSB100;
            log.Time     = DateTime.Now;
            try
            {
                //
                var infoContact = ContactRepository.GetInfo(ContactId);
                var model       = new SB100();
                model.hocVienId    = ContactId;
                model.hoTenHocVien = infoContact.Fullname;
                var phones = PhoneRepository.GetByContact(ContactId);
                foreach (var phone in phones)
                {
                    if (phone.IsPrimary == 1)
                    {
                        model.dienThoai = phone.PhoneNumber;
                        break;
                    }
                }
                var infoLevel = ContactLevelInfoRepository.GetInfoByContactId(ContactId);
                model.kieuHocPhiId = feePackageType; // infoLevel.FeePackageType;
                var infoUser = UserRepository.GetInfo(infoContact.UserConsultantId);
                model.TVTS = infoUser.UserName;

                var ws     = new WsCRMSoapClient("WsCRMSoap");
                var input  = JsonConvert.SerializeObject(model);
                var output = ws.UpdateSB100(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ài khoản cấp cho Chuyên Môn";
                log.Description    = result.Description;
                log.Status         = result.Code;
                TmpLogServiceRepository.Create(log);
                return(result);
            }
        }
Esempio n. 2
0
        // tuy chon, thoa thich
        public Result SendRequestSB100(int ContactId, int feePackageType)
        {
            var log = new TmpLogServiceInfo();
            log.Status = 0;
            log.CallType = (int)CallType.SendRequestSB100;
            log.Time = DateTime.Now;
            try
            {
                //
                var infoContact = ContactRepository.GetInfo(ContactId);
                var model = new SB100();
                model.hocVienId = ContactId;
                model.hoTenHocVien = infoContact.Fullname;
                var phones = PhoneRepository.GetByContact(ContactId);
                foreach (var phone in phones)
                {
                    if (phone.IsPrimary == 1)
                    {
                        model.dienThoai = phone.PhoneNumber;
                        break;
                    }
                }
                var infoLevel = ContactLevelInfoRepository.GetInfoByContactId(ContactId);
                model.kieuHocPhiId = feePackageType; // infoLevel.FeePackageType;
                var infoUser = UserRepository.GetInfo(infoContact.UserConsultantId);
                model.TVTS = infoUser.UserName;

                var ws = new WsCRMSoapClient("WsCRMSoap");
                var input = JsonConvert.SerializeObject(model);
                var output = ws.UpdateSB100(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ài khoản cấp cho Chuyên Môn";
                log.Description = result.Description;
                log.Status = result.Code;
                TmpLogServiceRepository.Create(log);
                return result;
            }
        }