Esempio n. 1
0
        public CustomerTypes()
            : base()
        {
            InitializeComponent();

            this.toolstripChild = this.toolStripChildForm;
            this.fastListIndex  = this.fastCustomerTypeIndex;

            this.customerTypeAPIs = new CustomerTypeAPIs(CommonNinject.Kernel.Get <ICustomerTypeAPIRepository>());

            this.customerTypeViewModel = CommonNinject.Kernel.Get <CustomerTypeViewModel>();
            this.customerTypeViewModel.PropertyChanged += new PropertyChangedEventHandler(ModelDTO_PropertyChanged);
            this.baseDTO = this.customerTypeViewModel;
        }
Esempio n. 2
0
        protected override void InitializeCommonControlBinding()
        {
            base.InitializeCommonControlBinding();

            this.bindingCode         = this.textexCode.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Code), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingName         = this.textexName.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Name), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingOfficialName = this.textexOfficialName.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.OfficialName), true, DataSourceUpdateMode.OnPropertyChanged);

            this.bindingContactInfo   = this.textexContactInfo.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.ContactInfo), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingVATCode       = this.textexVATCode.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.VATCode), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingTelephone     = this.textexTelephone.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Telephone), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingFacsimile     = this.textexFacsimile.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Facsimile), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingEmail         = this.textexEmail.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Email), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingAttentionName = this.textexAttentionName.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.AttentionName), true, DataSourceUpdateMode.OnPropertyChanged);

            this.bindingBillingAddress  = this.textexBillingAddress.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.BillingAddress), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingShippingAddress = this.textexShippingAddress.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.ShippingAddress), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingRemarks         = this.textexRemarks.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Remarks), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingCaption         = this.labelCaption.DataBindings.Add("Text", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.Caption));

            this.bindingIsCustomer = this.checkIsCustomer.DataBindings.Add("Checked", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.IsCustomer), true, DataSourceUpdateMode.OnPropertyChanged);
            this.bindingIsReceiver = this.checkIsReceiver.DataBindings.Add("Checked", this.customerViewModel, CommonExpressions.PropertyName <CustomerDTO>(p => p.IsReceiver), true, DataSourceUpdateMode.OnPropertyChanged);

            this.IsCustomers = true;
            this.comboIsCustomers.ComboBox.DataSource = new List <OptionBool>()
            {
                new OptionBool()
                {
                    OptionValue = true, OptionDescription = "Show Customers"
                }, new OptionBool()
                {
                    OptionValue = false, OptionDescription = "Show Receivers"
                }
            };
            this.comboIsCustomers.ComboBox.DisplayMember = CommonExpressions.PropertyName <OptionBool>(p => p.OptionDescription);
            this.comboIsCustomers.ComboBox.ValueMember   = CommonExpressions.PropertyName <OptionBool>(p => p.OptionValue);
            this.bindingIsCustomers = this.comboIsCustomers.ComboBox.DataBindings.Add("SelectedValue", this, "IsCustomers", true, DataSourceUpdateMode.OnPropertyChanged);

            CustomerTypeAPIs customerTypeAPIs = new CustomerTypeAPIs(CommonNinject.Kernel.Get <ICustomerTypeAPIRepository>());

            this.combexCustomerTypeID.DataSource    = customerTypeAPIs.GetCustomerTypeBases();
            this.combexCustomerTypeID.DisplayMember = CommonExpressions.PropertyName <CustomerTypeBase>(p => p.Name);
            this.combexCustomerTypeID.ValueMember   = CommonExpressions.PropertyName <CustomerTypeBase>(p => p.CustomerTypeID);
            this.bindingCustomerTypeID = this.combexCustomerTypeID.DataBindings.Add("SelectedValue", this.customerViewModel, CommonExpressions.PropertyName <CustomerViewModel>(p => p.CustomerTypeID), true, DataSourceUpdateMode.OnPropertyChanged);

            CustomerCategoryAPIs customerCategoryAPIs = new CustomerCategoryAPIs(CommonNinject.Kernel.Get <ICustomerCategoryAPIRepository>());

            this.combexCustomerCategoryID.DataSource    = customerCategoryAPIs.GetCustomerCategoryBases();
            this.combexCustomerCategoryID.DisplayMember = CommonExpressions.PropertyName <CustomerCategoryBase>(p => p.Name);
            this.combexCustomerCategoryID.ValueMember   = CommonExpressions.PropertyName <CustomerCategoryBase>(p => p.CustomerCategoryID);
            this.bindingCustomerCategoryID = this.combexCustomerCategoryID.DataBindings.Add("SelectedValue", this.customerViewModel, CommonExpressions.PropertyName <CustomerViewModel>(p => p.CustomerCategoryID), true, DataSourceUpdateMode.OnPropertyChanged);

            TerritoryAPIs territoryAPIs = new TerritoryAPIs(CommonNinject.Kernel.Get <ITerritoryAPIRepository>());

            this.combexTerritoryID.DataSource    = territoryAPIs.GetTerritoryBases();
            this.combexTerritoryID.DisplayMember = CommonExpressions.PropertyName <TerritoryBase>(p => p.Name);
            this.combexTerritoryID.ValueMember   = CommonExpressions.PropertyName <TerritoryBase>(p => p.TerritoryID);
            this.bindingTerritoryID = this.combexTerritoryID.DataBindings.Add("SelectedValue", this.customerViewModel, CommonExpressions.PropertyName <CustomerViewModel>(p => p.TerritoryID), true, DataSourceUpdateMode.OnPropertyChanged);

            EmployeeAPIs employeeAPIs = new EmployeeAPIs(CommonNinject.Kernel.Get <IEmployeeAPIRepository>());

            this.combexSalespersonID.DataSource    = employeeAPIs.GetEmployeeBases(ContextAttributes.User.UserID, (int)this.customerViewModel.NMVNTaskID, (int)GlobalEnums.RoleID.Saleperson);
            this.combexSalespersonID.DisplayMember = CommonExpressions.PropertyName <EmployeeBase>(p => p.Name);
            this.combexSalespersonID.ValueMember   = CommonExpressions.PropertyName <EmployeeBase>(p => p.EmployeeID);
            this.bindingSalespersonID = this.combexSalespersonID.DataBindings.Add("SelectedValue", this.customerViewModel, CommonExpressions.PropertyName <CustomerViewModel>(p => p.SalespersonID), true, DataSourceUpdateMode.OnPropertyChanged);

            this.bindingCode.BindingComplete         += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingName.BindingComplete         += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingOfficialName.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.bindingContactInfo.BindingComplete   += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingVATCode.BindingComplete       += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingTelephone.BindingComplete     += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingFacsimile.BindingComplete     += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingEmail.BindingComplete         += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingAttentionName.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.bindingBillingAddress.BindingComplete  += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingShippingAddress.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingRemarks.BindingComplete         += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingCaption.BindingComplete         += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.bindingIsCustomer.BindingComplete  += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingIsReceiver.BindingComplete  += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingIsCustomers.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.bindingCustomerTypeID.BindingComplete     += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingCustomerCategoryID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingTerritoryID.BindingComplete        += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.bindingSalespersonID.BindingComplete      += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.fastCustomerIndex.AboutToCreateGroups     += fastCustomerIndex_AboutToCreateGroups;

            this.fastCustomerIndex.ShowGroups    = true;
            this.olvInActive.Renderer            = new MappedImageRenderer(new Object[] { false, Resources.Placeholder16 });
            this.naviGroupDetails.ExpandedHeight = this.naviGroupDetails.Size.Height;
        }