Example #1
0
 public void getSageObject()
 {
     if (SageObject == null)
     {
         SageCon          = new SageCRMConnection();
         SageCon.IsPortal = true;
         //change the CRMPortalPath to point to your install
         SageCon.CRMPortalPath        = "http://localhost/Portaldemo/SageCRM/component/";
         SageObject                   = new SageCRMBaseClass();
         SageObject.SageCRMConnection = SageCon;
     }
 }
        public crmEditor(SageCRMBaseListBlock listcomponent, SageCRMBaseEntryBlock entrycomponent, SageCRMBaseFilterBlock filtercomponent, SageCRMTabGroup tabcomponent, SageCRMTopContent topcontentcomponent)
        {
            InitializeComponent();
            this._block = listcomponent;
            string entityname = "";

            if (entrycomponent != null)
            {
                _block             = entrycomponent;
                _sagecrmentryblock = entrycomponent;
                label1.Text        = "Active Screen: " + (_block as SageCRMBaseEntryBlock).EntryBlockName;
                entityname         = (_block as SageCRMBaseEntryBlock).EntityName;
            }
            else
            if (listcomponent != null)
            {
                _block            = listcomponent;
                _sagecrmlistblock = listcomponent;
                label1.Text       = "Active List: " + (_block as SageCRMBaseListBlock).ListBlock;
                entityname        = (_block as SageCRMBaseListBlock).EntityName;
            }
            else
            if (filtercomponent != null)
            {
                _block = filtercomponent;
                _sagecrmfilterblock = filtercomponent;
                label1.Text         = "Active Filter: " + (_block as SageCRMBaseFilterBlock).EntryBlockName;
                entityname          = (_block as SageCRMBaseFilterBlock).EntityName;
            }
            else if (tabcomponent != null)
            {
                _block           = tabcomponent;
                _sagecrmtabgroup = tabcomponent;
                label1.Text      = "Active Tab: " + (_block as SageCRMTabGroup).TabGroupName;
                entityname       = (_block as SageCRMTabGroup).EntityName;
            }
            else if (topcontentcomponent != null)
            {
                _block             = topcontentcomponent;
                _sagecrmtopcontent = topcontentcomponent;
                label1.Text        = "Active Tab: " + (_block as SageCRMTopContent).EntryBlockName;
                entityname         = (_block as SageCRMTopContent).EntityName;
            }
            string _url  = _block.editorURL.ToString();
            Uri    anUri = new Uri(_url);

            textBox1.Text = _url;

            //due to a persistance issue we must first set the context of the entity that we are working on
            string persistance_url   = _block.pathToCRM() + _block.CRMURL("1651") + "MenuName=&BC=Admin,Admin,AdminCustomization,Customization,," + entityname + "&Parent=" + entityname + "&Act2=830";
            Uri    persistance_anUri = new Uri(persistance_url);

            webBrowser1.Url = persistance_anUri;

            //sleep for a second before navigating to the correct entity
            System.Threading.Thread.Sleep(1000);
            webBrowser1.Url = anUri;

            string _url2  = "http://www.crmtogether.com/sage_crm_editor_bar/crmeditor.php";
            Uri    anUri2 = new Uri(_url2);
            // webBrowser2.Url = anUri2;
        }