C# to tell difference between LIVE and Test in E10

Thanks for the info, I really appreciate it!


Tanner

I'm working on a BPM in E10 using C# that outputs documents and e-mails people automatically.  I would like the behavior to change based on being in the live environment versus being in a copied environment (test).


I have looked at using System.Environment.MachineName to determine if it is running in live as opposed to test and also thought about trying to find the database name within the BPM (but they both have downfalls that come to mind).  Is there a standard practice or technique that has proven to work well for others?


Thanks in advance,

Tanner

Standard Practice around here is to re-name your Company
So in Prod your company is My Company
In Test its Test - My Company
etc...





Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Tue, Jul 7, 2015 at 1:30 PM, xevilive11x@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p></p><p><span>I&#39;m working on a BPM in E10 using C# that outputs documents and e-mails people automatically.  I would like the behavior to change based on being in the live environment versus being in a copied environment (test).</span></p><p><span><br></span></p><p><span>I have looked at using System.Environment.MachineName to determine if it is running in live as opposed to test and also thought about trying to find the database name within the BPM (but they both have downfalls that come to mind).  </span>Is there a standard practice or technique that has proven to work well for others?</p><p><span><br></span></p><p><span>Thanks in advance, </span></p><p><span>Tanner</span></p><p></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

Thanks, that helps!



On Tuesday, July 7, 2015 12:40 PM, "Jose Gomez jose@... [vantage]" <vantage@yahoogroups.com> wrote:


 
<div id="ygrps-yiv-745139618yiv5223350766ygrp-text">
  
  
  <div></div><div dir="ltr"><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;">Standard Practice around here is to re-name your Company</div><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;">So in Prod your company is My Company</div><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;">In Test its Test - My Company</div><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;">etc...</div><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;"><br clear="none"></div><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;"><br clear="none"></div><div class="ygrps-yiv-745139618yiv5223350766gmail_default" style="font-family:verdana, sans-serif;font-size:small;"><br clear="none"></div></div><div class="ygrps-yiv-745139618yiv5223350766gmail_extra"><br clear="all"><div><div class="ygrps-yiv-745139618yiv5223350766gmail_signature"><div dir="ltr"><div><font face="verdana, sans-serif"><br clear="none"><font color="#333333"><b>Jose C Gomez</b></font></font></div><div><font color="#666666" face="verdana, sans-serif" size="1"><b>Software Engineer<br clear="none"><br clear="none"></b></font></div><div><font face="verdana, sans-serif"><font><font color="#666666"><b><br clear="none"></b></font><font color="#ff6600" size="1">T: </font></font><font size="1"><span title="Call with Google Voice"><span title="Call with Google Voice">904.469.1524</span></span> mobile</font></font></div><div><font face="verdana, sans-serif" size="1"><font color="#ff6600">E:</font> <a rel="nofollow" target="_blank" href="mailto:jose@..." shape="rect">jose@...</a></font><font face="verdana, sans-serif" size="1"><br clear="none"><a rel="nofollow" target="_blank" href="http://www.josecgomez.com/" shape="rect"><font color="#ff6600">http://www.josecgomez.com</font></a><br clear="none"><a rel="nofollow" style="font-size:small;" target="_blank" href="http://www.linkedin.com/in/josecgomez" shape="rect"><img src="https://ec.yimg.com/ec?url=http%3A%2F%2Fwww.josecgomez.com%2Fimages%2Flinkedin.png&t=1473006748&sig=2sgr1hmgAHHI6BEdJqO2tQ--~C"></a>&nbsp;<a rel="nofollow" style="font-size:small;" target="_blank" href="http://www.facebook.com/josegomez" shape="rect"><img src="https://ec.yimg.com/ec?url=http%3A%2F%2Fwww.josecgomez.com%2Fimages%2Ffacebook.png&t=1473006748&sig=JLXD_wBs8aZp.L1SZbFlRQ--~C"></a>&nbsp;</font><a rel="nofollow" target="_blank" href="http://www.google.com/profiles/jose.gomez" shape="rect"><img src="https://ec.yimg.com/ec?url=http%3A%2F%2Fwww.josecgomez.com%2Fimages%2Fgoogle.png&t=1473006748&sig=8c_bsdQZzzeQYU2GAclCzQ--~C"></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.twitter.com/joc85" shape="rect"><img src="https://ec.yimg.com/ec?url=http%3A%2F%2Fwww.josecgomez.com%2Fimages%2Ftwitter.png&t=1473006748&sig=A8I9FJc5IpXwQ24ZH.jCwQ--~C"></a>&nbsp;<a rel="nofollow" target="_blank" href="http://www.josecgomez.com/professional-resume/" shape="rect"><img src="https://ec.yimg.com/ec?url=http%3A%2F%2Fwww.josecgomez.com%2Fimages%2Fwp.png&t=1473006748&sig=t4m2f3wUglFXzVBmjEfXDA--~C"></a>&nbsp;<span style="font-family:verdana, sans-serif;"><a rel="nofollow" target="_blank" href="http://www.josecgomez.com/feed/" shape="rect"><img src="https://ec.yimg.com/ec?url=http%3A%2F%2Fwww.josecgomez.com%2Fimages%2Frss.png&t=1473006748&sig=mwOzL6xbghI6GsvUSQesbQ--~C"></a>&nbsp;</span></div><div><span lang="LA" style="color:black;"><br clear="none"><font face="Verdana, sans-serif" size="1" style="font-weight:bold;"><i>Quis custodiet

ipsos custodes?


On Tue, Jul 7, 2015 at 1:30 PM, xevilive11x@... [vantage] <vantage@yahoogroups.com> wrote:

 
<div>
  
  
  <div></div><div><span>I&#39;m working on a BPM in E10&nbsp;using C# that outputs documents and e-mails&nbsp;people automatically.&nbsp; I would like the behavior to change based on being in the live environment versus being in a copied environment (test).</span></div><div><span><br clear="none"></span></div><div><span>I have looked at using System.Environment.MachineName to determine if it is running in live as opposed to test and also thought about trying to find the database name within the BPM (but they both have downfalls that come to mind).&nbsp; </span>Is there a standard practice or technique that has proven to work well for others?</div><div><span><br clear="none"></span></div><div><span>Thanks in advance, </span></div><div><span>Tanner</span></div><div></div>

</div>
 


<div style="color:rgb(255, 255, 255);min-height:0px;"></div>

</div>
 


<div style="height:0px;color:rgb(255, 255, 255);"></div></div>
#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766 -- #ygrps-yiv-745139618yiv5223350766ygrp-mkp { border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mkp hr {
border:1px solid #d8d8d8;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mkp #ygrps-yiv-745139618yiv5223350766hd {
color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mkp #ygrps-yiv-745139618yiv5223350766ads {
margin-bottom:10px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mkp .ygrps-yiv-745139618yiv5223350766ad {
padding:0 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mkp .ygrps-yiv-745139618yiv5223350766ad p {
margin:0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mkp .ygrps-yiv-745139618yiv5223350766ad a {
color:#0000ff;text-decoration:none;}
#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-sponsor #ygrps-yiv-745139618yiv5223350766ygrp-lc {
font-family:Arial;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-sponsor #ygrps-yiv-745139618yiv5223350766ygrp-lc #ygrps-yiv-745139618yiv5223350766hd {
margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-sponsor #ygrps-yiv-745139618yiv5223350766ygrp-lc .ygrps-yiv-745139618yiv5223350766ad {
margin-bottom:10px;padding:0 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766actions {
font-family:Verdana;font-size:11px;padding:10px 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766activity {
background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766activity span {
font-weight:700;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766activity span:first-child {
text-transform:uppercase;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766activity span a {
color:#5085b6;text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766activity span span {
color:#ff7900;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766activity span .ygrps-yiv-745139618yiv5223350766underline {
text-decoration:underline;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766attach {
clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766attach div a {
text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766attach img {
border:none;padding-right:5px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766attach label {
display:block;margin-bottom:5px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766attach label a {
text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 blockquote {
margin:0 0 0 4px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766bold {
font-family:Arial;font-size:13px;font-weight:700;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766bold a {
text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 dd.ygrps-yiv-745139618yiv5223350766last p a {
font-family:Verdana;font-weight:700;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 dd.ygrps-yiv-745139618yiv5223350766last p span {
margin-right:10px;font-family:Verdana;font-weight:700;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 dd.ygrps-yiv-745139618yiv5223350766last p span.ygrps-yiv-745139618yiv5223350766yshortcuts {
margin-right:0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766attach-table div div a {
text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766attach-table {
width:400px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766file-title a, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766file-title a:active, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766file-title a:hover, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766file-title a:visited {
text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766photo-title a, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766photo-title a:active, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766photo-title a:hover, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div.ygrps-yiv-745139618yiv5223350766photo-title a:visited {
text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 div#ygrps-yiv-745139618yiv5223350766ygrp-mlmsg #ygrps-yiv-745139618yiv5223350766ygrp-msg p a span.ygrps-yiv-745139618yiv5223350766yshortcuts {
font-family:Verdana;font-size:10px;font-weight:normal;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766green {
color:#628c2a;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766MsoNormal {
margin:0 0 0 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 o {
font-size:0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766photos div {
float:left;width:72px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766photos div div {
border:1px solid #666666;height:62px;overflow:hidden;width:62px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766photos div label {
color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766reco-category {
font-size:77%;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766reco-desc {
font-size:77%;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 .ygrps-yiv-745139618yiv5223350766replbq {
margin:4px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-actbar div a:first-child {
margin-right:2px;padding-right:5px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mlmsg {
font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mlmsg table {
font-size:inherit;font:100%;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mlmsg select, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 input, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 textarea {
font:99% Arial, Helvetica, clean, sans-serif;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mlmsg pre, #ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 code {
font:115% monospace;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mlmsg * {
line-height:1.22em;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-mlmsg #ygrps-yiv-745139618yiv5223350766logo {
padding-bottom:10px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-msg p a {
font-family:Verdana;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-msg p#ygrps-yiv-745139618yiv5223350766attach-count span {
color:#1E66AE;font-weight:700;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-reco #ygrps-yiv-745139618yiv5223350766reco-head {
color:#ff7900;font-weight:700;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-reco {
margin-bottom:20px;padding:0px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-sponsor #ygrps-yiv-745139618yiv5223350766ov li a {
font-size:130%;text-decoration:none;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-sponsor #ygrps-yiv-745139618yiv5223350766ov li {
font-size:77%;list-style-type:square;padding:6px 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-sponsor #ygrps-yiv-745139618yiv5223350766ov ul {
margin:0;padding:0 0 0 8px;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-text {
font-family:Georgia;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-text p {
margin:0 0 1em 0;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-text tt {
font-size:120%;}

#ygrps-yiv-745139618 #ygrps-yiv-745139618yiv5223350766 #ygrps-yiv-745139618yiv5223350766ygrp-vital ul li:last-child {
border-right:none !important;}
#ygrps-yiv-745139618



You can get the session information that contains a string with the server name and db name such as
 "net.tcp://DELLTEST/Epicor10"

Code that we use in the InitializeCustomCode section where we need to have different actions on live vs test

Ice.Core.Session SOSession;
SOSession  = (Ice.Core.Session)SalesOrderForm.Session;
read = WCFServiceSupport.CreateImpl<Ice.Proxy.Lib.BOReaderImpl>((Ice.Core.Session)SalesOrderForm.Session, Ice.Proxy.Lib.BOReaderImpl.UriPath);
string Session = (string)SOSession.AppServer;
if (Session.Contains("TEST"))
{
//set a flag or do whatever
//put in a Call.ContextBPMData variable if needed in a BPM
}

You need to reference assembly Ice.Contracts.Lib.BOReader
and initialize
private Ice.Proxy.Lib.BOReaderImpl read = null;

Dan Sirow
Independent Components Corp.