Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.SageCRMEntryItem.EvalCode  = "eWare.Mode =1;";
        this.SageCRMEntryItem.EvalCode += "Group = eWare.GetBlock(\"entrygroup\");";
        this.SageCRMEntryItem.EvalCode += "PersonSearch = eWare.GetBlock(\"entry\");";
        this.SageCRMEntryItem.EvalCode += "PersonSearch.FieldName = \"SearchPerson\";";
        this.SageCRMEntryItem.EvalCode += "PersonSearch.EntryType = 56;";
        this.SageCRMEntryItem.EvalCode += "PersonSearch.LookupFamily = \"Person\";";
        this.SageCRMEntryItem.EvalCode += "Group.AddEntry(PersonSearch);";
        this.SageCRMEntryItem.EvalCode += "Group.DisplayForm=false;";
        this.SageCRMEntryItem.EvalCode += "Response.Write(Group.Execute());";

        // Response.Write(Request.Form.ToString());
        if (Request.Form["SearchPerson"] != null)
        {
            this.Comp_CompanyId = Request.Form["SearchPerson"].ToString();
        }
        if (this.Comp_CompanyId != "")
        {
            SageCRMDataSource1.TableName   = "Person";
            SageCRMDataSource1.WhereClause = getWhereClause();
            SageCRMDataSource1.Parameters.Add("pers_xxxxxxxxxId", getEntityIDFieldValue());
            SageCRMDataSource1.UpdateRecord();
            Response.Redirect(SageCRMTabGroup.CRMURL("entwiz/PeopleList.aspx").ToString() + "&" + getEntityIDField()
                              + "=" + getEntityIDFieldValue());
        }
    }
        public override bool EditComponent(ITypeDescriptorContext context, object component,
                                           IWin32Window owner)
        {
            SageCRMTabGroup block = component as SageCRMTabGroup;

            if (block == null)
            {
                throw new ArgumentException("Component must be a SageCRMTabGroup", "component");
            }
            IServiceProvider        site          = block.Site;
            IComponentChangeService changeservice = null;
            DesignerTransaction     transaction   = null;
            bool changed = false;

            try
            {
                if (site != null)
                {
                    IDesignerHost designerhost = (IDesignerHost)site.GetService(typeof(IDesignerHost));
                    transaction   = designerhost.CreateTransaction("Property Editor");
                    changeservice = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    if (changeservice != null)
                    {
                        try
                        {
                            changeservice.OnComponentChanging(block, null);
                        }
                        catch (CheckoutException ex)
                        {
                            if (ex == CheckoutException.Canceled)
                            {
                                return(false);
                            }
                            throw ex;
                        }
                    }
                }
                try
                {
                    TabPropEditor form = new TabPropEditor(block);
                    form.EntityName   = block.EntityName;
                    form.TabGroupName = block.TabGroupName;
                    if (form.ShowDialog(owner) == DialogResult.OK)
                    {
                        changed = true;
                    }
                }
                finally
                {
                    if (changed && changeservice != null)
                    {
                        changeservice.OnComponentChanged(block, null, null, null);
                    }
                }
            }
            finally
            {
                if (transaction != null)
                {
                    if (changed)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        transaction.Cancel();
                    }
                }
            }
            return(changed);
        }
        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;
        }
Пример #4
0
 public TabPropEditor(SageCRMTabGroup _Block)
 {
     this.Block            = _Block;
     this.connectionObject = this.Block.SageCRMConnection;
     InitializeComponent();
 }