You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Burada Logo CRM Modülünün XAF Projesi içerisinde kullanılması, istenirse Logo CRM XAF modülü kullanılarak bütünüyle ayrı bir uygulama geliştirme adımları anlatılacak.

VT Ayarları

VT Ayarları solution.Web uygulaması altında bulunan Web.config xml dosyasında tutulur. Aşağıdaki örnek bu dosyanın default durumudur. 

Dikey uyarlama projesine Logo CRM VT ayarları set edilmelidir.

Web.config
  </appSettings>
   <connectionStrings>
    <add name="EasyTestConnectionString" connectionString="Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\mssqllocaldb;Initial Catalog=Solution10EasyTest" />
    <add name="ConnectionString" connectionString="Integrated Security=SSPI;Pooling=false;Data Source=DB_SUNUCU;Initial Catalog=LOGOCRM" />
    <!--    
    Use the following connection string to connect to a Jet (Microsoft Access) database that is already created and located in the <application root>/app_data folder. 
    <add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Password=;User ID=Admin;Data Source=|DataDirectory|\Solution7.mdb;Mode=Share Deny None;"/>
    If the database doesn't exist, it won't be created until you replace the |DataDirectory| substitution string with the fully qualified path to the database. For instance:
    <add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Password=;User ID=Admin;Data Source=C:\myDataFolder\Solution7.mdb;Mode=Share Deny None;"/>
    -->
  </connectionStrings>
  <system.diagnostics>

sadece name alanına sahip test iş nesnesi için oluşturulmuş tabloyu görebilirsiniz.

Logo CRM Modul Ekleme

Logo CRM iş nesnelerinin model editorde görünmesi için eklenmesi gerekir.

Çözüm ortağı setindeki logoCRM.Net.Module dll in eklenmesi gerekir

Logo CRM Module dll'i otomatik olarak proje referansına eklenecektir.

LogoCRM'in Module.cs e Eklenmesi

Modules.cs dizaynırı açıkken;

ToolBox tan netModule bileşeni Required Modules alanına sürüklenip bırakılır.

LogoCRM iş nesnesini kullanma

Oluşturduğumuz bir iş nesnesi içinden Logo CRM nesnelerini kullanabiliriz.

iş nesnesi oluştururken new item... dan DevExpress template gallery seçilerek ilerlenir. Açılan Arayüzden XAF tabından XPO Business object seçilmelidir.

Logo CRM Kullanıcı ve Rollerin Kullanılması

Authentication mekanizması seçili olduğu için aşağıdaki ekranda gözüken seçimlerin yapılması gerekir.

Bunun için;

  • WebApplication.cs dizay ekranı açılır.
  • Securit Strategy Complex seçilir.
  • Properties kısmında role ve user tipleri LogoCRM.CT_Role ve ST_User seçilir.

DBUpdate Sınıfının Düzenlenmesi

Burada override edilen metodlar kaldırılmalı. Logo CRM de kullanıcı ve rolleri ile ilgili işlemler yapıldığı için burada yapılması hataya sebep olacaktır.

Controller Eklenmesi

XAF Template Gallery kullanılarak XAF Controller dan View Controller Seçilir.

Controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Layout;
using DevExpress.ExpressApp.Model.NodeGenerators;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Utils;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.Validation;
using Solution10.Module.BusinessObjects;
using logocrm.net.Module.BusinessObjects;

namespace Solution10.Module.Controllers
{
    public partial class Sample_Controller : ViewController
    {
        public Sample_Controller()
        {
            InitializeComponent();
        }
        protected override void OnActivated()
        {
            base.OnActivated();
            ObjectSpace.ObjectChanged += ObjectSpace_ObjectChanged;
        }

        private void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e)
        {
            if (e.PropertyName == "Firma")
            {
                BO_Sample sample = ((BO_Sample)View.CurrentObject);
                if (e.NewValue != null)
                {
                    sample.Name = ((MT_Firm)e.NewValue).FirmTitle + "_"; 
                }
                else
                {
                    sample.Name = "";
                }
                
            }
        }

        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
        }
        protected override void OnDeactivated()
        {
            ObjectSpace.ObjectChanged -= ObjectSpace_ObjectChanged;
            base.OnDeactivated();
        }
    }
}


Business Object setter Getter 

Set/Get ve  ImmediatePostData eklentilerileri yapılır. Controller ve İş nesneleri bütünüyle sunucuda yönetilir.

ImmediatePostData  özelliği ile property değiştiği zaman sunucu tarafındaki kodların çalışmasını sağlar. 

Sample BO Setter Getter
        private MT_Firm firma;   
		[ImmediatePostData]
        public MT_Firm Firma
        {
            get
            {
                return firma;
            }
            set
            {
                SetPropertyValue("Firma", ref firma, value);
            }
        }
Sample BO
using System;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using System.ComponentModel;
using DevExpress.ExpressApp.DC;
using DevExpress.Data.Filtering;
using DevExpress.Persistent.Base;
using System.Collections.Generic;
using DevExpress.ExpressApp.Model;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using logocrm.net.Module.BusinessObjects;

namespace Solution10.Module.BusinessObjects
{

 

    [DefaultClassOptions]
    //[ImageName("BO_Contact")]
    //[DefaultProperty("DisplayMemberNameForLookupEditorsOfThisType")]
    //[DefaultListViewOptions(MasterDetailMode.ListViewOnly, false, NewItemRowPosition.None)]
    //[Persistent("DatabaseTableName")]
    // Specify more UI options using a declarative approach (https://documentation.devexpress.com/#eXpressAppFramework/CustomDocument112701).
    public class BO_Sample : BaseObject
    { // Inherit from a different class to provide a custom primary key, concurrency and deletion behavior, etc. (https://documentation.devexpress.com/eXpressAppFramework/CustomDocument113146.aspx).

        private string name;
        private MT_Firm firma;

        public BO_Sample(Session session)
            : base(session)
        {
        }

        public string Name { get => name; set => name = value; }

        [ImmediatePostData]
        public MT_Firm Firma
        {
            get
            {
                return firma;
            }
            set
            {
                SetPropertyValue("Firma", ref firma, value);
            }
        }

        public override void AfterConstruction()
        {
            base.AfterConstruction();
            // Place your initialization code here (https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112834.aspx).
        }
        //private string _PersistentProperty;
        //[XafDisplayName("My display name"), ToolTip("My hint message")]
        //[ModelDefault("EditMask", "(000)-00"), Index(0), VisibleInListView(false)]
        //[Persistent("DatabaseColumnName"), RuleRequiredField(DefaultContexts.Save)]
        //public string PersistentProperty {
        //    get { return _PersistentProperty; }
        //    set { SetPropertyValue("PersistentProperty", ref _PersistentProperty, value); }
        //}

        //[Action(Caption = "My UI Action", ConfirmationMessage = "Are you sure?", ImageName = "Attention", AutoCommit = true)]
        //public void ActionMethod() {
        //    // Trigger a custom business logic for the current record in the UI (https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112619.aspx).
        //    this.PersistentProperty = "Paid";
        //}
    }
}