public VoiceCDR CreateVoiceCDRFromRawVoiceCDR(RawVoiceCDR rawVoiceCDR) { var ret = new VoiceCDR(); ret.RawVoiceCDR = rawVoiceCDR; ret.RawVoiceCDRId = rawVoiceCDR.RawVoiceCDRId; ret.MobileNumber = rawVoiceCDR.Charge_Party_Number; ret.DialedNumber = rawVoiceCDR.Dialed_Digit; ret.NormalizedDialedNumber = BillingCommon.NormalizeDialedNumber(rawVoiceCDR.Dialed_Digit); ret.MNOAmountOrg = long.Parse(rawVoiceCDR.Call_Duration); ret.MNOAmount = ret.MNOAmountOrg; ret.MNOCostOrg = double.Parse(rawVoiceCDR.Event_Amount); //TODO: RawVoiceCDR.Dedicated_Amount_Used ret.MNOCost = ret.MNOCostOrg; ret.MNORateOrg = ret.MNOAmount == 0 ? 0 : ((ret.MNOCost / ret.MNOAmount)); //TODO: Correct Rate Formula ret.StartTime = DateTime.ParseExact($"{rawVoiceCDR.Call_Date}{rawVoiceCDR.Call_Time}", "yyyyMMddHHmmss", new CultureInfo("en-US")); ret.EndTime = ret.StartTime.AddSeconds(ret.MNOAmountOrg); ret.MNOAmountLeft = ret.MNOAmount; ret.RecordType = rawVoiceCDR.Record_Type; ret.CallType = rawVoiceCDR.Call_Type; ret.CallSectorType = BillingCommon.GetCallSectorType(ret.NormalizedDialedNumber); ret.APartyMNP = BillingCommon.getCallNetProvider(ret.MobileNumber); ret.BPartyMNP = BillingCommon.getCallNetProvider(ret.NormalizedDialedNumber); ret.CallNetType = ret.CallSectorType != EntityConstants.CALLSECTORTYPE_IRANMOBILE ? EntityConstants.CONST_NA : (ret.APartyMNP == ret.BPartyMNP ? EntityConstants.CALLNETTYPE_ONNET : EntityConstants.CALLNETTYPE_OFFNET); return(ret); }
public MyBillingVoice(RawVoiceCDR rawVoiceCDR) { this.CDR = CreateVoiceCDRFromRawVoiceCDR(rawVoiceCDR); base._CDR = this.CDR; }