Exemplo n.º 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            // int input;

              /* Label1.Text = Convert.ToString(GlobalClass.Sel_ind);
            Label2.Text = GlobalClass.U_n ;
            Label3.Text = GlobalClass.P_w ;*/

               try
            {
               Microsoft.Crm.Sdk.Samples.ServerConnection run = new Microsoft.Crm.Sdk.Samples.ServerConnection();
               Microsoft.Crm.Sdk.Samples.ServerConnection.Configuration con= run.Gettest(GlobalClass.U_n, GlobalClass.P_w, GlobalClass.Sel_ind);
                orgname.Text = con.OrganizationName;

            }
            catch (System.TimeoutException ex)
            {
                Label1.Text = "The application  terminated with an error.";
                Label2.Text = ex.Message;
            }
            catch (System.Exception ex)
            {
                Label1.Text = "The application  terminated with an error.";
                Label2.Text = ex.Message;

            }
        }
Exemplo n.º 2
0
        public bool ProbarConexionCRM()
        {
            Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy        _serviceProxy;
            Microsoft.Xrm.Sdk.IOrganizationService                   _service;
            Microsoft.Crm.Sdk.Samples.ServerConnection.Configuration serverConfig;

            try
            {
                Microsoft.Crm.Sdk.Samples.ServerConnection serverConnect = new Microsoft.Crm.Sdk.Samples.ServerConnection();
                serverConfig = serverConnect.GetServerConfiguration();

                // Connect to the CRM web service using a connection string.
                using (_serviceProxy = new Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy(serverConfig.OrganizationUri, serverConfig.HomeRealmUri, serverConfig.Credentials, serverConfig.DeviceCredentials))
                {
                    _service = (Microsoft.Xrm.Sdk.IOrganizationService)_serviceProxy;
                    return(true);
                }
            }
            // Catch any service fault exceptions that Microsoft Dynamics CRM throws.
            catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
            {
                // You can handle an exception here or pass it back to the calling method.
                throw;
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {

                 Session["username"] =TextBox1.Text;
                 Session["password"]= TextBox2.Text;

                Microsoft.Crm.Sdk.Samples.ServerConnection run = new Microsoft.Crm.Sdk.Samples.ServerConnection();

                Label3.Text = "Login Successful";
                Server.ScriptTimeout = 200;

                DropDownList1.DataSource = run.GetOrganizations(TextBox1.Text, TextBox2.Text);
                DropDownList1.DataBind();

               Label5.Text = "Select Your Organization";

               DropDownList1.Visible = true;

               Button2.Visible = true;
                }
            catch (System.TimeoutException ex)
            {
                Label3.Text = "The application  terminated with an error.";
                Label4.Text = ex.Message;
            }
            catch (System.Exception ex)
            {
                Label3.Text = "The application  terminated with an error.";
                Label4.Text = ex.Message;

            }
            Server.ScriptTimeout = 200;
        }
Exemplo n.º 4
0
        private static void ConexionCRM()
        {
            Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy        _serviceProxy;
            Microsoft.Xrm.Sdk.IOrganizationService                   _service;
            Microsoft.Crm.Sdk.Samples.ServerConnection.Configuration serverConfig;

            try
            {
                Microsoft.Crm.Sdk.Samples.ServerConnection serverConnect = new Microsoft.Crm.Sdk.Samples.ServerConnection();
                serverConfig = serverConnect.GetServerConfiguration();

                CrmServiceClient crmSvc = new CrmServiceClient(new System.Net.NetworkCredential("<UserName>", "<Password>", “ <Domain> ”), AuthenticationType.AD, "<Server>", "<Port>", "<OrgName>", useUniqueInstance: false, useSsl: false, <orgDetail>);

                // Connect to the CRM web service using a connection string.
                using (_serviceProxy = new Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy(serverConfig.OrganizationUri, serverConfig.HomeRealmUri, serverConfig.Credentials, serverConfig.DeviceCredentials))
                {
                    _service = (Microsoft.Xrm.Sdk.IOrganizationService)_serviceProxy;
                    var i = 0;
                }
            }
            // Catch any service fault exceptions that Microsoft Dynamics CRM throws.
            catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
            {
                // You can handle an exception here or pass it back to the calling method.
                throw;
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 5
0
        public void Page_Load(object sender, EventArgs e)
        {
            String user=(String)Session["username"];
            String pass=(String)Session["password"];
            int a=(int)Session["selection"];
               Microsoft.Crm.Sdk.Samples.ServerConnection run = new Microsoft.Crm.Sdk.Samples.ServerConnection();

               GlobalClass.s_conf = run.Gettest(user,pass,a);
               orgname.Text =(String)Session["orgname"];
        }