public override MessageShim TranslateToShim(GenericCommand command) { #region Reference code // TerminateTerminalDevice terminateTD = new TerminateTerminalDevice(); // com.telekomsrbija.foris.commandtypes.terminateterminaldevice.Req req = // new com.telekomsrbija.foris.commandtypes.terminateterminaldevice.Req(); // req.setPhoneNumber(request.getTdElements().getPhoneNumber()); // req.setReqId(request.getRequestId().toString()); // req.setReqTime( // BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); // req.setTISTDid(request.getTisTerminalDeviceId()); #endregion TerminateTerminalDevice terminateTerminalDevice = new TerminateTerminalDevice(); req req = new req(); terminateTerminalDevice.req = req; req.reqId = command.ReqId.ToString(CultureInfo.InvariantCulture); req.phoneNumber = command.PhoneNumber; req.TISTDid = command.TisTDId.ToString(); req.reqTime = command.ReqTime; return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { //req.setCustomerType(request.getTisCustomerType()); //req.setName(request.getName()); //req.setReqId(request.getRequestId().toString()); //req.setReqTime(BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); //req.setTaxGroup(request.getTaxGroup()); //req.setTISCustomerId(request.getTisCustomerId()); //req.setTISwalletId(request.getTisWalletId()); CreateCustomer createCustomer = new CreateCustomer(); createCustomer.req = new Tools.Commands.Implementation.IF1.CreateCustomer.req(); if (command.BillingCycle.HasValue) { createCustomer.req.billingCycle = command.BillingCycle.ToString(); } createCustomer.req.reqId = command.ReqId.ToString(); createCustomer.req.reqTime = command.ReqTime; createCustomer.req.taxGroup = command.TaxGroup; createCustomer.req.TIScustomerId = command.TisCustomerId; createCustomer.req.TISwalletId = command.TisWalletId; createCustomer.req.customerType = (customerType)Enum.Parse(typeof(customerType), command.CustomerType); createCustomer.req.name = command.Name; return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(createCustomer.req) }; }
public bool Execute(GenericCommand command) { bool success = false; try { MessageShim shim = translator.TranslateToShim(command); if (ErrorTrap.HasErrors) { return false; } if (!skipSendingToQueue) { queue.Open(); queue.WriteTextMessage(shim.Text, shim.CorrelationId, commandName); Log.TraceData(Log.Source, System.Diagnostics.TraceEventType.Information, CommandMessages.CommandDeliveredToRequestQueue, String.Format("Command[Type={0}, Id ={1}] - delivered to queue {2}:{3}", command.CommandType, shim.CorrelationId, queue.ServerConfig.Url, queue.QueueConfig.Name)); } else { Log.TraceData(Log.Source, System.Diagnostics.TraceEventType.Warning, CommandMessages.CommandDeliveredToRequestQueue, String.Format("Command[Type={0}, Id ={1}] - would be delivered to queue {2}:{3}. But this is skipped as skipSendingToQueue is set to true.", command.CommandType, shim.CorrelationId, queue.ServerConfig.Url, queue.QueueConfig.Name)); } return true; } catch (Exception ex) { if (queue != null) queue.Close(); throw; } }
public override MessageShim TranslateToShim(GenericCommand command) { CreateWallet createWallet = new CreateWallet(); req req = new req(); createWallet.req = req; req.reqId = command.ReqId.ToString(); req.reqTime = command.ReqTime; req.TIScustomerId = command.TisCustomerId; req.TISwalletId = command.TisWalletId; if (command.BillingCycle.HasValue) { req.billingCycle = command.BillingCycle.ToString(); } req.taxGroup = command.TaxGroup; return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { #region Reference code // ModifyCustomer modifyCustomer = new ModifyCustomer(); // com.telekomsrbija.foris.commandtypes.modifycustomer.Req req = // new com.telekomsrbija.foris.commandtypes.modifycustomer.Req(); // req.setReqId(request.getRequestId().toString()); // req.setReqTime(BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); // req.setName(request.getName()); // req.setTISCustomerId(request.getTisCustomerId()); // // modifyCustomer.setReq(req); #endregion ModifyCustomer modifyCustomer = new ModifyCustomer(); req req = new req(); modifyCustomer.req = req; req.reqId = command.ReqId.ToString(); req.reqTime = command.ReqTime; req.TIScustomerId = command.TisCustomerId; req.name = command.Name; return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { #region Reference code // ModifyTerminalDevice modifyTerminalDevice = new ModifyTerminalDevice(); //com.telekomsrbija.foris.commandtypes.modifyterminaldevice.Req req = // new com.telekomsrbija.foris.commandtypes.modifyterminaldevice.Req(); //req.setTISTdid(request.getTisTerminalDeviceId()); //req.setPhoneNumber(request.getTdElements().getPhoneNumber()); //req.setReqId(request.getRequestId().toString()); //req.setReqTime( // BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); //req.setContractEnd( // BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime()).toString()); //req.setMonthlyLimit(request.getMonthlyLimit()); //req.setTISwalletId(request.getTisWalletId()); #endregion ModifyTerminalDevice modifyTerminalDevice = new ModifyTerminalDevice(); req req = new req(); modifyTerminalDevice.req = req; req.reqId = command.ReqId.ToString(CultureInfo.InvariantCulture); req.phoneNumber = command.PhoneNumber; if (!String.IsNullOrEmpty(command.TisWalletId)) { req.TISwalletId = command.TisWalletId.Trim(); } req.TISTDid = command.TisTDId.ToString(); if (command.ContractEndDate.HasValue) { req.contractEnd = command.ContractEndDate.Value.ToString("yyyy-MM-ddTHH:mm:ss"); } if (command.MonthlyLimit.HasValue) { req.monthlyLimit = Convert.ToDouble(command.MonthlyLimit.Value); req.monthlyLimitSpecified = true; } req.reqTime = command.ReqTime; return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { TerminateAddonMP terminateAddon = new TerminateAddonMP(); terminateAddon.req = new req(); cid c = new cid(); terminateAddon.req.cid = c; c.Item = command.TisCustomerId; c.ItemElementName = ItemChoiceType.TIScustomerId; terminateAddon.req.reqId = command.ReqId.ToString(); terminateAddon.req.reqTime = command.ReqTime; terminateAddon.req.phoneNumber = command.PhoneNumber; terminateAddon.req.TISwalletId = command.TisWalletId; //MP mp = new MP(); MP marketingPackage = new MP(); //for (MPInstance mpInstance : request.getMarketingPackages()) { // AddonInstance a = (AddonInstance) mpInstance; // mp.setId(new BigInteger(a.getMarketingPackageId().toString())); //} if (ErrorTrap.AddAssertion(command.MarketingPackages.Count == 1, "There should be exactly one marketing package in this command.") && ErrorTrap.AddAssertion(command.MarketingPackages[0].MPType.ToUpper() == "ADDON", "One and only ADDON marketing package is allowed and required for this command.")) { MarketingPackage mpInstance = command.MarketingPackages[0]; if (mpInstance.MPId.HasValue) { marketingPackage.id = mpInstance.MPId.Value.ToString(); //req.setMP(mp); terminateAddon.req.MP = marketingPackage; } else { ErrorTrap.AddAssertion(false, String.Format("Marketing package ID is missing! External mp_instance_id is {0}.", mpInstance.MPInstanceId)); } } //out.add("commandName", "TerminateAddonTDLevelMP"); return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(terminateAddon.req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { #region Reference code // BlockTerminalDeviceRequest request = // (BlockTerminalDeviceRequest)getTransportObject().get("request"); // BlockTerminalDevice blockTerminalDevice = new BlockTerminalDevice(); // com.telekomsrbija.foris.commandtypes.blockterminaldevice.Req req = // new com.telekomsrbija.foris.commandtypes.blockterminaldevice.Req(); // req.setBlockReason(BlockReason.fromValue(request.getBlockReason())); // req.setBlockStatus(new BigInteger(request.getBlockStatus().toString())); // req.setPhoneNumber(request.getTdElements().getPhoneNumber()); // req.setTISTdid(request.getTisTerminalDeviceId()); // // req.setReqId(request.getRequestId().toString()); // req.setReqTime( // BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); #endregion BlockTerminalDevice blockTerminalDevice = new BlockTerminalDevice(); req req = new req(); blockTerminalDevice.req = req; req.reqId = command.ReqId.ToString(CultureInfo.InvariantCulture); req.phoneNumber = command.PhoneNumber; req.TISTDid = command.TisTDId.ToString(); req.reqTime = command.ReqTime; if (!String.IsNullOrEmpty(command.BlockReason)) { req.blockReason = (blockReason)Enum.Parse(typeof(blockReason), command.BlockReason); } if (command.BlockStatus.HasValue) { req.blockStatus = command.BlockStatus.Value.ToString(); } return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { InreaseBCLimit ibc = new InreaseBCLimit(); req req = new req(); ibc.req = req; req.phoneNumber = command.PhoneNumber; req.amount = command.OnetimeLimitAmount; #region Reference code // IncreaseBCLimitRequest request = // (IncreaseBCLimitRequest) getTransportObject().get("request"); //InreaseBCLimit increaseBCLimit = new InreaseBCLimit(); //com.telekomsrbija.foris.commandtypes.increasebc.Req req = // new com.telekomsrbija.foris.commandtypes.increasebc.Req(); //req.setPhoneNumber(request.getTdElements().getPhoneNumber()); //req.setAmount(request.getAmount()); ///*req.setReqId(request.getRequestId().toString()); //req.setReqTime( // BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime()));*/ //increaseBCLimit.setReq(req); //out.add("payload", req); //out.add("id", request.getRequestId().toString()); //out.add("commandName", "IncreaseBCLimit");//increaseBCLimit.getClass().getSimpleName()); #endregion return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareXmlMessage(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { #region Reference code //ModifyWallet modifyWallet = new ModifyWallet(); //com.telekomsrbija.foris.commandtypes.modifywallet.Req req = // new com.telekomsrbija.foris.commandtypes.modifywallet.Req(); //req.setReqId(request.getRequestId().toString()); //req.setReqTime(BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); //req.setTISwalletId(request.getTisWalletId()); //String billingCycle = (request.getBillingCycle() == null // ? null : String.valueOf(request.getBillingCycle())); //req.setBillingCycle(billingCycle); //req.setTaxGroup(request.getTaxGroup()); #endregion ModifyWallet modifyWallet = new ModifyWallet(); req req = new req(); modifyWallet.req = req; req.reqId = command.ReqId.ToString(); req.reqTime = command.ReqTime; req.TISwalletId = command.TisWalletId; if (command.BillingCycle.HasValue) { req.billingCycle = command.BillingCycle.ToString(); } req.taxGroup = command.TaxGroup; return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { Tools.Commands.Implementation.IF1.AddAddonMP.AddAddonMP addon = new AddAddonMP(); req req = new req(); addon.req = req; cid c = new cid(); req.cid = c; c.Item = command.TisTDId.ToString(); c.ItemElementName = ItemChoiceType.TISTDid; req.reqId = command.ReqId.ToString(); req.reqTime = command.ReqTime; req.phoneNumber = command.PhoneNumber; req.TISwalletId = command.TisWalletId; if (ErrorTrap.AddAssertion(command.MarketingPackages.Count == 1, "There should be exactly one marketing package in this command.") && ErrorTrap.AddAssertion(command.MarketingPackages[0].MPType.ToUpper() == "ADDON", "One and only ADDON marketing package is allowed and required for this command.")) { MarketingPackage mp = command.MarketingPackages[0]; if (mp.MPId.HasValue) { AddonMP amp = new AddonMP { id = mp.MPId.ToString() }; List<@params> parameters = new List<@params>(); foreach (PackageParameter pp in mp.Parameters) { // Skip parameters with product code of N/A. That is taken from Milorad's code. if (pp.ProductCode.ToUpper() == "N/A") continue; parameters.Add(new @params { code = (pp.ParamCode == "N/A") ? String.Empty : pp.ParamCode, productCode = pp.ProductCode, value = pp.Value }); } amp.@params = parameters.ToArray(); req.AddonMP = amp; } else { ErrorTrap.AddAssertion(false, String.Format("Marketing package ID is missing (MP_ID command field is null) External mp_instance_id is {0}.", mp.MPInstanceId)); } } #region Reference code #endregion return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public abstract MessageShim TranslateToShim(GenericCommand command);
private void MarkAsBad(OracleTransaction transaction, OracleConnection connection, GenericCommand command) { // normalize the error text for the length as db column is limited to 1000 chars. string errorDescription = null; if (!String.IsNullOrEmpty(ErrorTrap.Text)) { errorDescription = (ErrorTrap.Text.Length <= 1000) ? ErrorTrap.Text : ErrorTrap.Text.Substring(0, 1000); } responseDataProvider.UpdateResponseToFtPro( command.ReqId, "I", invalidCommandStatus, "CEA", DateTime.Now, errorDescription, String.Empty, connection, transaction); ErrorTrap.Reset(); }
public override MessageShim TranslateToShim(GenericCommand command) { ChangeBaseMP cBMP = new ChangeBaseMP(); req req = new req(); cBMP.req = req; #region Reference code for mapping //req.setTISTdid(request.getTisTerminalDeviceId()); //req.setPhoneNumber(request.getTdElements().getPhoneNumber()); //req.setReqId(request.getRequestId().toString()); //req.setReqTime( //BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); #endregion req.reqId = command.ReqId.ToString(); req.reqTime = command.ReqTime; req.phoneNumber = command.PhoneNumber; req.TISTDid = command.TisTDId.ToString(); if (ErrorTrap.AddAssertion(command.MarketingPackages.Count == 1, "There should be exactly one base marketing package in this command.") && ErrorTrap.AddAssertion(command.MarketingPackages[0].MPType.ToUpper() == "BASE", "One and only BASE marketing package is allowed for this command.")) { MarketingPackage mp = command.MarketingPackages[0]; if (mp.MPId.HasValue) { BaseMP bmp = new BaseMP { id = mp.MPId.Value.ToString() }; List<@params> parameters = new List<@params>(); foreach (PackageParameter pp in mp.Parameters) { // Skip parameters with product code of N/A. That is taken from Milorad's code. if (pp.ProductCode.ToUpper() == "N/A") continue; parameters.Add(new @params { code = (pp.ParamCode == "N/A") ? String.Empty : pp.ParamCode, productCode = pp.ProductCode, value = pp.Value }); } bmp.@params = parameters.ToArray(); req.BaseMP = bmp; } else { ErrorTrap.AddAssertion(false, String.Format("Marketing package ID is missing (MP_ID command field is null! External mp_instance_id is {0}.", mp.MPInstanceId)); } } #region Reference code //com.telekomsrbija.foris.commandtypes.changebasemp.BaseMP baseMP = // new com.telekomsrbija.foris.commandtypes.changebasemp.BaseMP(); //for (MPInstance mpInstance : request.getMarketingPackages()) { // BaseMPInstance b = (BaseMPInstance) mpInstance; // baseMP.setId(new BigInteger(b.getMarketingPackageId().toString())); // for (Param param : b.getParams()) { // com.telekomsrbija.foris.commandtypes.alltypes.Params p = // new com.telekomsrbija.foris.commandtypes.alltypes.Params(); // p.setCode((param.getPk().getParamCode().equals("N/A") // ? "" : param.getPk().getParamCode())); // p.setProductCode(param.getPk().getProductCode()); // p.setValue(param.getValue()); // baseMP.getParams().add(p); // } //} //req.setBaseMP(baseMP); //changeBaseMP.setReq(req); #endregion return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }
public override MessageShim TranslateToShim(GenericCommand command) { CreateTerminalDevice ctd = new CreateTerminalDevice(); ctd.req = new req(); ctd.req.reqId = command.ReqId.ToString(CultureInfo.InvariantCulture); ctd.req.TIScustomerId = command.TisCustomerId; ctd.req.TISTDid = command.TisTDId.ToString(CultureInfo.InvariantCulture); ctd.req.TISwalletId = command.TisWalletId; List<addOnMPs> addOnMPs = new List<addOnMPs>(); bool isBaseMPSet = false; //TODO: (SD) can't use extension methods foreach (MarketingPackage mp in command.MarketingPackages) { #region Handle base package // Base package is discriminated by the BASE MPType // Only allow one base marketing package, more than one is an error. if (mp.MPType.ToUpper() == "BASE") { if (ErrorTrap.AddAssertion(!isBaseMPSet, CommandValidationError.MoreThanOneMarketingPackageEncounteredForCommand)) { isBaseMPSet = true; if (mp.MPId.HasValue) { baseMP bmp = new baseMP { id = mp.MPId.ToString() }; List<@params> parameters = new List<@params>(); foreach (PackageParameter pp in mp.Parameters) { parameters.Add(new @params { code = pp.ParamCode, productCode = pp.ProductCode, value = pp.Value }); } bmp.@params = parameters.ToArray(); ctd.req.baseMP = bmp; } else { ErrorTrap.AddAssertion(false, String.Format("Marketing package ID is missing (MP_ID command field is null) External mp_instance_id is {0}.", mp.MPInstanceId)); } } continue; } #endregion // Base package is discriminated by the BASE MPType if (mp.MPType.ToUpper() == "ADDON") { if (mp.MPId.HasValue) { addOnMPs aomp = new addOnMPs { id = mp.MPId.ToString() }; List<@params> parameters = new List<@params>(); foreach (PackageParameter pp in mp.Parameters) { parameters.Add(new @params { code = pp.ParamCode, productCode = pp.ProductCode, value = pp.Value }); } aomp.@params = parameters.ToArray(); addOnMPs.Add(aomp); continue; } else { ErrorTrap.AddAssertion(false, String.Format("Marketing package ID is missing (MP_ID command field is null) External mp_instance_id is {0}.", mp.MPInstanceId)); } } ctd.req.addOnMPs = addOnMPs.ToArray(); } if (command.ContractEndDate.HasValue) { ctd.req.contractEnd = command.ContractEndDate.Value; ctd.req.contractEndSpecified = true; } if (command.MonthlyLimit.HasValue) { ctd.req.monthlyLimit = Convert.ToDouble(command.MonthlyLimit.Value); ctd.req.monthlyLimitSpecified = true; } ctd.req.reqTIme = command.ReqTime; if (!String.IsNullOrEmpty(command.P2P)) { ctd.req.p2p = command.P2P; } bool canSerialize = true; //if (ErrorTrap.AddAssertion(Enum.IsDefined(typeof(TDtype), command.TDType.ToString()), // String.Format("Command TDType value {0} doesn't fall in the allowed range.", command.TDType))) //{ ctd.req.TDtype = (TDtype)command.TDType; //} //else //{ // canSerialize = false; //} TDelements tdElements = new TDelements(); //TODO: (SD) Find out if this is required actually or not if (!String.IsNullOrEmpty(command.IccId)) { mobile m = new mobile(); m.ICCID = command.IccId; m.phoneNumber = command.PhoneNumber; m.profile = command.VpnProfile.ToString(); if (!String.IsNullOrEmpty(command.ShortNumber)) { m.shortNumber = command.ShortNumber; } tdElements.Item = m; ctd.req.TDelements = tdElements; } return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(ctd.req) }; }
private Dictionary<decimal, GenericCommand> PopulateCommands(CommandSelectionOptions options, OracleConnection con, OracleTransaction tx) { #region Get next command Dictionary<decimal, GenericCommand> commands = new Dictionary<decimal, GenericCommand>(); Dictionary<decimal, MarketingPackage> mps = new Dictionary<decimal, MarketingPackage>(); // create the command object and set attributes using (OracleCommand cmd = new OracleCommand(readerSPName, con, tx)) { //cmd. cmd.CommandType = CommandType.StoredProcedure; #region test parameters OracleCommandBuilder.DeriveParameters(cmd); //foreach (OracleParameter p in cmd.Parameters) //{ // Console.WriteLine(String.Format("Name: {0}, OracleType: {1}", p.ParameterName, p.OracleType)); //} //return null; #endregion //OracleParameter pRefCursor = cmd.Parameters["P_COMMANDS"]; //new OracleParameter("P_COMMANDS", OracleType.Cursor); OracleHelper.AssignOracleParameter2String("P_PARTITIONNAME", options.PartitionName, cmd); OracleHelper.AssignOracleParameter2String("P_BATCHID", options.BatchId, cmd); cmd.Parameters["P_COMMANDTYPE"].Value = options.CommandTypeId; OracleHelper.AssignOracleParameter2String("P_MACHINENAME", options.MachineName, cmd); OracleHelper.AssignOracleParameter2String("P_USERNAME", Environment.UserName, cmd); OracleHelper.AssignOracleParameter2String("P_ACTIVITYID", options.ActivityId, cmd); try { using (IDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { //Console.WriteLine(Convert.ToDecimal(dr["REQ_ID"]) + ":" + dr["Status"]); GenericCommand gCmd = new GenericCommand(); gCmd.ReqId = GetDefaultDecimal(dr, "REQ_ID", true, 0); Trace.CorrelationManager.ActivityId = Guid.NewGuid(); gCmd.CommandType = GetDefaultDecimal(dr, "COMMAND_TYPE", true, 0); gCmd.Priority = GetDefaultDecimal(dr, "PRIORITY", false, 0); Log.TraceData(Log.Source, System.Diagnostics.TraceEventType.Start, CommandMessages.CommandDispatchedFromTheDatabase, String.Format("Command [{0}:{1}](p{2})", gCmd.CommandType, gCmd.ReqId, gCmd.Priority)); gCmd.ReqTime = GetDefaultDate(dr, "REQ_TIME", true, DateTime.Now); gCmd.TisCustomerId = GetDefaultString(dr, "TIS_CUSTOMER_ID", false, String.Empty); gCmd.TisWalletId = GetDefaultString(dr, "TIS_WALLET_ID", false, String.Empty); gCmd.TisTDId = GetDefaultDecimal(dr, "TIS_TD_ID", false, 0); gCmd.CustomerType = GetDefaultString(dr, "CUSTOMER_TYPE", false, String.Empty); gCmd.Name = GetDefaultString(dr, "NAME", false, String.Empty); gCmd.BillingCycle = GetNullableDecimal(dr, "BILLING_CYCLE", false, null); gCmd.TaxGroup = GetDefaultString(dr, "TAX_GROUP", false, String.Empty); gCmd.TDType = GetDefaultDecimal(dr, "TD_TYPE", false, 0); gCmd.MonthlyLimit = GetNullableDecimal(dr, "MONTHLY_LIMIT", false, null); gCmd.IccId = GetDefaultString(dr, "ICCID", false, String.Empty); gCmd.PhoneNumber = GetDefaultString(dr, "PHONE_NUMBER", false, String.Empty); gCmd.BlockReason = GetDefaultString(dr, "BLOCK_REASON", false, null); gCmd.BlockStatus = GetNullableDecimal(dr, "BLOCK_STATUS", false, null); gCmd.VpnProfile = GetDefaultDecimal(dr, "VPN_PROFILE", false, 0); gCmd.ShortNumber = GetDefaultString(dr, "SHORT_NUMBER", false, String.Empty); gCmd.NewPhoneNumber = GetDefaultString(dr, "NEW_PHONE_NUMBER", false, String.Empty); gCmd.NewIccId = GetDefaultString(dr, "NEW_ICCID", false, String.Empty); gCmd.ContractEndDate = GetNullableDate(dr, "CONTRACT_END_DATE", false, null); gCmd.ValidFrom = GetDefaultDate(dr, "VALID_FROM", false, DateTime.MinValue); gCmd.P2P = GetDefaultString(dr, "P2P", false, String.Empty); gCmd.OnetimeLimitAmount = GetDefaultDecimal(dr, "ONETIME_LIMIT_AMOUNT", false, 0); gCmd.Status = GetDefaultString(dr, "STATUS", false, String.Empty); gCmd.TisPosAOId = GetDefaultString(dr, "TIS_POSAO_ID", false, String.Empty); gCmd.ActivityId = options.ActivityId; commands.Add(gCmd.ReqId, gCmd); } // Next result is marketing package instances if (dr.NextResult()) { while (dr.Read()) { //Console.WriteLine(Convert.ToDecimal(dr["REQ_ID"]) + ":mpid:" + Convert.ToDecimal(dr["MP_INSTANCE_ID"])); MarketingPackage mp = new MarketingPackage { ReqId = GetDefaultDecimal(dr, "REQ_ID", true, 0), MPInstanceId = GetDefaultDecimal(dr, "MP_INSTANCE_ID", true, 0), MPId = GetNullableDecimal(dr, "MP_ID", false, null), MPType = GetDefaultString(dr, "MP_TYPE", true, String.Empty) }; commands[mp.ReqId].MarketingPackages.Add(mp); mps.Add(mp.MPInstanceId, mp); } //} // Next result is marketing package parameters if (dr.NextResult()) { while (dr.Read()) { //Console.WriteLine("mpid: " + Convert.ToDecimal(dr["MP_INSTANCE_ID"]) + ":" + dr["PARAM_CODE"]); PackageParameter p = new PackageParameter { ReqId = GetDefaultDecimal(dr, "REQ_ID", true, 0), MPInstanceId = GetDefaultDecimal(dr, "MP_INSTANCE_ID", true, 0), ParamCode = GetDefaultString(dr, "PARAM_CODE", true, String.Empty), ProductCode = GetDefaultString(dr, "PRODUCT_CODE", true, String.Empty), Value = GetDefaultString(dr, "VALUE", false, String.Empty) }; mps[p.MPInstanceId].Parameters.Add(p); } } } stats.Append(String.Format("[{0}/P. {1}/HPP]", GetCommandParameterDecimalValue(cmd, "p_countOfProcessing", 0), GetCommandParameterDecimalValue(cmd, "p_countOfProcessingHP", 0))); return commands; } } finally { //if (pMpsCursor != null) pMpsCursor.Dispose(); //if (pParamsCursor != null) pParamsCursor.Dispose(); } } return commands; #endregion }
public override MessageShim TranslateToShim(GenericCommand command) { Tools.Commands.Implementation.IF1.AddAddonMP.AddAddonMP addon = new AddAddonMP(); req req = new req(); addon.req = req; cid c = new cid(); req.cid = c; c.Item = command.TisCustomerId; c.ItemElementName = ItemChoiceType.TIScustomerId; req.reqId = command.ReqId.ToString(); req.reqTime = command.ReqTime; req.phoneNumber = command.PhoneNumber; req.TISwalletId = command.TisWalletId; if (ErrorTrap.AddAssertion(command.MarketingPackages.Count == 1, "There should be exactly one marketing package in this command.") && ErrorTrap.AddAssertion(command.MarketingPackages[0].MPType.ToUpper() == "ADDON", "One and only ADDON marketing package is allowed and required for this command.")) { MarketingPackage mp = command.MarketingPackages[0]; if (mp.MPId.HasValue) { AddonMP amp = new AddonMP { id = mp.MPId.ToString() }; List<@params> parameters = new List<@params>(); CopyParametersToMarketingPackage(mp, parameters); amp.@params = parameters.ToArray(); req.AddonMP = amp; } else { ErrorTrap.AddAssertion(false, String.Format("Marketing package ID is missing (MP_ID command field is null) External mp_instance_id is {0}.", mp.MPInstanceId)); } } #region Reference code // AddCustomerLevelAddonMPRequest request = // (AddCustomerLevelAddonMPRequest) getTransportObject().get("request"); //AddAddonMP addAddonMP = new AddAddonMP(); //com.telekomsrbija.foris.commandtypes.addaddonmp.Req req = // new com.telekomsrbija.foris.commandtypes.addaddonmp.Req(); //Cid cid = new Cid(); //cid.setTIScustomerId(request.getTisCustomerId()); //req.setCid(cid); //req.setReqId(request.getRequestId().toString()); //req.setReqTime( // BasicConverter.timestampToXMLGregorianCalendar(request.getRequestTime())); ////req.setPhoneNumber(request.getTdElements().getPhoneNumber()); //AddonMP addon = null; //for (MPInstance mpInstance : request.getMarketingPackages()) { // addon = new AddonMP(); // AddonInstance a = (AddonInstance) mpInstance; // addon.setId(new BigInteger(a.getMarketingPackageId().toString())); // for (Param param : a.getParams()) { // com.telekomsrbija.foris.commandtypes.alltypes.Params p = // new com.telekomsrbija.foris.commandtypes.alltypes.Params(); // if (param.getPk().getProductCode().equals("N/A")) // continue; // //if (param.getPk().getProductCode().equals("N/A")) // p.setCode((param.getPk().getParamCode().equals("N/A") // ? "" : param.getPk().getParamCode())); // p.setProductCode(param.getPk().getProductCode()); // p.setValue(param.getValue()); // addon.getParams().add(p); // } //} //req.setAddonMP(addon); //addAddonMP.setReq(req); //out.add("payload", req); //out.add("id", req.getReqId()); //out.add("commandName", "AddAddonCustLevelMP");//addAddonMP.getClass().getSimpleName()); #endregion return new MessageShim { CorrelationId = command.ReqId.ToString(), Text = PrepareAndWrapMessageText(req) }; }