コード例 #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int          id = WS.RequestInt("id");
            TemplateList tl = TemplateListView.GetModelByID(id.ToS());

            tl.TempName        = txt_TempName.Text;
            tl.CutKeywords     = txt_CutKeywords.Text.ToInt32();
            tl.CutTitle        = txt_CutTitle.Text.ToInt32();
            tl.ShowRecordCount = txt_ShowRecordCount.Text.ToInt32();
            tl.TimeFormat      = txt_TimeFormat.Text;
            tl.Content         = txt_Content.Text.Replace("'", "''");;
            tl.ListVar         = txt_Listvar.Text.Replace("'", "''");;
            tl.SysModel        = ddl_SysModel.SelectedValue.ToInt32();
            if (tl.ID > 0)
            {
                TemplateListView.Update(tl);
            }
            else
            {
                tl.GroupID  = 1;
                tl.SysModel = 1;
                TemplateListView.Insert(tl);
            }
            Js.AlertAndGoback("保存成功!");
        }
コード例 #2
0
 private void TemplateListView_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ListViewItem xy = TemplateListView.GetItemAt(e.X, e.Y);
         if (xy != null)
         {
             NewToolStripMenuItem.Enabled    = true;
             EditToolStripMenuItem.Enabled   = true;
             DeleteToolStripMenuItem.Enabled = true;
             ViewToolStripMenuItem1.Enabled  = true;
             Point point = this.PointToClient(TemplateListView.PointToScreen(new Point(e.X, e.Y)));
             this.contextMenuStrip1.Show(this, point);
         }
         else
         {
             NewToolStripMenuItem.Enabled    = true;
             EditToolStripMenuItem.Enabled   = false;
             DeleteToolStripMenuItem.Enabled = false;
             ViewToolStripMenuItem1.Enabled  = false;
             Point point = this.PointToClient(TemplateListView.PointToScreen(new Point(e.X, e.Y)));
             this.contextMenuStrip1.Show(this, point);
         }
     }
 }
コード例 #3
0
 private void RefreshListView()
 {
     TemplateListView.Items.Clear();
     TemplateProperties.GetAllSavedTemplates(out var imagePaths, out var names, out var staffIds, out var iDs);
     for (int i = 0; i < imagePaths.Length; i++)
     {
         TemplateListView.Ekle(imagePaths[i], names[i], staffIds[i], iDs[i]);
     }
 }
コード例 #4
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var selectedItem = (SelectionItem)TemplateListView.Items[TemplateListView.SelectedIndex];
            var id           = int.Parse(selectedItem.Id);

            TemplateListView.Sil(TemplateListView.SelectedItem);
            new TemplateProperties().DeleteTemplateFromDatabase(id);
            DeletedItemIds.Add(id);
        }
コード例 #5
0
        private void LoadTemplates([NotNull] IEnumerable <TemplateHeader> templates)
        {
            Debug.ArgumentNotNull(templates, nameof(templates));

            TemplateListView.ItemsSource = templates;

            _listViewSorter.Resort();
            _view = CollectionViewSource.GetDefaultView(templates) as CollectionView;
            if (_view == null)
            {
                return;
            }

            var groupDescription = new PropertyGroupDescription("Section")
            {
                StringComparison = StringComparison.InvariantCultureIgnoreCase
            };

            var collection = _view.GroupDescriptions;

            if (collection != null)
            {
                collection.Clear();
                collection.Add(groupDescription);
            }

            _view.Filter = delegate(object o)
            {
                var templateHeader = o as TemplateHeader;
                if (templateHeader == null)
                {
                    return(false);
                }

                return(templateHeader.Name.IsFilterMatch(FilterTextBox.Text));
            };

            _view.Refresh();

            TemplateListView.ResizeColumn(NameColumn);

            Loading.Visibility = Visibility.Collapsed;
            Stack.Visibility   = Visibility.Visible;

            var selectedItem = templates.FirstOrDefault(t => t.TemplateId == InitialTemplateId);

            TemplateListView.SelectedItem = selectedItem;
            if (selectedItem != null)
            {
                TemplateListView.ScrollIntoView(selectedItem);
            }
        }
コード例 #6
0
        public void FocusItem([NotNull] ItemId itemId)
        {
            Assert.ArgumentNotNull(itemId, nameof(itemId));

            var templates = TemplateListView.Items.OfType <CheckedTemplateHeader>();

            var result = templates.FirstOrDefault(header => header.TemplateId == itemId);

            TemplateListView.SelectedItem = result;

            if (result != null)
            {
                TemplateListView.ScrollIntoView(result);
            }
        }
コード例 #7
0
        private void LoadTemplates([NotNull] IEnumerable <TemplateHeader> templates)
        {
            Debug.ArgumentNotNull(templates, nameof(templates));

            Templates = templates.Select(t => new CheckedTemplateHeader(t.TemplateUri, t.Name, t.Icon, t.Path, t.Section, t.IsBranch, SelectedItems.Contains(t.TemplateUri.ItemId))).ToList();

            TemplateListView.ItemsSource = Templates;

            listViewSorter.Resort();
            view = CollectionViewSource.GetDefaultView(Templates) as CollectionView;
            if (view == null)
            {
                return;
            }

            var groupDescription = new PropertyGroupDescription("Section")
            {
                StringComparison = StringComparison.InvariantCultureIgnoreCase
            };

            var collection = view.GroupDescriptions;

            if (collection != null)
            {
                collection.Clear();
                collection.Add(groupDescription);
            }

            view.Filter = delegate(object o)
            {
                var templateHeader = o as TemplateHeader;
                return(templateHeader != null && templateHeader.Name.IsFilterMatch(TemplateSelectorFilter.Text));
            };

            view.Refresh();

            TemplateListView.ResizeColumn(NameColumn);

            Loading.Visibility          = Visibility.Collapsed;
            TemplateListView.Visibility = Visibility.Visible;

            var loaded = TemplatesLoaded;

            if (loaded != null)
            {
                loaded(this, EventArgs.Empty);
            }
        }
コード例 #8
0
        protected void LoadInfo()
        {
            ddl_SysModel.DataSource     = TemplateAction.AllSysModel;
            ddl_SysModel.DataTextField  = "ModelName";
            ddl_SysModel.DataValueField = "ID";
            ddl_SysModel.DataBind();

            int          id = WS.RequestInt("id");
            TemplateList tl = TemplateListView.GetModelByID(id.ToS());

            txt_TempName.Text          = tl.TempName;
            txt_CutKeywords.Text       = tl.CutKeywords.ToS();
            txt_CutTitle.Text          = tl.CutTitle.ToS();
            txt_ShowRecordCount.Text   = tl.ShowRecordCount.ToS();
            txt_TimeFormat.Text        = tl.TimeFormat;
            txt_Content.Text           = tl.Content;
            txt_Listvar.Text           = tl.ListVar;
            ddl_SysModel.SelectedValue = tl.SysModel.ToS();
        }
コード例 #9
0
        /// <summary>
        /// 获取列表页面的页数
        /// </summary>
        /// <param name="id"></param>
        protected void GetClassPageCount(int id)
        {
            Class c = ClassView.GetModelByID(id.ToS());
            TemplateList t = TemplateListView.Find(string.Format("SysModel={0}", c.ModelID.ToS()));

            int pagecount = 0;
            switch (c.ModelID)
            {
                case 1:
                    //新闻
                    pagecount = NewsView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 2:
                    //图片
                    pagecount = ImageAlbumView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 3:
                    //问答
                    pagecount = QuestionView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 4:
                    //小说
                    pagecount = BookView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 5:
                    //分类
                    pagecount = InfoView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 6:
                    //影视
                    pagecount = MovieInfoView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                default:
                    pagecount = 0;
                    break;
            }

            Response.Clear();
            Response.Write(pagecount);
        }
コード例 #10
0
        protected void btn_Del_Click(object sender, EventArgs e)
        {
            string ids = WS.RequestString("id");

            TemplateListView.Del(string.Format("id in ({0})", ids));
        }
コード例 #11
0
 protected void BindList()
 {
     rp_list.DataSource = TemplateListView.GetModelList();
     rp_list.DataBind();
 }
コード例 #12
0
        /// <summary>
        /// 获取模版内容
        /// </summary>
        /// <returns></returns>
        protected override string GetTemplateString(int ModelID)
        {
            TemplateList tl = TemplateListView.Find(string.Format("GroupID={0} and SysModel={1}", DefaultGroup.ID.ToS(), ModelID.ToString()));

            return(tl.Content);
        }