コード例 #1
0
        public void Setup()
        {
            viewItems.Appearance.EvenRow.BackColor = Properties.Settings.Default.EvenRowBackColor;
            viewItems.Appearance.OddRow.BackColor = Properties.Settings.Default.OddRowBackColor;
            viewItems.Appearance.FocusedRow.BackColor = Properties.Settings.Default.FocusedRowBackColor;

            btnAdd.DataBindings.Add("Enabled", gridItems.EmbeddedNavigator.Buttons.ButtonByButtonType(DevExpress.XtraEditors.NavigatorButtonType.Append), "Enabled");
            btnDelete.DataBindings.Add("Enabled", gridItems.EmbeddedNavigator.Buttons.ButtonByButtonType(DevExpress.XtraEditors.NavigatorButtonType.Remove), "Enabled");

            cboDept.ExceptionHandler.ExceptionEvent += ((ex, extraInfo, terminateApplication) =>
            {
                ErrorDialog.Show(ex, extraInfo, terminateApplication);
            });

            _userDept.ExceptionHandler.ExceptionEvent += ((ex, extraInfo, terminateApplication) =>
            {
                ErrorDialog.Show(ex, extraInfo, terminateApplication);
            });

            _userDept.ChangedEvent += ((sender, e) =>
                {
                    base.FormState = FormStates.Dirty;
                });

            _userDept.ProgressEvent += ((Message, percentageComplete)=>
                {
                    UpdateProgress(Message, percentageComplete);
                });

            lstDepartments.OnChanged += ((sender, e) =>
                {
                    base.FormState = FormStates.Dirty;
                    _userDept.IsDirty = true;
                });

            lstDepartments.OnMoveItem += ((source, target, selectedItems, moveAll) =>
                {
                    var moved = false;
                    var sourceRows = (DataTable)source.DataSource;
                    var targetRows = (DataTable)target.DataSource;

                    if (moveAll)
                    {
                        foreach (DataRow row in sourceRows.Rows)
                            if (row.RowState != DataRowState.Deleted)
                                targetRows.Rows.Add(row.ItemArray);
                        sourceRows.Rows.Clear();
                        moved = true;
                    }
                    else
                    {

                        var temp = new List<DataRow>();

                        foreach (DataRowView item in selectedItems)
                        {
                            temp.Add(item.Row);
                            targetRows.Rows.Add(item.Row.ItemArray);
                        }

                        foreach (DataRow row in temp)
                        {
                            var row1 = sourceRows.Select("ID=" + row["ID"].ToString());
                            if (row1 != null && row1.Length > 0)
                                row1[0].Delete();
                        }

                        moved = true;
                    }

                    return moved;
                });

            // Refresh the IP User Combo
            var lookupSource = new LookupSource();
            lookupSource.ExceptionHandler.ExceptionEvent += ((ex, extraInfo, terminateApplication) =>
                {
                    ErrorDialog.Show(ex, extraInfo, terminateApplication);
                });

            riUSIPPR.DataSource = lookupSource.GetItems(LookupSource.LookupTypes.IPUsers);
        }
コード例 #2
0
ファイル: StoreInfo.cs プロジェクト: jb3622/Serrano
        //------------------------------------------------------------------------------------------
        /// <summary>
        /// Return a datatable of all stores and their description.
        /// </summary>
        /// <returns></returns>
        public List<LookupItem> GetStores()
        {
            var lookup = new LookupSource();
            lookup.ExceptionHandler.ExceptionEvent += ((ex, extraInfo, terminateApplication) =>
                {
                    ExceptionHandler.RaiseException(ex, extraInfo, terminateApplication);
                });

            return lookup.GetItems(LookupSource.LookupTypes.Stores);
        }
コード例 #3
0
ファイル: StowawayStoresForm.cs プロジェクト: jb3622/Jalapeno
        //-----------------------------------------------------------------------------------------
        private void RefreshControls()
        {
            var lookupSource = new LookupSource();
            lookupSource.ExceptionHandler.ExceptionEvent += ((ex, extraInfo, terminateApplication) =>
            {
                ErrorDialog.Show(ex, extraInfo, terminateApplication);
            });

            riStore.DataSource = lookupSource.GetItems(LookupSource.LookupTypes.Stores);

            cboDepartment.WhereClause = string.Format("USUSPR = '{0}'", Session.User.NetworkId.ToUpper());
            cboDepartment.RefreshControl();
            cboStore.RefreshControl();
        }