Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            CreateCustomActivityEntity y = new CreateCustomActivityEntity();


            _service = y.CRMConnect("crm8.dynamics.com", "y", "*****@*****.**", "Qwertyuiop12345");
            y.MainM("104.197.61.242", "14344", "sa", "mssql@123", "salesforcedbdump", "Merchant__c_sfdc", "zoom", "_sfdc", _service);
        }
Exemplo n.º 2
0
        public void MainM(string R_SQL_IP, string R_SQL_Port, string R_SQL_UN, string R_SQL_Pass, string R_SQL_DB, string R_SQL_TableName, string R_CRM_TableName, string R_CRM_Suffix, IOrganizationService ServerService)
        {
            SQL_IP        = R_SQL_IP.Trim();
            SQL_Port      = R_SQL_Port.Trim();
            SQL_UN        = R_SQL_UN.Trim();
            SQL_Pass      = R_SQL_Pass.Trim();
            SQL_DB        = R_SQL_DB.Trim();
            SQL_TableName = R_SQL_TableName.Trim();
            CRM_TableName = R_CRM_TableName.Trim();
            CRM_Suffix    = R_CRM_Suffix.Trim();
            _service      = ServerService;
            DataSet DS = new DataSet();


            try
            {
                using (SqlConnection cnn = new SqlConnection("Data Source=" + SQL_IP + "," + SQL_Port + ";user="******";password="******";database=" + SQL_DB + "; "))
                {
                    //Retrive fields ,datatype of fields and maximum length of data.
                    SqlDataAdapter da = new SqlDataAdapter("SELECT column_name as 'Column Name', data_type as 'Data Type',character_maximum_length as 'Max Length' FROM information_schema.columns WHERE table_name = '" + SQL_TableName + "' ; ", cnn);
                    da.Fill(DS, SQL_TableName);
                }
            }
            catch (Exception ex)
            {
                l.Add("SQL_Schema" + ":::" + ex.Message);
            }
            try
            {
                Stopwatch s = new Stopwatch();
                s.Start();

                CreateCustomActivityEntity app = new CreateCustomActivityEntity();
                s.Stop();
                List <string> schema = new List <string>();
                l.Add("Configuration time::" + s.Elapsed);
                s.Reset();
                s.Start();
                schema = app.createCustomEntity(DS, CRM_TableName, CRM_Suffix);
                s.Stop();
                l.Add("Custom Entity Creation Time::" + s.Elapsed);
                s.Reset();
                s.Start();
                l.Add(app.uploadData(DS, CRM_TableName, CRM_Suffix));
                s.Stop();
                l.Add("Data Insertion Time:" + s.Elapsed);
            }
            catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> ex)
            {
                l.Add("ORG_serviceProxysFault:" + ex.Message + ":::" + ex.StackTrace);
            }
            catch (System.TimeoutException ex)
            {
                l.Add("TimeOut:" + ex.Message + "::::" + ex.StackTrace);
            }

            catch (System.Exception ex)
            {
                l.Add("Other:" + ex.Message + "::" + ex.HelpLink);
            }
            // return(l);
        }