private ViewOverrider(SPList spList, SPQuery spQuery, SPUser currentUser)
        {
            SyncType syncType = SyncType.SpList;

            this._syncProvider = new SpSyncProvider(syncType);
            this._camlXmlQuery = CamlXmlView.TryParse <CamlXmlView>(spQuery.ViewXml);
            this._currentUser  = currentUser;
            this._spList       = spList;

            this._head = new HeadList
            {
                Heads = new List <Head>
                {
                    new Head
                    {
                        Position     = "Top",
                        ColumnGroups = new List <ColumnGroup>
                        {
                            new ColumnGroup
                            {
                                Hide = true
                            }
                        }
                    }
                }
            };

            this._sqlFilterString         = this.BuildSqlFilterString();
            this._settingsAllreadyCreated = true;
        }
        public JsonResult SelectListLedgers()
        {
            var headlist = db.LedgerHeads.ToList();

            List <HeadList> Head_list = new List <HeadList>();

            foreach (var item in headlist)
            {
                HeadList hl = new HeadList();
                hl.HeadId   = item.Id;
                hl.HeadName = item.Name;

                var ledger = db.Ledgers.Where(x => x.LedgerGroup.Name != "Cash" && x.LedgerGroup.Name != "Bank" && x.LedgerHeadId == item.Id).ToList();
                hl.accountlist = new List <AccountsList>();
                foreach (var l_item in ledger)
                {
                    AccountsList Ledger = new AccountsList();
                    Ledger.Id   = l_item.Id;
                    Ledger.Name = l_item.Name;
                    hl.accountlist.Add(Ledger);
                }
                Head_list.Add(hl);
            }
            return(Json(Head_list, JsonRequestBehavior.AllowGet));
        }
        private ViewOverrider(SPView spView, SPUser currentUser, HeadList head = null, string sqlFilterString = null)
        {
            this._spView = spView;

            SyncType syncType = SyncType.SpList;

            this._syncProvider = new SpSyncProvider(syncType);
            this._currentUser  = currentUser;

            if (head != null)
            {
                this._head                    = head;
                this._sqlFilterString         = sqlFilterString;
                this._settingsAllreadyCreated = true;
            }
            else
            {
                this._head = new HeadList
                {
                    Heads = new List <Head>
                    {
                        new Head
                        {
                            Position     = "Top",
                            ColumnGroups = new List <ColumnGroup>
                            {
                                new ColumnGroup
                                {
                                    Hide = true
                                }
                            }
                        }
                    },
                    Options = new OptionList
                    {
                        Options = new List <Option>()
                    },
                    RowDisablingRules = new RowDisablingRulesList
                    {
                        DontShowLikeDisabled = true,
                        Rules = new List <Rule>
                        {
                            new Rule
                            {
                                FieldName  = Constants.ColumnSpPrefix + "ID",
                                FieldType  = "Number",
                                Operator   = "GreaterThen",
                                FieldValue = "0"
                            }
                        }
                    }
                };

                this._camlXmlQuery = CamlXmlView.TryParse <CamlXmlView>(spView.SchemaXml);
            }
        }
        /// <summary>
        ///     Позволяет сгенерировать объект настроек <see cref="ViewOverriderSettings" />, на основе объекта
        ///     <see cref="SPView" /> и полльзователя <see cref="SPUser" />.
        /// </summary>
        /// <param name="spView">Объект <see cref="SPView" />, необходим для генерации настроек.</param>
        /// <param name="currentUser">
        ///     Текущий полльзователь, объект <see cref="SPUser" />, используется для расчёта доступа к
        ///     элементам списка.
        /// </param>
        /// <returns>Объект <see cref="ViewOverriderSettings" />.</returns>
        public static ViewOverriderSettings CreateViewSettings(SPView spView, SPUser currentUser)
        {
            ViewOverrider         viewOverrider = new ViewOverrider(spView, currentUser);
            string                sqlFilterString;
            HeadList              gridSettings = viewOverrider.BuildSettings(out sqlFilterString);
            ViewOverriderSettings settings     = new ViewOverriderSettings
            {
                GridSettings = gridSettings,
                SqlFilters   = sqlFilterString
            };

            return(settings);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Empties the task list in session, resets handler
        /// </summary>
        public void ClearSessionTasks()
        {
            if (mUserTasks != null)
            {
                // Simply nullify the properties, so the service state is exactly the same as when before the use
                mUserTasks.WholeList.Clear();
                mUserTasks = null;
            }
            SessionTime = default;

            // Reset state of Handler
            Reset();
        }
Exemplo n.º 6
0
        public ItemSelector(object commonRecords, Type modelType)
        {
            InitializeComponent();
            ml = (HeadList)commonRecords;
            TextChanged += new TextChangeHandler((object sender) =>
            {
                //Prevent forcing changes to other instances of the user control
                if (this == ((ItemSelector)sender))
                {
                   // this.textBox1.Text = string.Empty + this.SelectedId.ID;
                   // this.textBox2.Text = string.Empty + this.SelectedId.ID;
                   // this.comboBox1.SelectedItem = this.SelectedId;
                }
            });

            this.textBox1.TextChanged +=new TextChangedEventHandler(textBox1_TextChanged); 
            //new EditValueChangedEventHandler((object sender, EditValueChangedEventArgs e) =>
            //{
            //    this.Text = textBox1.Text;
            //});
            Binding binding = new Binding();
            //Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Controls:MyUserControl}},Path=MainMenuImageSource
            //binding.RelativeSource = new RelativeSource();
            //binding.RelativeSource.Mode = RelativeSourceMode.FindAncestor;
            //binding.RelativeSource.AncestorType = new 
            //binding.RelativeSource.Mode = RelativeSourceMode.FindAncestor;
            /*binding.ElementName = "dataGrid1";
            binding.Path = new PropertyPath("SelectedItem.Name");
            binding.Mode = BindingMode.TwoWay;
            binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            textBox1.SetBinding(TextBox.TextProperty, binding);
             * */
           // comboBox1.SelectedValuePath = "Head.Name";
            //comboBox1.SelectedItem = "Head.Name";
            //comboBox1.Name="combo";Binding Path=SelectedItem.Company,
            //ElementName=lstPersons, Mode=Default

            comboBox1.ItemsSource = ml;
            comboBox1.DisplayMemberPath="Name";
            comboBox1.SelectedValuePath="ID";
            Binding binding2 = new Binding("ID");
            ///binding.ElementName = "textBox1";
            binding2.Mode = BindingMode.TwoWay;
            comboBox1.SelectedValue = binding2;

            Binding binding3 = new Binding();
            //comboBox1.SelectedValue = binding3;
            BindingExpression be = textBox1.GetBindingExpression(TextBox.TextProperty);

        }
Exemplo n.º 7
0
        /// <summary>
        /// Send new tasks to session
        /// </summary>
        public void UpdateTasks(List <TimeTaskContext> tasks)
        {
            if (mSettingsProvider.HighestPrioritySetAsFirst)
            {
                // Sort descending priority if such setting is enabled
                tasks = tasks.OrderByDescending(x => x.Priority).ToList();
            }

            mUserTasks   = new HeadList <TimeTaskContext>(tasks);
            mCurrentTask = mUserTasks.Head;

            // Check if task list is properly set
            ValidateTasks();
        }
Exemplo n.º 8
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    CastList?.Dispose();
                    LdsList?.Dispose();
                    StartLpList?.Dispose();
                    LpList?.Dispose();
                    HeadList?.Dispose();
                }

                disposedValue = true;
            }
        }