Ejemplo n.º 1
0
        public bool Insert(Model.PhoneDetail.PhoneDetail phonedetail)
        {
            //checking  if this phone is registered before
            var result = (!_phonedetailRepository.FindBy(m => m.DEVICEID == phonedetail.DEVICEID).Any());

            if (!result)
            {
                return(false);
            }
            _phonedetailRepository.Add(phonedetail);
            result = (_unitOfWork.Commit() > 0);
            return(result);
        }
        public string InsertPhoneEvent(Wrapper wrapper)
        {
            bool succsess = false;

            if (!_userService.IsRegisteredUserHaveUniqueGuidAndExceedQuota(Guid.Parse(wrapper.userUniqGuid)))
            {
                return(false.ToString());
            }


            String sendtype = wrapper.sendType;

            //Depends on the type(ss) ,we initiate new class and insert it to corresponded field
            switch (sendtype)
            {
            case "PHONEDETAIL":
                //that means,phone for the first time record database.so we need to
                //call _phoneDetailService.Insert methot

                // we are mapping here

                var _phoneDetail = new PhoneDetail();
                _phoneDetail = wrapper.phoneDetail;
                Model.PhoneDetail.PhoneDetail ph = Mapper.Map <PhoneDetail, Model.PhoneDetail.PhoneDetail>(_phoneDetail);
                succsess = _phoneDetailService.Insert(ph);
                break;

            case "CALLDETAIL":
                //that means,phone get a call activity ,so we need to
                //call _callDetailService.Insert methot

                var _phoneuniqeid = wrapper.phoneUniqId;
                //we are finding unique phone record
                var dd = _phoneDetailService.FindByPhoneUniqeId(_phoneuniqeid);

                var ph1 = Mapper.Map <Wcf.Phone.CallDetail,
                                      ByX.Model.CallDetail.CallDetail>(wrapper.callDetail);
                ph1.IDF  = dd.Id;
                succsess = _callDetailService.Insert(ph1);

                break;

            case "MESSAGEDETAIL":
                //that means,phone get a message activity so we need to
                //call _messageDetailService.Insert methot

                var _phoneuniqeid2 = wrapper.phoneUniqId;
                var dd2            = _phoneDetailService.FindByPhoneUniqeId(_phoneuniqeid2);

                var ph2 = new ByX.Model.MessageDetail.MessageDetail();
                ph2 = Mapper.Map <Wcf.Phone.MessageDetail,
                                  Model.MessageDetail.MessageDetail>(wrapper.messageDetail);
                ph2.IDF  = dd2.Id;
                succsess = _messageDetailService.Insert(ph2);

                break;
            }


            return(succsess.ToString());
        }
Ejemplo n.º 3
0
 public bool Delete(Model.PhoneDetail.PhoneDetail phonedetail)
 {
     throw new NotImplementedException();
 }