2016年6月30日 星期四

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

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




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


protected void Button1_Click(object sender, EventArgs e)

        {

            System.Web.HttpBrowserCapabilities browser = Request.Browser;

            string s = "Browser Capabilities\n"

                + "Type = " + browser.Type + "\n"

                + "Name = " + browser.Browser + "\n"

                + "Version = " + browser.Version + "\n"

                + "Major Version = " + browser.MajorVersion + "\n"

                + "Minor Version = " + browser.MinorVersion + "\n"

                + "Platform = " + browser.Platform + "\n"

                + "Is Beta = " + browser.Beta + "\n"

                + "Is Crawler = " + browser.Crawler + "\n"

                + "Is AOL = " + browser.AOL + "\n"

                + "Is Win16 = " + browser.Win16 + "\n"

                + "Is Win32 = " + browser.Win32 + "\n"

                + "Supports Frames = " + browser.Frames + "\n"

                + "Supports Tables = " + browser.Tables + "\n"

                + "Supports Cookies = " + browser.Cookies + "\n"

                + "Supports VBScript = " + browser.VBScript + "\n"

                + "Supports JavaScript = " +

                    browser.EcmaScriptVersion.ToString() + "\n"

                + "Supports Java Applets = " + browser.JavaApplets + "\n"

                + "Supports ActiveX Controls = " + browser.ActiveXControls

                      + "\n";

            TextBox1.Text = s;

        }

2016年6月29日 星期三

Javascript Window Resize

Javascript Window Resize

<script language="JavaScript" type="text/javascript">
        function changesize() {
            window.resizeTo(800, 600); //指定預開啟的寬度與高度
        }
        window.onload = changesize; //視窗載入時
        window.onresize = changesize; //視窗大小被拉動時
    </script>

2016年6月21日 星期二

CRM2011 Placeholder

CRM2011 Placeholder For IE 10 up




Javascript
function OnLoadForm(){

    document.getElementById("description").placeholder = "Description for opportunity";

    this.LoadCSS("/WebResources/style.css");

}




function LoadCSS(path) {

    var head = document.getElementsByTagName('head')[0];

    var link = document.createElement('link');

    link.rel = 'stylesheet';

    link.type = 'text/css';

    link.href = path;

    link.media = 'all';

    head.appendChild(link);

}


CSS
::-webkit-input-placeholder { /* Chrome/Opera/Safari */

  color: Gray;

}

::-moz-placeholder { /* Firefox 19+ */

  color: Gray;

}

:-ms-input-placeholder { /* IE 10+ */

  color: Gray;

}

:-moz-placeholder { /* Firefox 18- */

  color: Gray;

}

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)



function OnLoadForm(){

    this.LoadCSS("/WebResources/css_form_opportunity.css");

}



function LoadCSS(path) {

    var head = document.getElementsByTagName('head')[0];

    var link = document.createElement('link');

    link.rel = 'stylesheet';

    link.type = 'text/css';

    link.href = path;

    link.media = 'all';

    head.appendChild(link);

}




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

if (context.InputParameters.Contains("OpportunityClose") && context.InputParameters["OpportunityClose"] is Entity)

            {

                #region Throw Exception For Test

                //throw new InvalidPluginExecutionException("PreWinOpportunity - OpportunityCloseWon");

                #endregion



                var entity = (Entity)context.InputParameters["OpportunityClose"];



                if (entity.Attributes.Contains("opportunityid"))

                {

                    var opportunityId = ((EntityReference)entity.Attributes["opportunityid"]).Id;



                    var serviceFactory =

                     (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));



                    // Getting the service from the Organisation Service.

                    IOrganizationService crmService = serviceFactory.CreateOrganizationService(context.UserId);



                    Entity opportunity = crmService.Retrieve("opportunity", opportunityId, new ColumnSet(new string[] { "description" }));

                    if (!opportunity.Contains("description"))

                    {

                        throw new InvalidPluginExecutionException("You must provide a value for description.");

                    }

                    else

                    {

                        //throw new InvalidPluginExecutionException("none");

                    }

                }

                else

                {

                    throw new InvalidPluginExecutionException("none:opportunityid");

                }

            }

            else

            {

                throw new InvalidPluginExecutionException("none:PreWinOpportunity - OpportunityCloseWon");

            }

        }


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