public void SendConsumptionForecast(long contractId) { Trace.WriteLine("SendConsumptionForecast"); try { DataManager dataMan = new DataManager(); electricityProfile ep = new electricityProfile(); Random rn = new Random(); ContractData contractData = dataMan.GetContractData(contractId); ep.areaId = contractData.AreaId.ToString(); ep.amount = rn.Next(100, 200).ToString(); ep.contractId = contractData.ContractId.ToString(); ep.dateStart = contractData.StartDate; ep.dateEnd = DateTime.Now; ep.fromId = "T1ES1"; //send to first krado ep.toId = "T1RK1"; try { ep.messageId = dataMan.SaveComposedMessage(ep).ToString(); t1rk1Client = new KradoServiceSoapClient(); balanceInvoice bi = t1rk1Client.presumableLoadProfile(ep); this.ReceiveBalanceInvoice(bi); } catch (Exception rk1Exc) { Trace.WriteLine("Error sending consumption forecast to T1RK1: " + rk1Exc.Message); } //send to second krado ep.toId = "T1RK2"; try { ep.messageId = dataMan.SaveComposedMessage(ep).ToString(); t1rk2Client = new ReceiveClient(); string tmp = t1rk2Client.ReceiveCfFromEs("some piparkoogid from T1ES1"); } catch (Exception rk2Exc) { Trace.WriteLine("Error sending consumption forecast to T1RK2: " + rk2Exc.Message); } } catch (Exception scfExc) { Trace.WriteLine("Error sending consumption forecast: " + scfExc.Message); } }
public void NotifyNetworkOwner(long contractId) { Trace.WriteLine("NotifyNetworkOwner: " + contractId.ToString()); try { ContractMessageProducer cmp = new ContractMessageProducer(); contractMessage cMsg = cmp.GetContractMessageNO1(contractId); if (cMsg.messageRecieverParty == "T1NO1") { Trace.WriteLine("Owner is T1NO1"); DataManager dataMan = new DataManager(); cMsg.messageId = dataMan.SaveComposedMessage(cMsg).ToString(); ContractMessageService container = new ContractMessageService(cMsg); t1no1Client = new ContractMessageServicePortTypeClient(); t1no1Client.ContractMessageService(container); Trace.WriteLine("Sent to T1NO1"); } else if (cMsg.messageRecieverParty == "T1NO2") { Trace.WriteLine("Owner is T1NO2"); establishContractRequest cMsgR = new establishContractRequest(); cMsgR.messageType = "L"; cMsgR.messageRecipient = cMsg.messageRecieverParty; cMsgR.sendTime = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'"); cMsgR.messageSender = cMsg.messageSenderParty; cMsgR.ES_edielId = cMsg.messageSenderParty; cMsgR.ES_name = cMsg.ProviderParty.name; cMsgR.ES_registryCode = cMsg.ProviderParty.registryCode; cMsgR.ES_address = cMsg.ProviderParty.address; cMsgR.ES_phone = cMsg.ProviderParty.contactPhone; cMsgR.ES_email = cMsg.ProviderParty.contactEmail; cMsgR.CL_name = cMsg.ClientParty.name; cMsgR.CL_registryCode = cMsg.ClientParty.registryCode; cMsgR.CL_address = cMsg.ClientParty.address; cMsgR.CL_phone = cMsg.ClientParty.contactPhone; cMsgR.CL_email = cMsg.ClientParty.contactEmail; cMsgR.CL_areaId = cMsg.ClientParty.areaId; cMsgR.CL_facilityId = cMsg.ClientParty.facilityId; cMsgR.startDate = cMsg.contractInfo.startDate.ToString("yyyy-MM-dd"); DataManager dataMan = new DataManager(); cMsg.messageId = dataMan.SaveComposedMessage(cMsg).ToString(); cMsgR.messageId = cMsg.messageId; t1no2Client = new T1NO2WSClient("T1NO2WSPort"); string tmp = t1no2Client.establishContract(cMsgR.messageId, cMsgR.messageType, cMsgR.messageRecipient, cMsgR.sendTime, cMsgR.messageSender, cMsgR.ES_edielId, cMsgR.ES_name, cMsgR.ES_registryCode, cMsgR.ES_address, cMsgR.ES_phone, cMsgR.ES_email, cMsgR.CL_name, cMsgR.CL_registryCode, cMsgR.CL_address, cMsgR.CL_phone, cMsgR.CL_email, cMsgR.CL_areaId, cMsgR.CL_facilityId, cMsgR.startDate); Trace.WriteLine("Sent to T1NO2"); } } catch (Exception notifyExc) { Trace.WriteLine("Error notifying NO: " + notifyExc.Message); } }