2016年6月30日 星期四

ASP.NET Web 網頁中偵測瀏覽器類型

 ASP.NET Web 網頁中偵測瀏覽器類型




https://msdn.microsoft.com/zh-tw/library/3yekbd5b(v=vs.100).aspx


  1. protected void Button1_Click(object sender, EventArgs e)
  2.  
  3.         {
  4.  
  5.             System.Web.HttpBrowserCapabilities browser = Request.Browser;
  6.  
  7.             string s = "Browser Capabilities\n"
  8.  
  9.                 + "Type = " + browser.Type + "\n"
  10.  
  11.                 + "Name = " + browser.Browser + "\n"
  12.  
  13.                 + "Version = " + browser.Version + "\n"
  14.  
  15.                 + "Major Version = " + browser.MajorVersion + "\n"
  16.  
  17.                 + "Minor Version = " + browser.MinorVersion + "\n"
  18.  
  19.                 + "Platform = " + browser.Platform + "\n"
  20.  
  21.                 + "Is Beta = " + browser.Beta + "\n"
  22.  
  23.                 + "Is Crawler = " + browser.Crawler + "\n"
  24.  
  25.                 + "Is AOL = " + browser.AOL + "\n"
  26.  
  27.                 + "Is Win16 = " + browser.Win16 + "\n"
  28.  
  29.                 + "Is Win32 = " + browser.Win32 + "\n"
  30.  
  31.                 + "Supports Frames = " + browser.Frames + "\n"
  32.  
  33.                 + "Supports Tables = " + browser.Tables + "\n"
  34.  
  35.                 + "Supports Cookies = " + browser.Cookies + "\n"
  36.  
  37.                 + "Supports VBScript = " + browser.VBScript + "\n"
  38.  
  39.                 + "Supports JavaScript = " +
  40.  
  41.                     browser.EcmaScriptVersion.ToString() + "\n"
  42.  
  43.                 + "Supports Java Applets = " + browser.JavaApplets + "\n"
  44.  
  45.                 + "Supports ActiveX Controls = " + browser.ActiveXControls
  46.  
  47.                       + "\n";
  48.  
  49.             TextBox1.Text = s;
  50.  
  51.         }

2016年6月29日 星期三

Javascript Window Resize

Javascript Window Resize

  1. <script language="JavaScript" type="text/javascript">
  2.  
  3.         function changesize() {
  4.  
  5.             window.resizeTo(800, 600); //指定預開啟的寬度與高度
  6.  
  7.         }
  8.  
  9.         window.onload = changesize; //視窗載入時
  10.  
  11.         window.onresize = changesize; //視窗大小被拉動時
  12.  
  13.     </script>

2016年6月21日 星期二

CRM2011 Placeholder

CRM2011 Placeholder For IE 10 up




Javascript
  1. function OnLoadForm(){
  2.  
  3.     document.getElementById("description").placeholder = "Description for opportunity";
  4.  
  5.     this.LoadCSS("/WebResources/style.css");
  6.  
  7. }
  8.  
  9.  
  10.  
  11.  
  12. function LoadCSS(path) {
  13.  
  14.     var head = document.getElementsByTagName('head')[0];
  15.  
  16.     var link = document.createElement('link');
  17.  
  18.     link.rel = 'stylesheet';
  19.  
  20.     link.type = 'text/css';
  21.  
  22.     link.href = path;
  23.  
  24.     link.media = 'all';
  25.  
  26.     head.appendChild(link);
  27.  
  28. }
  29.  

CSS
  1. ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
  2.  
  3.   color: Gray;
  4.  
  5. }
  6.  
  7. ::-moz-placeholder { /* Firefox 19+ */
  8.  
  9.   color: Gray;
  10.  
  11. }
  12.  
  13. :-ms-input-placeholder { /* IE 10+ */
  14.  
  15.   color: Gray;
  16.  
  17. }
  18.  
  19. :-moz-placeholder { /* Firefox 18- */
  20.  
  21.   color: Gray;
  22.  
  23. }

CRM2011 JavaScript Load up CSS file

CRM2011 JavaScript Load up CSS file



1.Attach the following code to the web resource






2.Add the function to the priority on-change and to form onload (Call the function in an existing onload)



  1. function OnLoadForm(){
  2.  
  3.     this.LoadCSS("/WebResources/css_form_opportunity.css");
  4.  
  5. }
  6.  
  7.  
  8.  
  9. function LoadCSS(path) {
  10.  
  11.     var head = document.getElementsByTagName('head')[0];
  12.  
  13.     var link = document.createElement('link');
  14.  
  15.     link.rel = 'stylesheet';
  16.  
  17.     link.type = 'text/css';
  18.  
  19.     link.href = path;
  20.  
  21.     link.media = 'all';
  22.  
  23.     head.appendChild(link);
  24.  
  25. }
  26.  



2016年6月13日 星期一

CRM2011 PluginRegistration Tool(Update Assembly)

CRM2011 PluginRegistration Tool(Update Assembly)



1.Select Assembly / Update



2. Select /Open DLL


3.Load Assembly / Select existing Assembly or new Assembly / Update Selected Plugins








CRM2011 PluginRegistration Tool(Register New Assembly)

CRM2011 PluginRegistration Tool(Register New Assembly)


1.Register / Register New Assembly




2.Browser/Open DLL 




3.Load Assembly/ Register Selected Plugins




CRM2011 Opportunity Alert Message on Close Won(Plugin)

CRM2011 Opportunity Alert Message on Close Won(Plugin)

PreWinOpportunity.cs

  1. if (context.InputParameters.Contains("OpportunityClose") && context.InputParameters["OpportunityClose"] is Entity)
  2.  
  3.             {
  4.  
  5.                 #region Throw Exception For Test
  6.  
  7.                 //throw new InvalidPluginExecutionException("PreWinOpportunity - OpportunityCloseWon");
  8.  
  9.                 #endregion
  10.  
  11.  
  12.  
  13.                 var entity = (Entity)context.InputParameters["OpportunityClose"];
  14.  
  15.  
  16.  
  17.                 if (entity.Attributes.Contains("opportunityid"))
  18.  
  19.                 {
  20.  
  21.                     var opportunityId = ((EntityReference)entity.Attributes["opportunityid"]).Id;
  22.  
  23.  
  24.  
  25.                     var serviceFactory =
  26.  
  27.                     (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
  28.  
  29.  
  30.  
  31.                     // Getting the service from the Organisation Service.
  32.  
  33.                     IOrganizationService crmService = serviceFactory.CreateOrganizationService(context.UserId);
  34.  
  35.  
  36.  
  37.                     Entity opportunity = crmService.Retrieve("opportunity", opportunityId, new ColumnSet(new string[] { "description" }));
  38.  
  39.                     if (!opportunity.Contains("description"))
  40.  
  41.                     {
  42.  
  43.                         throw new InvalidPluginExecutionException("You must provide a value for description.");
  44.  
  45.                     }
  46.  
  47.                     else
  48.  
  49.                     {
  50.  
  51.                         //throw new InvalidPluginExecutionException("none");
  52.  
  53.                     }
  54.  
  55.                 }
  56.  
  57.                 else
  58.  
  59.                 {
  60.  
  61.                     throw new InvalidPluginExecutionException("none:opportunityid");
  62.  
  63.                 }
  64.  
  65.             }
  66.  
  67.             else
  68.  
  69.             {
  70.  
  71.                 throw new InvalidPluginExecutionException("none:PreWinOpportunity - OpportunityCloseWon");
  72.  
  73.             }
  74.  
  75.         }


PluginRegistration.exe



2016年6月2日 星期四

CRM2011 PluginRegistration Tool(Connect)

CRM2011 PluginRegistration Tool(Connect)

CRM Plugin登錄程式

1.Download Plugin Registration Tool
   https://www.microsoft.com/en-us/download/details.aspx?id=24004

2.Open PluginRegistration.exe
   C:\SDK\bin\PluginRegistration.exe

 


3.Connect CRM Server


4.double click Org Name Open


5. Your Plugins Assembly List