private void GetCategories(string category) { List <CardsModels> cards = new List <CardsModels>(); using (var connection = new NpgsqlConnection(ConnectionString)) { connection.Open(); using (var command = new NpgsqlCommand($"select * from cards where type='{category}';", connection)) { var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { var card = new CardsModels(); card.Id = reader.GetInt64(0); card.Name = reader.GetString(1); card.Type = reader.GetString(2); card.Image = reader.GetString(4); card.Information = reader.GetString(5); card.Cost = reader.GetInt32(6); cards.Add(card); } } } ViewBag.Type = category; ViewBag.cards = cards; } }
public ActionResult Index(CardsModels model) { if (model == null) { return(Content("")); } AdsCustomizeInfo datas = AdvertisementRenderTools.GetADdata(model); if (datas.AdsDisplayAreaSetInfo == null) { return(Content("")); } Member curUser = Member.Current; long? MemberID = null; if (curUser != null) { MemberID = MemberShipDAO.GetItem(curUser.ID).ID; } ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(model.SiteID, model.AdvertisementMenuID); ViewBag.ImgModelForPC = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceImagesModels>(datas.PCPicture); ViewBag.ImgModelForMobile = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceImagesModels>(datas.MobilePicture); ViewBag.GroupPosition = datas.AdsDisplayAreaSetInfo.GroupPosition ?? string.Empty; ViewBag.PageNo = model.PageNo; ViewBag.MemberID = MemberID; return(View("AdsRenderStyle_" + model.StylesID, datas)); }
public ActionResult Edit(CardsModels model) { if (!ModelState.IsValid) { ViewBag.IsValid = false; return(View(model)); } var strDescriptions = model.Descriptions.ReplaceEnterToBr().TrimTags(); if (strDescriptions == "請填入內文") { model.Descriptions = ""; } DateTime now = DateTime.Now; model.Modifier = MemberDAO.SysCurrent.Id; model.ModifyTime = now; int result = CardsDAO.UpdateTitleAndDescriptions(model.No, model.Title, model.Descriptions); if (result == 0) { ViewBag.EditResult = "儲存發生錯誤"; } else { ViewBag.EditResult = "儲存成功"; } return(View(model)); }
public ActionResult Edit(long siteId, CardsModels model, Captcha captcha) { SitePage curPage = CardsDAO.GetPage(model.No); FormModel item = FormDAO.GetItemFromSourceID(curPage.MenuID); if (item.HasCaptcha) { if (captcha == null || !captcha.Validate()) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.NonAuthoritativeInformation, "驗證碼錯誤")); } } FormItem formItem = FormItemSave(item); SendEmail(curPage.SiteID, item, formItem); ViewBag.CurPage = curPage; ViewBag.FormItem = formItem; ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, formDesignFileDir).TrimEnd('/') + "/"; ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); ViewBag.Int64Convert = new Golbal.Int64Converter(); ViewBag.Exit = true; return(View(item)); }
public static void SetCardInfo(CardsModels card) { SQLData.Database db = new SQLData.Database(WebInfo.Conn); SQLData.TableObject tableObj = db.GetTableObject("Cards"); tableObj.GetDataFromObject(card); string sql = $"Select 1 From Cards Where No = { card.No } AND Lang = '{ card.Lang.Replace("'", "''") }' AND Ver = { card.Ver }"; bool isNew = db.GetFirstValue(sql) == null; if (isNew) { tableObj["Creator"] = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["CreateTime"] = DateTime.Now; tableObj.Insert(); } else { string[] removeFields = { "No", "Lang", "Ver", "Creator", "CreateTime" }; foreach (string field in removeFields) { tableObj.Remove(field); } tableObj["Modifier"] = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["ModifyTime"] = DateTime.Now; SQLData.ParameterCollection keys = new SQLData.ParameterCollection(); keys.Add("@No", card.No); keys.Add("@Lang", card.Lang); keys.Add("@Ver", card.Ver); tableObj.Update(keys); } }
// GET: Footer public ActionResult Index(CardsModels card) { PageCache pageCache = PageCache.GetTempDataPageCache(TempData); ViewBag.SiteID = pageCache.SiteID; SitesModels Msites = SitesDAO.GetInfo(pageCache.SiteID); ViewBag.SitesInfo = Msites; if (Msites.FooterCustomized) { ViewBag.FooterCont = Msites.FooterCont; } else { ViewBag.FooterCont = ""; } ViewBag.Copyright = Msites.Copyright; List <MenusModels> Menus = MenusDAO.GetFrontMenus(pageCache.SiteID); var channel_models = Areas.Backend.Models.DataAccess.SocialSettingDAO.GetItem(pageCache.SiteID); if (channel_models != null && channel_models.IsFooterOpenChannel) { IEnumerable <Areas.Backend.Models.SocialRelationModels> itemList = Areas.Backend.Models.DataAccess.SocialSettingDAO.GetRelationItems(pageCache.SiteID, Areas.Backend.Models.RelationType.Channel); ViewBag.Channels = itemList; } return(View("Style" + card.StylesID, Menus)); }
private string GetCommandForInformationCard(CardsModels cardsModels) { cardsModels.AddedTime = DateTime.Now; using (NpgsqlConnection connection = new NpgsqlConnection(ConnectionString)) { connection.Open(); NpgsqlCommand command = new NpgsqlCommand("select count(*) from public.cards", connection); var reader = command.ExecuteReader(); while (reader.Read()) { cardsModels.Id = reader.GetInt64(0); cardsModels.Id++; } connection.Close(); } HttpPostedFileBase upload = cardsModels.Upload; if (upload != null) { UploadImage(upload, cardsModels.Id); } Session["Type"] = cardsModels.Type; var cmd = $"INSERT INTO cards(Name, Type, Image, AddedTime, Cost, information, averagemark, Id) VALUES ('{cardsModels.Name}', '{cardsModels.Type}', '{cardsModels.Image}'" + $", '{cardsModels.AddedTime}', {cardsModels.Cost}, '{cardsModels.Information}', 10, {cardsModels.Id})"; return(cmd); }
public void Copy(long siteId, long menuId, long[] ArticleIds, long TargetMenuID) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.ActionType = "copy"; if (ArticleIds.Length == 0) { return; } var targetMenu = MenusDAO.GetInfo(TargetMenuID); foreach (long ArticleId in ArticleIds) { ArticleModels articleItem = ArticleDAO.GetItem(ArticleId); CardsModels cardItem = CardsDAO.GetByNo(articleItem.CardNo); ZonesModels zoneItem = ZonesDAO.GetByNo(cardItem.ZoneNo.Value); PagesModels pageItem = PagesDAO.GetPageInfo(zoneItem.PageNo); long newCardNo = WorkV3.Golbal.PubFunc.CopyPage(pageItem, targetMenu.SiteID, targetMenu.ID); long newArticleId = WorkLib.GetItem.NewSN(); bool IsForceRelative = false; if (pageItem.SiteID == targetMenu.SiteID && pageItem.MenuID == targetMenu.ID) { IsForceRelative = true; } ArticleDAO.CopyArticle(ArticleId, newArticleId, newCardNo, targetMenu.ID, targetMenu.SiteID, IsForceRelative); WorkV3.Golbal.PubFunc.CopyIcon(articleItem.Icon, siteId, menuId, targetMenu.SiteID, targetMenu.ID); WorkV3.Golbal.PubFunc.CopyParagraphPhotos(articleItem.ID, siteId, menuId, targetMenu.SiteID, targetMenu.ID); } }
/// <summary> /// 為一個主頁面增加相關的 Page、Zone、Card 信息 /// </summary> /// <param name="sourcePage">原始頁面</param> /// <param name="targetSiteId">站點 ID</param> /// <param name="targetMenuId">選單 ID</param> /// <returns>返回 CardID</returns> public static long CopyPage(PagesModels sourcePage, long targetSiteId, long targetMenuId) { long CardNO = 0; long PageNo = WorkLib.GetItem.NewSN(); var sourceMnu = WorkV3.Models.DataAccess.MenusDAO.GetInfo(sourcePage.SiteID, sourcePage.MenuID); var targetMnu = WorkV3.Models.DataAccess.MenusDAO.GetInfo(targetSiteId, targetMenuId); PagesModels newPage = new PagesModels { No = PageNo, SiteID = targetSiteId, MenuID = targetMenuId, SN = targetMnu.SN, Title = sourcePage.Title + "- (複製)" }; newPage.SN += "_" + newPage.No; //WorkLib.WriteLog.Write(true, "newPage.No:" + newPage.No.ToString()+"/"+ newPage.Title); SysLog.SaveLog(SysActions.Add, SysMgrNo.Page, newPage.Title, targetSiteId, targetMenuId, PageNo); PagesDAO.SetPageInfo(newPage); var sourceZones = WorkV3.Models.DataAccess.ZonesDAO.GetPageData(sourcePage.SiteID, sourcePage.No); foreach (WorkV3.Models.ZonesModels sourceZone in sourceZones) { ZonesModels newZone = new ZonesModels { No = WorkLib.GetItem.NewSN(), SiteID = targetSiteId, PageNo = newPage.No, StyleID = sourceZone.StyleID, Sort = sourceZone.Sort, ShowStatus = sourceZone.ShowStatus }; ZonesDAO.SetZoneInfo(newZone); var sourceCards = WorkV3.Models.DataAccess.CardsDAO.GetZoneData(sourceZone.SiteID, sourceZone.No); foreach (WorkV3.Models.CardsModels sourceCard in sourceCards) { CardsModels newCard = new CardsModels { No = WorkLib.GetItem.NewSN(), ZoneNo = newZone.No, CardsType = sourceCard.CardsType, ViewAction = sourceCard.ViewAction, Status = sourceCard.Status, StylesID = sourceCard.StylesID }; CardsDAO.SetCardInfo(newCard); if (newCard.CardsType == "Article" || newCard.CardsType == "Event") { CardNO = newCard.No; } } } return(CardNO); }
public ActionResult AddNewType(CardsModels model) { ViewBag.Message = "Успешно!"; AddNewType(model.Type, model.SpecialName); ((List <CategoryModels>)Session["Categories"]).Add(new CategoryModels { Type = model.Type }); GetTypes(); return(View()); }
public ActionResult Index(CardsModels model) { PageCache pageCache = PageCache.GetTempDataPageCache(TempData); var datas = ImageTextDAO.Get(model.No, true); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(pageCache.SiteID, pageCache.MenuID); int styleId = model.StylesID; return(View("Style" + styleId, datas)); }
public ActionResult AddNewCard(CardsModels cardsModels) { Thread.Sleep(5); GetTypes(); if (ModelState.IsValid) { Session["cmd"] = GetCommandForInformationCard(cardsModels); return(Redirect($"/AddInformation/{cardsModels.Type}")); } return(View()); }
public ActionResult AddMode(long SiteID, long MenuID, long PageNo, string DataType, string ZoneSN) { List <CardsTypeModels> CList = CardsTypeDAO.GetData(); ViewBag.CardsTypeList = CList.Where(dr => dr.isIndexCards).ToList(); if (string.IsNullOrEmpty(DataType)) { return(new HttpNotFoundResult()); } var selectCardsType = CList.Where(dr => dr.isIndexCards && dr.Code == DataType); if (selectCardsType == null || selectCardsType.Count() <= 0) { return(new HttpNotFoundResult()); } var zoneModels = WorkV3.Models.DataAccess.ZonesDAO.GetPageData(SiteID, PageNo); WorkV3.Areas.Backend.Models.ZonesModels zModel = new ZonesModels(); zModel.No = WorkLib.GetItem.NewSN(); zModel.Ver = 1; zModel.SiteID = SiteID; zModel.PageNo = PageNo; zModel.SN = ZoneSN; zModel.Sort = Convert.ToByte(zoneModels.Count - 1 < 0 ? 1 : zoneModels.Count); zModel.StyleID = 1; zModel.Creator = MemberDAO.SysCurrent.Id; zModel.CreateTime = DateTime.Now; WorkV3.Areas.Backend.Models.CardsModels cModel = new CardsModels(); cModel.No = WorkLib.GetItem.NewSN(); cModel.Lang = "zh-Hant"; cModel.Ver = 1; cModel.ZoneNo = zModel.No; cModel.SN = selectCardsType.First().Code; //cModel.Title = ZoneSN; cModel.Title = selectCardsType.First().Title; cModel.CardsType = selectCardsType.First().Code; cModel.StylesID = 1; cModel.Status = 1; cModel.Creator = MemberDAO.SysCurrent.Id; cModel.CreateTime = DateTime.Now; WorkV3.Areas.Backend.Models.DataAccess.ZonesDAO.SetZoneInfo(zModel); WorkV3.Areas.Backend.Models.DataAccess.CardsDAO.SetCardInfo(cModel); TempData["refreshData"] = 1; ViewBag.SiteID = SiteID; ViewBag.MenuID = MenuID; ViewBag.PageID = PageNo; ViewBag.DefaultZoneName = GetDefaultSN(SiteID, PageNo); return(View()); //Response.Redirect(Request.RawUrl); }
public ActionResult Index() { var Data = new List <CardsModels>(); var Caterogies = new List <CategoryModels>(); using (var connection = new NpgsqlConnection(ConnectionString)) { connection.Open(); using (var command = new NpgsqlCommand("select * from cards order by addedtime desc limit(3);", connection)) { var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { var card = new CardsModels(); card.Id = reader.GetInt64(0); card.Name = reader.GetString(1); card.Type = reader.GetString(2); card.Image = reader.GetString(4); card.Information = reader.GetString(5); card.Cost = reader.GetInt32(6); Data.Add(card); } } } ViewBag.Cards = Data; } using (var connection = new NpgsqlConnection(ConnectionString)) { connection.Open(); using (var command = new NpgsqlCommand("select distinct type from cards;", connection)) { var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { Caterogies.Add(new CategoryModels { Type = reader.GetString(0) }); } } ViewBag.Categories = Caterogies; } } return(View()); }
// GET: Header public ActionResult Index(CardsModels model) { WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.SiteID = curPage.SiteID; List <MenusModels> Menus = Models.DataAccess.MenusDAO.GetFrontMenus(curPage.SiteID); SitesModels SitesInfo = SitesDAO.GetInfo(curPage.SiteID); WorkV3.Areas.Backend.Models.DataAccess.KeywordDAO keywordDao = new Areas.Backend.Models.DataAccess.KeywordDAO(); // neil 20180331 新增關鍵字搜尋 ViewBag.SitesInfo = SitesInfo; #region WebLang List <SiteLangMenuModel> SiteLang = new List <SiteLangMenuModel>(); if (uCheck.IsNumeric(curPage.SiteID)) { if (SitesInfo.IsLang)//有開放再抓語言別資料 { SiteLang = SiteLangMenuDAO.GetDatas(curPage.SiteID); } } ViewBag.SiteLang = SiteLang; #endregion #region Socal List <SitesModels.socialSettingCont> social = new List <SitesModels.socialSettingCont>(); if (SitesInfo != null) { if (!string.IsNullOrEmpty(SitesInfo.socialSetting)) { social = JsonConvert.DeserializeObject <List <SitesModels.socialSettingCont> >(SitesInfo.socialSetting); } } ViewBag.social = social; #endregion #region 會員功能機制 Areas.Backend.Models.MemberShipRegSetModels MemberSetModel = Areas.Backend.Models.DataAccess.MemberShipRegSetDAO.GetItem(model.SiteID); bool IsEnabledMember = false; if (MemberSetModel != null) { IsEnabledMember = MemberSetModel.IsOpenReg; } ViewBag.IsEnabledMember = IsEnabledMember; #endregion ViewBag.SearchPage = SearchResultDAO.GetSearchPage(curPage.SiteID); ViewBag.VPath = WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, "Header"); ViewBag.VMemberPath = WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, "Member"); ViewBag.Keywords = keywordDao.GetAllKeywords(true); ViewBag.VMenuPath = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, "Menus"); int style = model.StylesID; return(View("Style" + style, Menus)); }
public ActionResult Index(CardsModels model) { var data = PlainTextDAO.Get(model.No, true); if (data == null) { return(null); } int style = model.StylesID; return(View("Style" + style, data)); }
public ActionResult Edit(CardsModels model) { SitePage curPage = CardsDAO.GetPage(model.No); ViewBag.CurPage = curPage; FormModel item = FormDAO.GetItemFromSourceID(curPage.MenuID); ViewBag.UploadDesignUrl = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, formDesignFileDir).TrimEnd('/') + "/"; ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); ViewBag.Int64Convert = new Golbal.Int64Converter(); return(View(item)); }
public ActionResult Index(CardsModels model) { // 注意:CardsModels 中的 MenuID 是無效的 long menuId = CardsDAO.GetMenuID(model.No); ArticleIntroModels intro = ArticleIntroDAO.GetItem(model.No); ViewBag.SiteID = model.SiteID; ViewBag.MenuID = menuId; ViewBag.Style = model.StylesID == 0 ? 1 : model.StylesID; return(View(intro)); }
private void Find(string request) { List <long> idsToOutput = new List <long>(); using (var connection = new NpgsqlConnection(ConnectionString)) { var cmd = new NpgsqlCommand($"SELECT id, name, word_similarity(name, '{request}') as wsm " + $"FROM cards WHERE(word_similarity(name, '{request}')::numeric > 0.2) " + $"ORDER BY wsm DESC, name, wsm; ", connection); connection.Open(); var reader = cmd.ExecuteReader(); while (reader.Read()) { if (reader.HasRows) { idsToOutput.Add(reader.GetInt64(0)); } } connection.Close(); } List <CardsModels> cards = new List <CardsModels>(); var card = new CardsModels(); using (var connection = new NpgsqlConnection(ConnectionString)) { connection.Open(); using (var command = new NpgsqlCommand(GetSelectStringForSearch(idsToOutput), connection)) { var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { card.Id = reader.GetInt64(0); card.Name = reader.GetString(1); card.Type = reader.GetString(2); card.Image = reader.GetString(4); card.Information = reader.GetString(5); card.Cost = reader.GetInt32(6); cards.Add(card); card = new CardsModels(); } } } connection.Close(); } ViewBag.Cards = cards; }
public ActionResult Index(CardsModels model) { WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); ViewBag.SitePage = curPage; var data = MainVisionDAO.Get(model.No, true); if (data.Count == 0) { return(null); } return(View("Style" + model.StylesID, data)); }
public ActionResult Index(CardsModels model) { ArticleSetModels setting = ArticleSetDAO.GetItem(model.No); ViewBag.Setting = setting; IEnumerable <ArticleModels> items = ArticleDAO.GetItems(setting); ViewBag.ItemPages = CardsDAO.GetPages(items.Select(item => item.CardNo)); ViewBag.ItemTypes = ArticleDAO.GetItemTypes(items.Select(item => item.ID)); ViewBag.SiteID = model.SiteID; int style = model.StylesID == 0 ? 1 : model.StylesID; // style = 3; return(View("Style" + style, items)); }
public ActionResult Index(CardsModels model) { var datas = ParallaxDAO.Get(model.No, true); if (datas.Count == 0) { return(null); } int index = new Random().Next(datas.Count); var data = datas[index]; WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); ViewBag.ImgSrc = JsonConvert.DeserializeObject <ImageModel>(data.Img).Img; return(View(data)); }
/// <summary> /// 設定右側廣告Card /// </summary> /// <param name="datas"></param> /// <param name="item"></param> /// <param name="Position"></param> private void SetRightSideAdCard(List <ZonesModels> datas, AdvertisementRenderIndex item, int Position, string TargetDataType) { foreach (var zone in datas) { long cardNo = AdvertisementRenderTools.QueryCardNoByZoneNoAndTypeStr(zone.No, TargetDataType); if (cardNo != 0) { ZonesModels zonemodel = GenZoneModel(item, Position); CardsModels cardmodel = AdvertisementRenderTools.GenCard(zonemodel).FirstOrDefault(); if (zone.CardsModels == null) { zone.CardsModels = new List <CardsModels>(); } zone.CardsModels.Add(cardmodel); zone.StyleID = 9; break; } } }
/// <summary> /// 取得廣告相關資訊 /// </summary> /// <param name="model"></param> /// <returns></returns> public static AdsCustomizeInfo GetADdata(CardsModels model) { //一個位置可為多個自訂廣告內容 var AdsCustomizeInfo = GetAdsCustomizeInfo(model.AreaSetID); //隨機選擇自訂廣告 Random r = new Random(); int index = 0; if (AdsCustomizeInfo.Count() > 0) { index = r.Next(0, AdsCustomizeInfo.Count()); } AdsCustomizeInfo ADdata = AdsCustomizeInfo.ToList()[index]; ADdata.AdvertisementDatas = GetItem <AdvertisementRenderIndex>("Advertisement", ADdata.Advertisement_ID); ADdata.AdsCustomizeToLinkDatas = GetItem <AdsCustomizeToLinkInfo>("AdsCustomizeToLink", ADdata.ID, "AdsCustomize_ID"); ADdata.AdsCustomizeToVideoDatas = GetItem <AdsCustomizeToVideoModelInfo>("AdsCustomizeToVideo", ADdata.ID, "AdsCustomize_ID"); string childtype = GenChildTypeByPageNo(model.PageNo); string Condition = string.Empty; //如果Pages.SN是Desktop就當作主檔處理 // 20180703 neil 因為廣告區選擇不使用主從架構,所以把 parentAdsDisplayAreaSetID 部份移除 if (!string.IsNullOrWhiteSpace(childtype) && childtype != WorkV3.Areas.Backend.Models.ChildType.Desktop) { Condition = $" and (ChildType='{childtype.Replace("'","''")}')"; } else if (string.IsNullOrWhiteSpace(childtype)) { Condition = $" and ChildType is null "; } ADdata.AdsDisplayAreaSetInfo = GetItem <AdsDisplayAreaSetInfo>("AdsDisplayAreaSet", ADdata.Advertisement_ID, "Advertisement_ID", "and MenuID=" + model.MenuID + Condition); return(ADdata); }
public ActionResult Index(CardsModels model, int?index) { ViewBag.SiteID = model.SiteID; SitePage page = CardsDAO.GetPage(model.No); ViewBag.SitePage = page; ViewBag.CardNo = model.No; int pageIndex = index ?? 1; Pagination pagination = new Pagination { PageSize = 20, PageIndex = index ?? 1 }; int totalRecord; IEnumerable <ArticleModels> items = CustomArticleDAO.GetItems(page.MenuID, pagination.PageSize, pagination.PageIndex, out totalRecord); ViewBag.ItemTypes = ArticleDAO.GetItemTypes(items.Select(item => item.ID)); ViewBag.ItemPages = CardsDAO.GetPages(items.Select(item => item.CardNo)); int style = model.StylesID == 0 ? 1 : model.StylesID; return(View("ListStyle" + style, items)); }
public void Move(long siteId, long menuId, long[] ArticleIds, long TargetMenuID) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.ActionType = "move"; if (ArticleIds.Length == 0) { return; } foreach (long ArticleId in ArticleIds) { ArticleModels articleItem = ArticleDAO.GetItem(ArticleId); CardsModels cardItem = CardsDAO.GetByNo(articleItem.CardNo); ZonesModels zoneItem = ZonesDAO.GetByNo(cardItem.ZoneNo.Value); PagesModels pageItem = PagesDAO.GetPageInfo(zoneItem.PageNo); var targetMenu = MenusDAO.GetInfo(TargetMenuID); WorkV3.Golbal.PubFunc.MovePage(pageItem, targetMenu.SiteID, targetMenu.ID); ArticleDAO.Move(ArticleId, targetMenu.ID, targetMenu.SiteID); WorkV3.Golbal.PubFunc.CopyIcon(articleItem.Icon, siteId, menuId, targetMenu.SiteID, targetMenu.ID); WorkV3.Golbal.PubFunc.CopyParagraphPhotos(articleItem.ID, siteId, menuId, targetMenu.SiteID, targetMenu.ID); } }
public ActionResult Index(CardsModels model) { PageCache pageCache = PageCache.GetTempDataPageCache(TempData); List <ViewModels.MemberCollectionViewModel> pageRecommandList = new List <ViewModels.MemberCollectionViewModel>(); ViewBag.SiteID = model.SiteID; int style = model.StylesID == 0 ? 1 : model.StylesID; Member curUser = Member.Current; if (curUser != null) { MemberShipModels item = MemberShipDAO.GetItem(curUser.ID); pageRecommandList = WorkV3.Models.DataAccess.MemberShipDAO.GetMemberFavitoryPages(curUser.ID); foreach (ViewModels.MemberCollectionViewModel vmodel in pageRecommandList) { vmodel.LinkUrl = Url.Action("Index", "Home", new { siteSn = pageCache.SiteSN, pageSn = vmodel.SN }); vmodel.ImgSrc = PagesDAO.GetContentImage(pageCache.SiteID, vmodel.MenuID, vmodel.No); vmodel.ImgAlt = vmodel.Title; vmodel.Summary = PagesDAO.GetContentDesc(pageCache.SiteID, vmodel.MenuID, vmodel.No); } } // style = 3; return(View("Style" + style, pageRecommandList)); }
private CardsModels GetOutputForCard(long id) { var card = new CardsModels(); using (var connection = new NpgsqlConnection(ConnectionString)) { connection.Open(); using (var command = new NpgsqlCommand($"SELECT * FROM public.cards where id={id};", connection)) { var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { card.Id = reader.GetInt64(0); card.Name = reader.GetString(1); card.Type = reader.GetString(2); card.Image = reader.GetString(4); card.Information = reader.GetString(5); card.Cost = reader.GetInt32(6); } } } } string specialName = new ManagmentController().GetSpecialNameUsingType(card.Type); //интересно что будет using (NpgsqlConnection connection = new NpgsqlConnection(ConnectionString)) { string[] namesOfProperties = null; var properties = new List <string>(); int numOfColumns = 0; connection.OpenAsync(); NpgsqlCommand cmd = new NpgsqlCommand($"SELECT count(*) FROM information_schema.columns where table_name='{specialName}'", connection); var reader = cmd.ExecuteReaderAsync(); while (reader.Result.Read()) { numOfColumns = reader.Result.GetInt32(0); } connection.Close(); connection.OpenAsync(); cmd = new NpgsqlCommand($"select * from {specialName} where id={id}", connection); reader = cmd.ExecuteReaderAsync(); while (reader.Result.Read()) { for (int i = 1; i < numOfColumns; i++) { properties.Add(reader.Result.GetString(i)); } } connection.Close(); connection.OpenAsync(); cmd = new NpgsqlCommand($"select properties from types where type='{card.Type}'", connection); reader = cmd.ExecuteReaderAsync(); while (reader.Result.Read()) { namesOfProperties = (string[])reader.Result.GetValue(0); } connection.Close(); ViewBag.NamesOfProperties = namesOfProperties; ViewBag.Properties = properties; } return(card); }
public ActionResult Index(CardsModels model) { WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No); ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(curPage.SiteID, curPage.MenuID); return(View(model)); }
// GET: CustomTheme public ActionResult Index(CardsModels model) { return(View("Style" + model.StylesID.ToString())); }