Пример #1
0
        public static void CreateQNConfigList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.QNConfigList,
                Name          = ListsName.English.QNConfigList,
                OnQuickLaunch = true
            };

            helper.AddField(new MultipleLinesTextFieldCreator("Value", "Giá trị")
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml, NumberOfLines = 6
            });

            SPList list = helper.Apply();

            var titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.ShowInEditForm     = false;
            titleField.ShowInViewForms    = false;
            titleField.ShowInListSettings = false;
            titleField.Update();
            list.EnableAttachments = false;
            list.Update();
        }
Пример #2
0
        /// <summary>
        /// Se chua nhung muc tin tuc, vi du: Tin Tinh Uy, Hoi Dong Nhan Dan, Thong tin lanh dao, So ban nghanh, dia phuong, doanh nghiep
        /// </summary>
        /// <param name="web"></param>
        public static void CreateNewsCategoryList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.NewsCategory,
                Name          = ListsName.English.NewsCategory,
                OnQuickLaunch = true
            };

            helper.AddField(new LookupFieldCreator(FieldsName.NewsCategory.English.ParentName, FieldsName.NewsCategory.VietNamese.ParentName)
            {
                LookupList = ListsName.English.NewsCategory, LookupField = FieldsName.NewsCategory.English.Heading
            });

            StringCollection collect1 = new StringCollection();

            collect1.AddRange(new string[] { FieldsName.NewsCategory.FieldValuesDefault.TinTuc, FieldsName.NewsCategory.FieldValuesDefault.DoanhNghiep, FieldsName.NewsCategory.FieldValuesDefault.DuLich, FieldsName.NewsCategory.FieldValuesDefault.TinhUy });
            helper.AddField(new ChoiceFieldCreator(FieldsName.NewsCategory.English.TypeCategory, FieldsName.NewsCategory.VietNamese.TypeCategory)
            {
                Choices = collect1
            });

            helper.AddField(new BooleanFieldCreator(FieldsName.NewsCategory.English.Status, FieldsName.NewsCategory.VietNamese.Status));

            SPList list = helper.Apply();

            var title = list.Fields.GetFieldByInternalName(FieldsName.Title);

            title.Title = FieldsName.NewsCategory.English.Heading;
            title.Update();

            list.EnableAttachments = true;

            list.Update();
        }
Пример #3
0
        public static void CreateVideosList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title            = ListsName.VietNamese.VideosList,
                Name             = ListsName.English.VideosList,
                OnQuickLaunch    = true,
                ListTemplateType = SPListTemplateType.DocumentLibrary
            };

            helper.AddField(new LookupFieldCreator("CatID", "Chuyên mục")
            {
                LookupList = ListsName.English.VideoCatList, LookupField = "Title"
            });
            helper.AddField(new MultipleLinesTextFieldCreator("Description", "Description")
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml, NumberOfLines = 6
            });
            SPList list       = helper.Apply();
            var    titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Required = true;
            titleField.Update();
            list.Update();
        }
Пример #4
0
        public static void CreateAdvList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title            = ListsName.VietNamese.AdvList,
                Name             = ListsName.English.AdvList,
                OnQuickLaunch    = true,
                ListTemplateType = SPListTemplateType.DocumentLibrary
            };

            helper.AddField(new LookupFieldCreator("CustomerID", "Khách hàng")
            {
                LookupList = ListsName.English.CustomerAdvList, LookupField = "Title"
            });
            helper.AddField(new SingleLineTextFieldCreator("Url", "Url"));
            helper.AddField(new NumberFieldCreator("Count", "Số lượt click")
            {
                DefaultValue = "0"
            });
            helper.AddField(new MultipleLinesTextFieldCreator("Description", "Description")
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml, NumberOfLines = 6
            });
            SPList list       = helper.Apply();
            var    titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Required = true;
            titleField.Update();
            list.Update();
        }
Пример #5
0
        public static void CreateContactList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.ContactList,
                Name          = ListsName.English.ContactList,
                OnQuickLaunch = true
            };

            helper.AddField(new SingleLineTextFieldCreator("FullName", "FullName"));
            helper.AddField(new SingleLineTextFieldCreator("Browser", "Browser"));
            helper.AddField(new SingleLineTextFieldCreator("IP", "IP"));
            helper.AddField(new SingleLineTextFieldCreator("Address", "Address"));
            helper.AddField(new SingleLineTextFieldCreator("Mobile", "Mobile"));
            helper.AddField(new MultipleLinesTextFieldCreator("Content", "Content")
            {
                RichText = false, RichTextMode = SPRichTextMode.Compatible, NumberOfLines = 6
            });
            SPList list = helper.Apply();

            var titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Title    = "Tiêu đề";
            titleField.Required = false;
            titleField.Update();
            list.EnableAttachments = false;
            list.Update();
        }
Пример #6
0
        public static void CreateImagesList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title            = ListsName.VietNamese.ImagesList,
                Name             = ListsName.English.ImagesList,
                OnQuickLaunch    = true,
                ListTemplateType = SPListTemplateType.PictureLibrary
            };

            helper.AddField(new LookupFieldCreator("CatID", "Chuyên mục")
            {
                LookupList = ListsName.English.ImageCatList, LookupField = "Title"
            });
            helper.AddField(new LookupFieldCreator("AlbumID", "Album ảnh")
            {
                LookupList = ListsName.English.ImageAlbumList, LookupField = "Title"
            });
            SPList list       = helper.Apply();
            var    titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Required = true;
            titleField.Update();
            list.Update();
        }
Пример #7
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.WebsiteLink,
                Name              = ListsName.InternalName.WebsiteLink,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.WebsiteLink.InternalName.Description, FieldsName.WebsiteLink.DisplayName.Description));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.WebsiteLink.InternalName.Status, FieldsName.WebsiteLink.DisplayName.Status));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.WebsiteLink.InternalName.WebURL, FieldsName.WebsiteLink.DisplayName.WebURL));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.WebsiteLink.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.WebsiteLink.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.ViewFields.Add(FieldsName.WebsiteLink.InternalName.WebURL);
            defaultView.ViewFields.Add(FieldsName.WebsiteLink.InternalName.Status);
            defaultView.Update();
        }
Пример #8
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.VideoLibrary,
                Name              = ListsName.InternalName.VideoLibrary,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.VideoLibrary.InternalName.Description, FieldsName.CategoryList.DisplayName.Description));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.VideoLibrary.InternalName.AlbumId, FieldsName.VideoLibrary.DisplayName.AlbumId));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.VideoLibrary.InternalName.CategoryId, FieldsName.VideoLibrary.DisplayName.CategoryId));
            helper.AddField(new NumberFieldCreator(FieldsName.VideoLibrary.InternalName.Status, FieldsName.VideoLibrary.DisplayName.Status));
            helper.AddField(new NumberFieldCreator(FieldsName.VideoLibrary.InternalName.Order, FieldsName.VideoLibrary.DisplayName.Order));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.VideoLibrary.InternalName.FilePath, FieldsName.VideoLibrary.DisplayName.FilePath));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.VideoLibrary.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.VideoLibrary.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();
        }
Пример #9
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.StatisticsList,
                Name              = ListsName.InternalName.StatisticsList,
                OnQuickLaunch     = false,
                EnableAttachments = false
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.StatisticsList.InternalName.UserBrowser, FieldsName.StatisticsList.DisplayName.UserBrowser));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.StatisticsList.InternalName.UserIP, FieldsName.StatisticsList.DisplayName.UserIP));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.StatisticsList.InternalName.UserUrl, FieldsName.StatisticsList.DisplayName.UserUrl));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.StatisticsList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.StatisticsList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.Query    = "<OrderBy><FieldRef Name='ID' Ascending='FALSE' /></OrderBy>";
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.ViewFields.Add(FieldsName.StatisticsList.InternalName.UserBrowser);
            defaultView.ViewFields.Add(FieldsName.StatisticsList.InternalName.UserIP);
            defaultView.ViewFields.Add(FieldsName.StatisticsList.InternalName.UserUrl);
            defaultView.Update();
        }
Пример #10
0
        public static void CreateDownloadList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title            = ListsName.VietNamese.DownloadList,
                Name             = ListsName.English.DownloadList,
                OnQuickLaunch    = true,
                ListTemplateType = SPListTemplateType.DocumentLibrary
            };

            helper.AddField(new LookupFieldCreator("CatID", "Chuyên mục")
            {
                LookupList = ListsName.English.DownloadCatList, LookupField = "Title"
            });
            StringCollection collect1 = new StringCollection();

            collect1.AddRange(new string[] { "Văn bản", "Tiện ích" });
            helper.AddField(new ChoiceFieldCreator("FileType", "Thể loại")
            {
                Choices = collect1
            });
            helper.AddField(new MultipleLinesTextFieldCreator("Description", "Description")
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml, NumberOfLines = 6
            });
            SPList list       = helper.Apply();
            var    titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Required = true;
            titleField.Update();
            list.Update();
        }
Пример #11
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.SignaturePerson,
                Name              = ListsName.InternalName.SignaturePerson,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.SignaturePerson.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.SignaturePerson.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.Update();
        }
Пример #12
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.CategoryList,
                Name              = ListsName.InternalName.CategoryList,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.CategoryList.InternalName.CategoryID, FieldsName.CategoryList.DisplayName.CategoryID));
            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.CategoryList.InternalName.Description, FieldsName.CategoryList.DisplayName.Description)
            {
                RichText     = true,
                RichTextMode = SPRichTextMode.FullHtml
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.CategoryList.InternalName.ParentID, FieldsName.CategoryList.DisplayName.ParentID));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.CategoryList.InternalName.ParentName, FieldsName.CategoryList.DisplayName.ParentName));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.CategoryList.InternalName.CategoryLevel, FieldsName.CategoryList.DisplayName.CategoryLevel)
            {
                DefaultValue = "1"
            });
            helper.AddField(new ChoiceFieldCreator(FieldsName.CategoryList.InternalName.Type, FieldsName.CategoryList.DisplayName.Type)
            {
                Choices      = { "Tin tức", "Giới thiệu", "Văn bản", "Thư viện ảnh", "Thư viện video", "Tài nguyên", "Thông tin cần biết", "Sơ đồ tổ chức", "Thống kê" },
                DefaultValue = "Tin tức"
            });
            helper.AddField(new ChoiceFieldCreator(FieldsName.CategoryList.InternalName.Status, FieldsName.CategoryList.DisplayName.Status)
            {
                Choices = { "Ẩn", "Hiển thị" }, DefaultValue = "Hiển thị"
            });
            helper.AddField(new ChoiceFieldCreator(FieldsName.CategoryList.InternalName.NewsPossition, FieldsName.CategoryList.DisplayName.NewsPossition)
            {
                Choices = { "--Chọn vị trí--", "Trang chủ - box tin to 1", "Trang chủ - box tin to 2", "Trang chủ - box tin nhỏ 1", "Trang chủ - box tin nhỏ 2", "Trang chủ - box tin nhỏ 3", "Trang chủ - Chuyên mục giải trí" }, DefaultValue = "--Chọn vị trí--"
            });

            helper.AddField(new NumberFieldCreator(FieldsName.CategoryList.InternalName.Order, FieldsName.CategoryList.DisplayName.Order));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.CategoryList.InternalName.ImageDesc, FieldsName.CategoryList.DisplayName.ImageDesc));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.CategoryList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.CategoryList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/CategoryList.ascx");
            //add view
            Utilities.AddStandardView(web, list, "AllCategory", "../../UserControls/CategoryView.ascx", "", 100, true);
        }
Пример #13
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.ResourceLibrary,
                Name              = ListsName.InternalName.ResourceLibrary,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.ResourceLibrary.InternalName.Description, FieldsName.ResourceLibrary.DisplayName.Description)
            {
                RichText     = true,
                RichTextMode = SPRichTextMode.FullHtml
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ResourceLibrary.InternalName.CategoryId, FieldsName.ResourceLibrary.DisplayName.CategoryId));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ResourceLibrary.InternalName.CategoryName, FieldsName.ResourceLibrary.DisplayName.CategoryName));
            helper.AddField(new ChoiceFieldCreator(FieldsName.ResourceLibrary.InternalName.Status, FieldsName.ResourceLibrary.DisplayName.Status)
            {
                Choices = { "Ẩn", "Hiện" }, DefaultValue = "Hiện"
            });
            helper.AddField(new NumberFieldCreator(FieldsName.ResourceLibrary.InternalName.Order, FieldsName.ResourceLibrary.DisplayName.Order));
            helper.AddField(new DateTimeFieldCreator(FieldsName.ResourceLibrary.InternalName.PostedDate, FieldsName.ResourceLibrary.DisplayName.PostedDate));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ResourceLibrary.InternalName.Author, FieldsName.ResourceLibrary.DisplayName.Author));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ResourceLibrary.InternalName.ImgThumb, FieldsName.ResourceLibrary.DisplayName.ImgThumb));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ResourceLibrary.InternalName.FileUrl, FieldsName.ResourceLibrary.DisplayName.FileUrl));
            helper.AddField(new NumberFieldCreator(FieldsName.ResourceLibrary.InternalName.DownloadCount, FieldsName.ResourceLibrary.DisplayName.DownloadCount)
            {
                DefaultValue = "0"
            });
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.ResourceLibrary.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.ResourceLibrary.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/ResourceLibrary.ascx");

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.Query    = "<GroupBy Collapse='TRUE' GroupLimit='50'><FieldRef Name='" + FieldsName.ResourceLibrary.InternalName.CategoryName + "' /></GroupBy>";
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.Update();
        }
Пример #14
0
        public static void CreateNewsRecordsList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.NewsRecord,
                Name          = ListsName.English.NewsRecord,
                OnQuickLaunch = true
            };

            helper.AddField(new NumberFieldCreator(FieldsName.NewsRecord.English.ViewsCount, FieldsName.NewsRecord.VietNamese.ViewsCount));

            helper.AddField(new LookupFieldCreator(FieldsName.NewsRecord.English.CategoryName, FieldsName.NewsRecord.VietNamese.CategoryName)
            {
                LookupList = ListsName.English.NewsCategory, LookupField = FieldsName.NewsCategory.English.Heading, AllowMultipleValues = true
            });

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.NewsRecord.English.ThumbnailImage, FieldsName.NewsRecord.VietNamese.ThumbnailImage));

            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.NewsRecord.English.PublishingPageContent, FieldsName.NewsRecord.VietNamese.PublishingPageContent)
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml
            });

            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.NewsRecord.English.ShortContent, FieldsName.NewsRecord.VietNamese.ShortContent));

            helper.AddField(new BooleanFieldCreator(FieldsName.NewsRecord.English.FocusNews, FieldsName.NewsRecord.VietNamese.FocusNews));

            helper.AddField(new BooleanFieldCreator(FieldsName.NewsRecord.English.ShowInHomePage, FieldsName.NewsRecord.VietNamese.ShowInHomePage));

            helper.AddField(new BooleanFieldCreator(FieldsName.NewsCategory.English.Status, FieldsName.NewsCategory.VietNamese.Status));

            SPList list = helper.Apply();

            var title = list.Fields.GetFieldByInternalName(FieldsName.Title);

            title.Title = FieldsName.NewsRecord.English.Heading;

            //Set readonly field
            var viewscount = list.Fields.GetFieldByInternalName(FieldsName.NewsRecord.English.ViewsCount);

            viewscount.ShowInNewForm  = false;
            viewscount.ShowInEditForm = false;

            title.Update();

            list.EnableAttachments = true;

            list.Update();
        }
Пример #15
0
        public static void CreateImageAlbumList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title            = ListsName.VietNamese.ImageAlbumList,
                Name             = ListsName.English.ImageAlbumList,
                OnQuickLaunch    = true,
                ListTemplateType = SPListTemplateType.PictureLibrary
            };
            SPList list       = helper.Apply();
            var    titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Required = true;
            titleField.Update();
            list.Update();
        }
Пример #16
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.ProfilesList,
                Name              = ListsName.InternalName.ProfilesList,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.ProfilesList.InternalName.Description, FieldsName.ProfilesList.DisplayName.Description)
            {
                RichText     = true,
                RichTextMode = SPRichTextMode.FullHtml
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.CategoryId, FieldsName.ProfilesList.DisplayName.CategoryId));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.CategoryName, FieldsName.ProfilesList.DisplayName.CategoryName));
            helper.AddField(new ChoiceFieldCreator(FieldsName.ProfilesList.InternalName.Status, FieldsName.ProfilesList.DisplayName.Status)
            {
                Choices = { "Ẩn", "Hiện" }, DefaultValue = "Hiện"
            });
            helper.AddField(new NumberFieldCreator(FieldsName.ProfilesList.InternalName.Order, FieldsName.ProfilesList.DisplayName.Order));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.Position, FieldsName.ProfilesList.DisplayName.Position));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.Mobile, FieldsName.ProfilesList.DisplayName.Mobile));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.Education, FieldsName.ProfilesList.DisplayName.Education));
            helper.AddField(new DateTimeFieldCreator(FieldsName.ProfilesList.InternalName.DateOfBirth, FieldsName.ProfilesList.DisplayName.DateOfBirth)
            {
                DisplayFormat = SPDateTimeFieldFormatType.DateOnly
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.Phone, FieldsName.ProfilesList.DisplayName.Phone));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.Specialized, FieldsName.ProfilesList.DisplayName.Specialized));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ProfilesList.InternalName.Email, FieldsName.ProfilesList.DisplayName.Email));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.ProfilesList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.ProfilesList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/ProfilesList.ascx");
            //add view
            Utilities.AddStandardView(web, list, "AllProfiles", "../../UserControls/ProfilesView.ascx", "", 100, true);
        }
Пример #17
0
        public static void CreateDownloadCatList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.DownloadCatList,
                Name          = ListsName.English.DownloadCatList,
                OnQuickLaunch = true
            };

            helper.AddField(new MultipleLinesTextFieldCreator("Description", "Description")
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml, NumberOfLines = 6
            });

            SPList list = helper.Apply();

            list.EnableAttachments = false;
            list.Update();
        }
Пример #18
0
        public static void CreateServiceInfo(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.ServiceInfo,
                Name          = ListsName.English.ServiceInfo,
                OnQuickLaunch = true
            };

            helper.AddField(new SingleLineTextFieldCreator("Description", "Description"));
            helper.AddField(new MultipleLinesTextFieldCreator("Body", "Body")
            {
                RichText = true, RichTextMode = SPRichTextMode.FullHtml, NumberOfLines = 6
            });

            SPList list = helper.Apply();

            list.EnableAttachments = true;
            list.Update();
        }
Пример #19
0
        public static void CreateLinkSite(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.LinkSite,
                Name          = ListsName.English.LinkSite,
                OnQuickLaunch = true
            };

            helper.AddField(new SingleLineTextFieldCreator("Description", "Description"));
            helper.AddField(new SingleLineTextFieldCreator("Url", "Url"));
            helper.AddField(new NumberFieldCreator("Position", "Position")
            {
                Required = true
            });

            SPList list = helper.Apply();

            list.Update();
        }
Пример #20
0
        public static void CreateProductCategory(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.ProductCategory,
                Name          = ListsName.English.ProductCategory,
                OnQuickLaunch = true
            };

            helper.AddField(new NumberFieldCreator(FieldsName.ProductCategory.English.ParentId, FieldsName.ProductCategory.VietNamese.ParentId));
            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.ProductCategory.English.Description, FieldsName.ProductCategory.VietNamese.Description));
            helper.AddField(new BooleanFieldCreator(FieldsName.ProductCategory.English.Status, FieldsName.ProductCategory.VietNamese.Status));

            SPList list       = helper.Apply();
            var    titleField = list.Fields.GetFieldByInternalName(Constants.Title);

            titleField.Required = true;
            titleField.Title    = FieldsName.ProductCategory.VietNamese.Name;
            titleField.Update();
            list.Update();
        }
Пример #21
0
        public static void CreateStatisticsList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.StatisticsList,
                Name          = ListsName.English.StatisticsList,
                OnQuickLaunch = true
            };

            helper.AddField(new SingleLineTextFieldCreator("Url", "Url"));
            helper.AddField(new SingleLineTextFieldCreator("Browser", "Browser"));
            helper.AddField(new SingleLineTextFieldCreator("IP", "IP"));
            helper.AddField(new DateTimeFieldCreator("DateHit", "Ngày tháng"));
            SPList list = helper.Apply();

            var titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Title = "Người truy cập";
            titleField.Update();
            list.EnableAttachments = false;
            list.Update();
        }
Пример #22
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.DisplayName.ExternalNewsLinkList,
                Name          = ListsName.InternalName.ExternalNewsLinkList,
                OnQuickLaunch = false, EnableAttachments = false
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ExternalNewsLink.InternalName.NewsGroup, FieldsName.ExternalNewsLink.DisplayName.NewsGroup));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ExternalNewsLink.InternalName.NewsGroupName, FieldsName.ExternalNewsLink.DisplayName.NewsGroupName));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ExternalNewsLink.InternalName.LinkPath, FieldsName.ExternalNewsLink.DisplayName.LinkPath)
            {
                EnforceUniqueValues = true
            });

            var     list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.ExternalNewsLink.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.ExternalNewsLink.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/ExternalNewsRSS.ascx");

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.Query    = "<GroupBy Collapse='TRUE' GroupLimit='50'><FieldRef Name='" + FieldsName.ExternalNewsLink.InternalName.NewsGroupName + "' /></GroupBy>";
            defaultView.RowLimit = 100;
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.ViewFields.Add(FieldsName.ExternalNewsLink.InternalName.LinkPath);
            defaultView.Update();
        }
Пример #23
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.ImageLibrary,
                Name              = ListsName.InternalName.ImageLibrary,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ImageLibrary.InternalName.Description, FieldsName.CategoryList.DisplayName.Description));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ImageLibrary.InternalName.AlbumId, FieldsName.ImageLibrary.DisplayName.AlbumId));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ImageLibrary.InternalName.CategoryId, FieldsName.ImageLibrary.DisplayName.CategoryId));
            helper.AddField(new ChoiceFieldCreator(FieldsName.ImageLibrary.InternalName.DisplayStatus, FieldsName.ImageLibrary.DisplayName.DisplayStatus)
            {
                Choices = { "Hiển thị", "Ẩn" }, EditFormat = SPChoiceFormatType.RadioButtons
            });
            helper.AddField(new NumberFieldCreator(FieldsName.ImageLibrary.InternalName.Order, FieldsName.ImageLibrary.DisplayName.Order));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.ImageLibrary.InternalName.FilePath, FieldsName.ImageLibrary.DisplayName.FilePath));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.ImageLibrary.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.ImageLibrary.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.Query    = "<OrderBy><FieldRef Name='ID' Ascending='FALSE' /></OrderBy>";
            defaultView.RowLimit = 100;
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.Update();
        }
Пример #24
0
        public static void CreateQNTVList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.QNTVList,
                Name          = ListsName.English.QNTVList,
                OnQuickLaunch = true
            };

            helper.AddField(new MultipleLinesTextFieldCreator("Value", "Embed code")
            {
                RichText = false, RichTextMode = SPRichTextMode.Compatible, NumberOfLines = 6
            });
            helper.AddField(new SingleLineTextFieldCreator("Logo", "Logo url"));
            helper.AddField(new NumberFieldCreator("Position", "Thứ tự"));
            SPList list = helper.Apply();

            var titleField = list.Fields.GetFieldByInternalName("Title");

            titleField.Title = "Tên kênh";
            titleField.Update();
            list.EnableAttachments = false;
            list.Update();
        }
Пример #25
0
        public static void CreateMenuList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title         = ListsName.VietNamese.MenuList,
                Name          = ListsName.English.MenuList,
                OnQuickLaunch = true
            };

            helper.AddField(new SingleLineTextFieldCreator("Description", "Description"));
            helper.AddField(new SingleLineTextFieldCreator("Url", "Url"));
            helper.AddField(new NumberFieldCreator("Position", "Position")
            {
                Required = true
            });
            helper.AddField(new LookupFieldCreator("ParentId", "ParentId")
            {
                LookupList = ListsName.English.MenuList, LookupField = "Title"
            });

            SPList list = helper.Apply();

            list.Update();
        }
Пример #26
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.AdvStatisticList,
                Name              = ListsName.InternalName.AdvStatisticList,
                OnQuickLaunch     = false,
                EnableAttachments = false
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvStatisticList.InternalName.AdvID, FieldsName.AdvStatisticList.DisplayName.AdvID));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvStatisticList.InternalName.UserBrowser, FieldsName.AdvStatisticList.DisplayName.UserBrowser));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvStatisticList.InternalName.UserIP, FieldsName.AdvStatisticList.DisplayName.UserIP));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvStatisticList.InternalName.UserUrl, FieldsName.AdvStatisticList.DisplayName.UserUrl));
            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.AdvStatisticList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.AdvStatisticList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.Query    = "<GroupBy Collapse='TRUE' GroupLimit='50'><FieldRef Name='" + FieldsName.AdvStatisticList.InternalName.Title + "' /></GroupBy>";
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.ViewFields.Add(FieldsName.AdvStatisticList.InternalName.UserBrowser);
            defaultView.ViewFields.Add(FieldsName.AdvStatisticList.InternalName.UserIP);
            defaultView.ViewFields.Add(FieldsName.AdvStatisticList.InternalName.UserUrl);
            defaultView.Update();
        }
Пример #27
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.MenuList,
                Name              = ListsName.InternalName.MenuList,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.MenuList.InternalName.Description, FieldsName.MenuList.DisplayName.Description)
            {
                RichText     = false,
                RichTextMode = SPRichTextMode.Compatible
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.MenuID, FieldsName.MenuList.DisplayName.MenuID));
            helper.AddField(new NumberFieldCreator(FieldsName.MenuList.InternalName.MenuOrder, FieldsName.MenuList.DisplayName.MenuOrder));
            helper.AddField(new NumberFieldCreator(FieldsName.MenuList.InternalName.MenuLevel, FieldsName.MenuList.DisplayName.MenuLevel)
            {
                DefaultValue = "1"
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.ParentID, FieldsName.MenuList.DisplayName.ParentID));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.ParentName, FieldsName.MenuList.DisplayName.ParentName));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.CatID, FieldsName.MenuList.DisplayName.CatID));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.CatName, FieldsName.MenuList.DisplayName.CatName));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.PageName, FieldsName.MenuList.DisplayName.PageName));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.MenuList.InternalName.MenuUrl, FieldsName.MenuList.DisplayName.MenuUrl));

            var choiceField = new ChoiceFieldCreator(FieldsName.MenuList.InternalName.Status, FieldsName.MenuList.DisplayName.Status);

            choiceField.Choices.AddRange(new[] { "Ẩn", "Hiện" });
            choiceField.DefaultValue = "Hiện";
            helper.AddField(choiceField);

            choiceField = new ChoiceFieldCreator(FieldsName.MenuList.InternalName.MenuType, FieldsName.MenuList.DisplayName.MenuType);
            choiceField.Choices.AddRange(new[] { "Link tới chuyên mục", "Đường link xác định" });
            choiceField.DefaultValue = "Link tới chuyên mục";
            helper.AddField(choiceField);

            var choiceFields = new MultipleChoiceFieldCreator(FieldsName.MenuList.InternalName.MenuPosition, FieldsName.MenuList.DisplayName.MenuPosition);

            choiceFields.Choices.AddRange(new[] { "Top menu", "Footer menu", "Đơn vị" });
            helper.AddField(choiceFields);

            choiceField = new ChoiceFieldCreator(FieldsName.MenuList.InternalName.OpenType, FieldsName.MenuList.DisplayName.OpenType);
            choiceField.Choices.AddRange(new[] { "Giữ nguyên cửa sổ hiện tại", "Mở cửa sổ mới" });
            choiceField.DefaultValue = "Giữ nguyên cửa sổ hiện tại";
            helper.AddField(choiceField);

            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetFieldByInternalName(FieldsName.MenuList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.MenuList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/MenuList.ascx");
            //add view
            Utilities.AddStandardView(web, list, "AllMenu", "../../UserControls/MenuView.ascx", "", 100, true);
        }
Пример #28
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.DocumentsList,
                Name              = ListsName.InternalName.DocumentsList,
                OnQuickLaunch     = false,
                EnableAttachments = true
            };

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.DocumentsList.InternalName.DocumentNo, FieldsName.DocumentsList.DisplayName.DocumentNo)
            {
            });

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.DocumentsList.InternalName.CategoryId, FieldsName.DocumentsList.DisplayName.CategoryId));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.DocumentsList.InternalName.CategoryName, FieldsName.DocumentsList.DisplayName.CategoryName));
            helper.AddField(new LookupFieldCreator(FieldsName.DocumentsList.InternalName.DocumentSubject, FieldsName.DocumentsList.DisplayName.DocumentSubject)
            {
                LookupList  = ListsName.InternalName.DocumentSubject,
                LookupField = FieldsName.DocumentSubject.InternalName.Title
            });

            helper.AddField(new LookupFieldCreator(FieldsName.DocumentsList.InternalName.DocumentType, FieldsName.DocumentsList.DisplayName.DocumentType)
            {
                LookupList  = ListsName.InternalName.DocumentType,
                LookupField = FieldsName.DocumentType.InternalName.Title
            });

            helper.AddField(new LookupFieldCreator(FieldsName.DocumentsList.InternalName.PublishPlace, FieldsName.DocumentsList.DisplayName.PublishPlace)
            {
                LookupList  = ListsName.InternalName.PublishPlace,
                LookupField = FieldsName.PublishPlace.InternalName.Title
            });

            helper.AddField(new LookupFieldCreator(FieldsName.DocumentsList.InternalName.SignaturePerson, FieldsName.DocumentsList.DisplayName.SignaturePerson)
            {
                LookupList  = ListsName.InternalName.SignaturePerson,
                LookupField = FieldsName.SignaturePerson.InternalName.Title
            });

            helper.AddField(new DateTimeFieldCreator(FieldsName.DocumentsList.InternalName.EffectedDate, FieldsName.DocumentsList.DisplayName.EffectedDate)
            {
                DisplayFormat = SPDateTimeFieldFormatType.DateOnly
            });

            helper.AddField(new DateTimeFieldCreator(FieldsName.DocumentsList.InternalName.ExpiredDate, FieldsName.DocumentsList.DisplayName.ExpiredDate)
            {
                DisplayFormat = SPDateTimeFieldFormatType.DateOnly
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.DocumentsList.InternalName.FilePath, FieldsName.DocumentsList.DisplayName.FilePath));

            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.DocumentsList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.DocumentsList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/DocumentsList.ascx");

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.Query    = "<GroupBy Collapse='TRUE' GroupLimit='50'><FieldRef Name='" + FieldsName.DocumentsList.InternalName.DocumentType + "' /><FieldRef Name='" + FieldsName.DocumentsList.InternalName.DocumentSubject + "' /></GroupBy>";
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.ViewFields.Add(FieldsName.DocumentsList.InternalName.DocumentNo);
            defaultView.ViewFields.Add(FieldsName.DocumentsList.InternalName.PublishPlace);
            defaultView.ViewFields.Add(FieldsName.DocumentsList.InternalName.SignaturePerson);
            defaultView.ViewFields.Add(FieldsName.DocumentsList.InternalName.EffectedDate);
            defaultView.ViewFields.Add(FieldsName.DocumentsList.InternalName.ExpiredDate);
            defaultView.Update();
        }
Пример #29
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.AdvList,
                Name              = ListsName.InternalName.AdvList,
                OnQuickLaunch     = false,
                EnableAttachments = false
            };

            helper.AddField(new MultipleLinesTextFieldCreator(FieldsName.AdvList.InternalName.Description, FieldsName.AdvList.DisplayName.Description)
            {
                RichText     = false,
                RichTextMode = SPRichTextMode.Compatible
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.AdvID, FieldsName.AdvList.DisplayName.AdvID));

            var choiceField = new ChoiceFieldCreator(FieldsName.AdvList.InternalName.AdvType, FieldsName.AdvList.DisplayName.AdvType);

            choiceField.Choices.AddRange(new[] { "Images", "Flash", "Video" });
            choiceField.DefaultValue = "Images";
            choiceField.Required     = true;
            helper.AddField(choiceField);

            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.AdvFile, FieldsName.AdvList.DisplayName.AdvFile));

            choiceField = new ChoiceFieldCreator(FieldsName.AdvList.InternalName.AdvOpenType, FieldsName.AdvList.DisplayName.AdvOpenType);
            choiceField.Choices.AddRange(new[] { "Giữ nguyên cửa sổ hiện tại", "Mở cửa sổ mới" });
            choiceField.DefaultValue = "Mở cửa sổ mới";
            choiceField.Required     = true;
            helper.AddField(choiceField);

            helper.AddField(new NumberFieldCreator(FieldsName.AdvList.InternalName.AdvClick, FieldsName.AdvList.DisplayName.AdvClick));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.AdvUrl, FieldsName.AdvList.DisplayName.AdvUrl)
            {
                Required = true
            });
            helper.AddField(new NumberFieldCreator(FieldsName.AdvList.InternalName.AdvWidth, FieldsName.AdvList.DisplayName.AdvWidth)
            {
                Required = true
            });
            helper.AddField(new NumberFieldCreator(FieldsName.AdvList.InternalName.AdvHeight, FieldsName.AdvList.DisplayName.AdvHeight)
            {
                Required = true
            });
            helper.AddField(new NumberFieldCreator(FieldsName.AdvList.InternalName.AdvOrder, FieldsName.AdvList.DisplayName.AdvOrder)
            {
                Required = true, DefaultValue = "0"
            });
            helper.AddField(new DateTimeFieldCreator(FieldsName.AdvList.InternalName.AdvStartDate, FieldsName.AdvList.DisplayName.AdvStartDate)
            {
                DisplayFormat = SPDateTimeFieldFormatType.DateTime, Required = true, DefaultValue = "[Today]"
            });
            helper.AddField(new DateTimeFieldCreator(FieldsName.AdvList.InternalName.AdvEndDate, FieldsName.AdvList.DisplayName.AdvEndDate)
            {
                DisplayFormat = SPDateTimeFieldFormatType.DateTime, Required = true, DefaultValue = "[Today]"
            });
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.CustomerName, FieldsName.AdvList.DisplayName.CustomerName));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.CustomerAddress, FieldsName.AdvList.DisplayName.CustomerAddress));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.CustomerPhone, FieldsName.AdvList.DisplayName.CustomerPhone));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.CustomerMobile, FieldsName.AdvList.DisplayName.CustomerMobile));
            helper.AddField(new SingleLineTextFieldCreator(FieldsName.AdvList.InternalName.AdvCat, FieldsName.AdvList.DisplayName.AdvCat));

            choiceField = new ChoiceFieldCreator(FieldsName.AdvList.InternalName.AdvDisplay, FieldsName.AdvList.DisplayName.AdvDisplay);
            choiceField.Choices.AddRange(new[] { "Hiển thị tất cả", "Hiển thị theo chuyên mục" });
            choiceField.DefaultValue = "Hiển thị tất cả";
            choiceField.Required     = true;
            helper.AddField(choiceField);

            choiceField = new ChoiceFieldCreator(FieldsName.AdvList.InternalName.AdvPosition, FieldsName.AdvList.DisplayName.AdvPosition);
            choiceField.Choices.AddRange(new[] { "Trang chủ - bên trái - thứ nhất",
                                                 "Trang chủ - bên trái - thứ 2",
                                                 "Trang chủ - bên trái - thứ 3",
                                                 "Trang chủ - bên trái - thứ 4",
                                                 "Trang chủ - bên trái - thứ 5",
                                                 "Trang chủ - bên trái - thứ 6",
                                                 "Trang chủ - ở giữa",
                                                 "Trang chủ - bên phải",
                                                 "Trang tin - bên phải",
                                                 "Trang tin chi tiết - bên phải",
                                                 "Trang sơ đồ tổ chức - bên phải",
                                                 "Trang thư viện file - bên phải",
                                                 "Trang thư viện chi tiết - bên phải",
                                                 "Trang giới thiệu - bên phải",
                                                 "Trang văn bản - bên phải",
                                                 "Trang thống kê - bên phải" });
            choiceField.DefaultValue = "Trang chủ - bên trái - thứ nhất";
            choiceField.Required     = true;
            helper.AddField(choiceField);

            choiceField = new ChoiceFieldCreator(FieldsName.AdvList.InternalName.AdvStatus, FieldsName.AdvList.DisplayName.AdvStatus);
            choiceField.Choices.AddRange(new[] { "Ẩn", "Hiện" });
            choiceField.DefaultValue = "Hiện";
            choiceField.Required     = true;
            helper.AddField(choiceField);

            SPList  list       = helper.Apply();
            SPField fieldTitle = list.Fields.GetField(FieldsName.AdvList.InternalName.Title);

            if (fieldTitle != null)
            {
                fieldTitle.Title = FieldsName.AdvList.DisplayName.Title;
                fieldTitle.Update();
            }
            list.Update();

            //Add custom usercontrol to form
            Utilities.AddForms(web, list, "../../UserControls/AdvList.ascx");

            var defaultView = list.DefaultView;

            defaultView.ViewFields.DeleteAll();
            defaultView.RowLimit = 100;
            defaultView.Query    = "<GroupBy Collapse='TRUE' GroupLimit='50'><FieldRef Name='" + FieldsName.AdvList.InternalName.AdvPosition + "' /></GroupBy>";
            defaultView.ViewFields.Add(Constants.EditColumn);
            defaultView.ViewFields.Add(Constants.FieldTitleLinkToItem);
            defaultView.ViewFields.Add(FieldsName.AdvList.InternalName.CustomerName);
            defaultView.ViewFields.Add(FieldsName.AdvList.InternalName.AdvUrl);
            defaultView.ViewFields.Add(FieldsName.AdvList.InternalName.AdvStartDate);
            defaultView.ViewFields.Add(FieldsName.AdvList.InternalName.AdvEndDate);
            defaultView.Update();
        }
Пример #30
0
        public static void CreateListStructure(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.NewsImagesList,
                Name              = ListsName.InternalName.NewsImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };

            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.NewsContentImagesList,
                Name              = ListsName.InternalName.NewsContentImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.PictureLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.AllImagesList,
                Name              = ListsName.InternalName.AllImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.PictureLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.VideoImagesList,
                Name              = ListsName.InternalName.VideoImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.AlbumImagesList,
                Name              = ListsName.InternalName.AlbumImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.CategoryImagesList,
                Name              = ListsName.InternalName.CategoryImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.GalleryImagesList,
                Name              = ListsName.InternalName.GalleryImagesList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.AdvFileList,
                Name              = ListsName.InternalName.AdvFileList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };
            helper.Apply();

            helper = new ListHelper(web)
            {
                Title             = ListsName.DisplayName.WeatherList,
                Name              = ListsName.InternalName.WeatherList,
                OnQuickLaunch     = false,
                EnableAttachments = true,
                ListTemplateType  = SPListTemplateType.DocumentLibrary
            };
            helper.Apply();
        }