public void GetCount(int publishmentSystemID, ELotteryType lotteryType, int lotteryID, out int totalNum, out int wonNum) { totalNum = 0; wonNum = 0; var lotteryIDList = new List <int>(); if (lotteryID == 0) { lotteryIDList = DataProviderWX.LotteryDAO.GetLotteryIDList(publishmentSystemID, lotteryType); } else { lotteryIDList.Add(lotteryID); } string sqlString = $"SELECT SUM(TotalNum), SUM(WonNum) FROM {TABLE_NAME} WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryID} IN ({TranslateUtils.ToSqlInStringWithoutQuote(lotteryIDList)})"; using (var rdr = ExecuteReader(sqlString)) { if (rdr.Read() && !rdr.IsDBNull(0)) { totalNum = rdr.GetInt32(0); wonNum = rdr.GetInt32(1); } rdr.Close(); } }
public string GetSelectString(int publishmentSystemID, ELotteryType lotteryType) { string whereString = $"WHERE {LotteryAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(TABLE_NAME, SqlUtils.Asterisk, whereString)); }
public int GetFirstIDByKeywordID(int publishmentSystemID, ELotteryType lotteryType, int keywordID) { string sqlString = $"SELECT TOP 1 ID FROM {TABLE_NAME} WHERE {LotteryAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}' AND {LotteryAttribute.IsDisabled} <> '{true}' AND {LotteryAttribute.KeywordID} = {keywordID}"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public static string GetValue(ELotteryType type) { if (type == ELotteryType.Scratch) { return("Scratch"); } else if (type == ELotteryType.BigWheel) { return("BigWheel"); } else if (type == ELotteryType.GoldEgg) { return("GoldEgg"); } else if (type == ELotteryType.Flap) { return("Flap"); } else if (type == ELotteryType.YaoYao) { return("YaoYao"); } else { throw new Exception(); } }
public static string GetText(ELotteryType type) { if (type == ELotteryType.Scratch) { return("刮刮卡"); } else if (type == ELotteryType.BigWheel) { return("大转盘"); } else if (type == ELotteryType.GoldEgg) { return("砸金蛋"); } else if (type == ELotteryType.Flap) { return("大翻牌"); } else if (type == ELotteryType.YaoYao) { return("摇摇乐"); } else { throw new Exception(); } }
public List <LotteryWinnerInfo> GetWinnerInfoList(int publishmentSystemId, ELotteryType lotteryType, int lotteryId) { var winnerInfoList = new List <LotteryWinnerInfo>(); string sqlWhere = $"WHERE {LotteryWinnerAttribute.PublishmentSystemId} = {publishmentSystemId} AND {LotteryWinnerAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; if (lotteryId > 0) { sqlWhere = $"WHERE {LotteryWinnerAttribute.PublishmentSystemId} = {publishmentSystemId} AND {LotteryWinnerAttribute.LotteryId} = {lotteryId}"; } var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, "ORDER BY ID DESC"); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var winnerInfo = new LotteryWinnerInfo(rdr); winnerInfoList.Add(winnerInfo); } rdr.Close(); } return(winnerInfoList); }
public static string GetText(ELotteryType type) { if (type == ELotteryType.Scratch) { return("¹Î¹Î¿¨"); } else if (type == ELotteryType.BigWheel) { return("´óתÅÌ"); } else if (type == ELotteryType.GoldEgg) { return("ÔÒ½ðµ°"); } else if (type == ELotteryType.Flap) { return("´ó·ÅÆ"); } else if (type == ELotteryType.YaoYao) { return("Ò¡Ò¡ÀÖ"); } else { throw new Exception(); } }
public List <LotteryWinnerInfo> GetWinnerInfoList(int publishmentSystemID, ELotteryType lotteryType, int lotteryID) { var winnerInfoList = new List <LotteryWinnerInfo>(); string SQL_WHERE = $"WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; if (lotteryID > 0) { SQL_WHERE = $"WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryID} = {lotteryID}"; } var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, "ORDER BY ID DESC"); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var winnerInfo = new LotteryWinnerInfo(rdr); winnerInfoList.Add(winnerInfo); } rdr.Close(); } return(winnerInfoList); }
public static string GetRedirectUrl(int publishmentSystemId, ELotteryType lotteryType) { return(PageUtils.GetWeiXinUrl(nameof(PageLottery), new NameValueCollection { { "publishmentSystemId", publishmentSystemId.ToString() }, { "lotteryType", ELotteryTypeUtils.GetValue(lotteryType) } })); }
public static List <Article> Trigger(Model.KeywordInfo keywordInfo, ELotteryType lotteryType, string requestFromUserName) { var articleList = new List <Article>(); DataProviderWx.CountDao.AddCount(keywordInfo.PublishmentSystemId, ECountType.RequestNews); var lotteryInfoList = DataProviderWx.LotteryDao.GetLotteryInfoListByKeywordId(keywordInfo.PublishmentSystemId, lotteryType, keywordInfo.KeywordId); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(keywordInfo.PublishmentSystemId); foreach (var lotteryInfo in lotteryInfoList) { Article article = null; if (lotteryInfo != null && lotteryInfo.StartDate < DateTime.Now) { var isEnd = false; if (lotteryInfo.EndDate < DateTime.Now) { isEnd = true; } if (isEnd) { var endImageUrl = GetEndImageUrl(publishmentSystemInfo, lotteryType, lotteryInfo.EndImageUrl); article = new Article() { Title = lotteryInfo.EndTitle, Description = lotteryInfo.EndSummary, PicUrl = endImageUrl }; } else { var imageUrl = GetImageUrl(publishmentSystemInfo, lotteryType, lotteryInfo.ImageUrl); var pageUrl = GetLotteryUrl(publishmentSystemInfo, lotteryInfo, requestFromUserName); article = new Article() { Title = lotteryInfo.Title, Description = lotteryInfo.Summary, PicUrl = imageUrl, Url = pageUrl }; } } if (article != null) { articleList.Add(article); } } return(articleList); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } lotteryType = ELotteryTypeUtils.GetEnumType(Request.QueryString["lotteryType"]); lotteryID = TranslateUtils.ToInt(Request.QueryString["lotteryID"]); awardID = TranslateUtils.ToInt(Request.QueryString["awardID"]); returnUrl = StringUtils.ValueFromUrl(Request.QueryString["returnUrl"]); if (!string.IsNullOrEmpty(Request.QueryString["Delete"])) { var list = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]); if (list.Count > 0) { try { DataProviderWX.LotteryWinnerDAO.Delete(PublishmentSystemID, list); SuccessMessage("删除成功!"); } catch (Exception ex) { FailMessage(ex, "删除失败!"); } } } spContents.ControlToPaginate = rptContents; spContents.ItemsPerPage = 30; spContents.ConnectionString = BaiRongDataProvider.ConnectionString; spContents.SelectCommand = DataProviderWX.LotteryWinnerDAO.GetSelectString(PublishmentSystemID, lotteryType, lotteryID, awardID); spContents.SortField = LotteryWinnerAttribute.ID; spContents.SortMode = SortMode.DESC; rptContents.ItemDataBound += new RepeaterItemEventHandler(rptContents_ItemDataBound); if (!IsPostBack) { BreadCrumb(AppManager.CMS.LeftMenu.ID_Configration, "获奖名单查看", string.Empty); spContents.DataBind(); var totalNum = 0; var wonNum = 0; DataProviderWX.LotteryAwardDAO.GetCount(PublishmentSystemID, lotteryType, lotteryID, out totalNum, out wonNum); InfoMessage($"总奖品数:{totalNum},已中奖人数:{wonNum},剩余奖品数:{totalNum - wonNum}"); var urlDelete = PageUtils.AddQueryString(GetRedirectUrl(PublishmentSystemID, lotteryType, lotteryID, awardID, returnUrl), "Delete", "True"); btnDelete.Attributes.Add("onclick", JsUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的获奖项", "此操作将删除所选获奖项,确认吗?")); btnSetting.Attributes.Add("onclick", Modal.WinnerSetting.GetOpenWindowString(PublishmentSystemID)); btnExport.Attributes.Add("onclick", Modal.Export.GetOpenWindowStringByLottery(PublishmentSystemID, lotteryType, lotteryID)); btnReturn.Attributes.Add("onclick", $"location.href='{returnUrl}';return false"); } }
public static string GetOpenWindowStringByLottery(int publishmentSystemID, ELotteryType lotteryType, int lotteryID) { var arguments = new NameValueCollection(); arguments.Add("publishmentSystemID", publishmentSystemID.ToString()); arguments.Add("lotteryType", ELotteryTypeUtils.GetValue(lotteryType)); arguments.Add("lotteryID", lotteryID.ToString()); return(JsUtils.OpenWindow.GetOpenWindowString("导出CSV", "modal_export.aspx", arguments, 400, 240, true)); }
public static ListItem GetListItem(ELotteryType type, bool selected) { var item = new ListItem(GetText(type), GetValue(type)); if (selected) { item.Selected = true; } return(item); }
public static string GetOpenWindowStringByLottery(int publishmentSystemId, ELotteryType lotteryType, int lotteryId) { return(PageUtils.GetOpenWindowString("导出CSV", PageUtils.GetWeiXinUrl(nameof(ModalExport), new NameValueCollection { { "publishmentSystemId", publishmentSystemId.ToString() }, { "lotteryType", ELotteryTypeUtils.GetValue(lotteryType) }, { "lotteryId", lotteryId.ToString() } }), 400, 240, true)); }
public static string GetRedirectUrl(int publishmentSystemId, ELotteryType lotteryType, int lotteryId, int awardId, string returnUrl) { return(PageUtils.GetWeiXinUrl(nameof(PageLotteryWinner), new NameValueCollection { { "publishmentSystemId", publishmentSystemId.ToString() }, { "lotteryType", ELotteryTypeUtils.GetValue(lotteryType) }, { "lotteryId", lotteryId.ToString() }, { "awardId", awardId.ToString() }, { "returnUrl", StringUtils.ValueToUrl(returnUrl) } })); }
public static bool Equals(ELotteryType type, string typeStr) { if (string.IsNullOrEmpty(typeStr)) { return(false); } if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower())) { return(true); } return(false); }
public int GetTotalNum(int publishmentSystemID, ELotteryType lotteryType, int lotteryID) { string sqlString = $"SELECT COUNT(*) FROM {TABLE_NAME} WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; if (lotteryID > 0) { sqlString = $"SELECT COUNT(*) FROM {TABLE_NAME} WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryID} = {lotteryID}"; } return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public string GetSelectString(int publishmentSystemID, ELotteryType lotteryType, int lotteryID, int awardID) { string whereString = $"WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; if (lotteryID > 0) { whereString = $"WHERE {LotteryWinnerAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryWinnerAttribute.LotteryID} = {lotteryID}"; } if (awardID > 0) { whereString = $" AND {LotteryWinnerAttribute.AwardID} = {awardID}"; } return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(TABLE_NAME, SqlUtils.Asterisk, whereString)); }
public List <int> GetLotteryIdList(int publishmentSystemId, ELotteryType lotteryType) { var lotteryIdList = new List <int>(); string sqlWhere = $"WHERE {LotteryAttribute.PublishmentSystemId} = {publishmentSystemId} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, LotteryAttribute.Id, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { lotteryIdList.Add(rdr.GetInt32(0)); } rdr.Close(); } return(lotteryIdList); }
public List <int> GetLotteryIDList(int publishmentSystemID, ELotteryType lotteryType) { var lotteryIDList = new List <int>(); string SQL_WHERE = $"WHERE {LotteryAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}'"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, LotteryAttribute.ID, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { lotteryIDList.Add(rdr.GetInt32(0)); } rdr.Close(); } return(lotteryIDList); }
public List <LotteryInfo> GetLotteryInfoListByKeywordID(int publishmentSystemID, ELotteryType lotteryType, int keywordID) { var lotteryInfoList = new List <LotteryInfo>(); string SQL_WHERE = $"WHERE {LotteryAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}' AND {LotteryAttribute.IsDisabled} <> '{true}'"; if (keywordID > 0) { SQL_WHERE += $" AND {LotteryAttribute.KeywordID} = {keywordID}"; } var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var lotteryInfo = new LotteryInfo(rdr); lotteryInfoList.Add(lotteryInfo); } rdr.Close(); } return(lotteryInfoList); }
public static string GetContentAwardImageUrl(PublishmentSystemInfo publishmentSystemInfo, ELotteryType lotteryType, string contentImageUrl, int awardCount) { if (!string.IsNullOrEmpty(contentImageUrl)) { return(PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, contentImageUrl))); } var fileName = awardCount + ".png"; if (awardCount < 2 || awardCount > 9) { fileName = "contentAward.png"; } var directoryName = "img" + ELotteryTypeUtils.GetValue(lotteryType); return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, $"weixin/lottery/{directoryName}/{fileName}"))); }
public static string GetEndImageUrl(PublishmentSystemInfo publishmentSystemInfo, ELotteryType lotteryType, string endImageUrl) { if (!string.IsNullOrEmpty(endImageUrl)) { return(PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, endImageUrl))); } var directoryName = "img" + ELotteryTypeUtils.GetValue(lotteryType); return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, $"weixin/lottery/{directoryName}/end.jpg"))); }
public static string GetRedirectUrl(int publishmentSystemID, ELotteryType lotteryType) { return(PageUtils.GetWXUrl( $"background_lottery.aspx?PublishmentSystemID={publishmentSystemID}&lotteryType={ELotteryTypeUtils.GetValue(lotteryType)}")); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } lotteryType = ELotteryTypeUtils.GetEnumType(Request.QueryString["lotteryType"]); var lotteryName = ELotteryTypeUtils.GetText(lotteryType); if (!string.IsNullOrEmpty(Request.QueryString["Delete"])) { var list = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]); if (list.Count > 0) { try { DataProviderWX.LotteryDAO.Delete(PublishmentSystemID, list); SuccessMessage(lotteryName + "删除成功!"); } catch (Exception ex) { FailMessage(ex, lotteryName + "删除失败!"); } } } spContents.ControlToPaginate = rptContents; spContents.ItemsPerPage = 30; spContents.ConnectionString = BaiRongDataProvider.ConnectionString; spContents.SelectCommand = DataProviderWX.LotteryDAO.GetSelectString(PublishmentSystemID, lotteryType); spContents.SortField = LotteryAttribute.ID; spContents.SortMode = SortMode.ASC; rptContents.ItemDataBound += new RepeaterItemEventHandler(rptContents_ItemDataBound); if (!IsPostBack) { if (lotteryType == ELotteryType.Scratch) { BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Scratch, lotteryName, AppManager.WeiXin.Permission.WebSite.Scratch); } else if (lotteryType == ELotteryType.BigWheel) { BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_BigWheel, lotteryName, AppManager.WeiXin.Permission.WebSite.BigWheel); } else if (lotteryType == ELotteryType.GoldEgg) { BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_GoldEgg, lotteryName, AppManager.WeiXin.Permission.WebSite.GoldEgg); } else if (lotteryType == ELotteryType.Flap) { BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Flap, lotteryName, AppManager.WeiXin.Permission.WebSite.Flap); } else if (lotteryType == ELotteryType.YaoYao) { BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_YaoYao, lotteryName, AppManager.WeiXin.Permission.WebSite.YaoYao); } spContents.DataBind(); var urlAdd = string.Empty; if (lotteryType == ELotteryType.Scratch) { urlAdd = BackgroundScratchAdd.GetRedirectUrl(PublishmentSystemID, 0); } else if (lotteryType == ELotteryType.BigWheel) { urlAdd = BackgroundBigWheelAdd.GetRedirectUrl(PublishmentSystemID, 0); } else if (lotteryType == ELotteryType.GoldEgg) { urlAdd = BackgroundGoldEggAdd.GetRedirectUrl(PublishmentSystemID, 0); } else if (lotteryType == ELotteryType.Flap) { urlAdd = BackgroundFlapAdd.GetRedirectUrl(PublishmentSystemID, 0); } else if (lotteryType == ELotteryType.YaoYao) { urlAdd = BackgroundYaoYaoAdd.GetRedirectUrl(PublishmentSystemID, 0); } btnAdd.Attributes.Add("onclick", $"location.href='{urlAdd}';return false"); var urlDelete = PageUtils.AddQueryString(GetRedirectUrl(PublishmentSystemID, lotteryType), "Delete", "True"); btnDelete.Attributes.Add("onclick", JsUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的" + lotteryName, "此操作将删除所选" + lotteryName + ",确认吗?")); } }
public static string GetRedirectUrl(int publishmentSystemID, ELotteryType lotteryType, int lotteryID, int awardID, string returnUrl) { return(PageUtils.GetWXUrl( $"background_lotteryWinner.aspx?publishmentSystemID={publishmentSystemID}&lotteryType={ELotteryTypeUtils.GetValue(lotteryType)}&lotteryID={lotteryID}&awardID={awardID}&returnUrl={StringUtils.ValueToUrl(returnUrl)}")); }
public static bool Equals(string typeStr, ELotteryType type) { return(Equals(type, typeStr)); }
public List <LotteryInfo> GetLotteryInfoListByKeywordId(int publishmentSystemId, ELotteryType lotteryType, int keywordId) { var lotteryInfoList = new List <LotteryInfo>(); string sqlWhere = $"WHERE {LotteryAttribute.PublishmentSystemId} = {publishmentSystemId} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}' AND {LotteryAttribute.IsDisabled} <> '{true}'"; if (keywordId > 0) { sqlWhere += $" AND {LotteryAttribute.KeywordId} = {keywordId}"; } var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var lotteryInfo = new LotteryInfo(rdr); lotteryInfoList.Add(lotteryInfo); } rdr.Close(); } return(lotteryInfoList); }