public void AddTags(ref string result) { int queryString = RequestHelper.GetQueryString <int>("ProductID"); string str = CookiesHelper.ReadCookieValue("TagsCookies" + queryString.ToString()); if ((ShopConfig.ReadConfigInfo().AddTagsRestrictTime > 0) && (str != string.Empty)) { result = "Ç벻ҪƵ·±Ìá½»"; } else { TagsInfo tags = new TagsInfo(); tags.ProductID = queryString; tags.Word = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Word")); tags.Color = "#4C5A62"; tags.Size = 12; tags.IsTop = 0; tags.UserID = base.UserID; tags.UserName = base.UserName; TagsBLL.AddTags(tags); if (ShopConfig.ReadConfigInfo().AddTagsRestrictTime > 0) { CookiesHelper.AddCookie("TagsCookies" + queryString.ToString(), "TagsCookies" + queryString.ToString(), ShopConfig.ReadConfigInfo().AddTagsRestrictTime, TimeType.Second); } } }
internal void RequestSingleUseTokenAvoidingValidation( string docType, string docNumber, string metadata = null, TagsInfo tags = null, bool excludeMetadata = false, bool excludeTags = false) { IRestRequest request = new AspenRequest(this, Routes.Tokens.RequestToken, Method.POST); dynamic body = new ExpandoObject(); body.DocType = docType; body.DocNumber = docNumber; if (!excludeMetadata) { body.Metadata = metadata; } if (!excludeTags) { body.Tags = tags; } request.AddJsonBody(body); this.Execute(request); }
internal void RefundReversalAvoidingValidation( string transactionId, string docType, string docNumber, string accountType, object amount, TagsInfo tags = null, bool excludeTags = false) { IRestRequest request = new AspenRequest(this, Routes.Financial.Refund, Method.PATCH); dynamic body = new ExpandoObject(); body.TransactionId = transactionId; body.DocType = docType; body.DocNumber = docNumber; body.AccountType = accountType; body.Amount = amount; if (!excludeTags) { body.Tags = tags; } request.AddJsonBody(body); this.Execute(request); }
//----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //constructor public ProjectGenerator(ControllerInfo controllerInfo, DataTypesInfo dataTablesInfo, ModulesInfo modulesInfo, AddOnInstructionDefinitionsInfo addOnInstructionDefinitionsInfo, TagsInfo tagsInfo, ProgramsInfo programsInfo, TasksInfo tasksInfo) { var initControllerInfo = new InitControllerInfo(controllerInfo); ControllerInfo = initControllerInfo.InitializedData(); var initDataTypesInfo = new InitDataTypesInfo(dataTablesInfo); DataTypesInfo = initDataTypesInfo.InitializedData(); var initModulesInfo = new InitModulesInfo(modulesInfo); ModulesInfo = initModulesInfo.InitializedData(); var initAddOnInstructionDefinitionsInfo = new InitAddOnInstructionDefinitionsInfo(addOnInstructionDefinitionsInfo); AddOnInstructionDefinitionsInfo = initAddOnInstructionDefinitionsInfo.InitializedData(); var initGlobalTagsInfo = new InitTagsInfo(tagsInfo); TagsInfo = initGlobalTagsInfo.InitializedData(); var initProgramsInfo = new InitProgramsInfo(programsInfo); ProgramsInfo = initProgramsInfo.InitializedData(); var initTasksInfo = new InitTasksInfo(tasksInfo); TasksInfo = initTasksInfo.InitializedData(); }
public int Update(TagsInfo item) { return(new SqlUpdateBuild(null, item.Id) .SetCreate_time(item.Create_time) .SetKeyname(item.Keyname) .SetName(item.Name).ExecuteNonQuery()); }
public static TagsInfo GetItemByKeyname(string Keyname) { if (Keyname == null) { return(null); } if (itemCacheTimeout <= 0) { return(dal.GetItemByKeyname(Keyname)); } string key = string.Concat("cnodejs_BLL_TagsByKeyname_", Keyname); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(new TagsInfo(value)); } catch { } } TagsInfo item = dal.GetItemByKeyname(Keyname); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
private void InitForModify() { TagsInfo dataById = SinGooCMS.BLL.Tags.GetDataById(base.OpID); this.TextBox1.Text = dataById.TagName; this.TextBox2.Text = dataById.TagUrl.ToString(); }
protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); TagsInfo dataById = SinGooCMS.BLL.Tags.GetDataById(@int); if (dataById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa"); } else if (SinGooCMS.BLL.Tags.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除标签[" + dataById.TagName + "] thành công"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } }
public static int Update(TagsInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
public static cnodejs.DAL.Tags.SqlUpdateBuild UpdateDiy(TagsInfo item, uint?Id) { if (itemCacheTimeout > 0) { RemoveCache(item != null ? item : GetItem(Id)); } return(new cnodejs.DAL.Tags.SqlUpdateBuild(item, Id)); }
private static void RemoveCache(TagsInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("cnodejs_BLL_Tags_", item.Id)); RedisHelper.Remove(string.Concat("cnodejs_BLL_TagsByKeyname_", item.Keyname)); }
protected static MySqlParameter[] GetParameters(TagsInfo item) { return(new MySqlParameter[] { GetParameter("?id", MySqlDbType.UInt32, 10, item.Id), GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time), GetParameter("?keyname", MySqlDbType.VarChar, 32, item.Keyname), GetParameter("?name", MySqlDbType.VarChar, 96, item.Name) }); }
public static TagsInfo Insert(TagsInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
protected void btnok_Click(object sender, System.EventArgs e) { if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { TagsInfo tagsInfo = new TagsInfo(); if (base.IsEdit) { tagsInfo = SinGooCMS.BLL.Tags.GetDataById(base.OpID); } tagsInfo.TagName = WebUtils.GetString(this.TextBox1.Text); tagsInfo.TagUrl = WebUtils.GetString(this.TextBox2.Text); tagsInfo.Sort = SinGooCMS.BLL.Tags.MaxSort + 1; tagsInfo.IsTop = false; tagsInfo.IsRecommend = false; if (string.IsNullOrEmpty(tagsInfo.TagName)) { base.ShowMsg("Vui lòng nhập một thẻ tag"); } else { if (base.Action.Equals(ActionType.Add.ToString())) { tagsInfo.AutoTimeStamp = System.DateTime.Now; tagsInfo.Lang = base.cultureLang; if (SinGooCMS.BLL.Tags.Add(tagsInfo) > 0) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "Thêm thẻ tag [" + tagsInfo.TagName + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } else { base.ShowMsg("Thêm thẻ thất bại"); } } if (base.Action.Equals(ActionType.Modify.ToString())) { if (SinGooCMS.BLL.Tags.Update(tagsInfo)) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "Sửa đổi thẻ tag [" + tagsInfo.TagName + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } else { base.ShowMsg("Sửa đổi thẻ tag thất bại"); } } } } }
public APIReturn Get_item(uint?Id) { TagsInfo item = Tags.GetItem(Id); if (item == null) { return(new APIReturn(98, "记录不存在,或者没有权限")); } return(new APIReturn(0, "成功", "item", item.ToBson())); }
public TagsInfo Insert(TagsInfo item) { uint loc1; if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1)) { item.Id = loc1; } return(item); }
public ActionResult <DataSet> GetDataByTagsAndTime([FromBody] TagsInfo tagsInfo) { IList <string> tagsName = new List <string>(tagsInfo.TagsName.Split(',')); _log.Info($"开始取数据,位号个数{tagsName.Count}, 时间:{DateTime.Now.ToLongTimeString()}"); DataSet ds = RTDBHelper.GetDataByTagsAndTime(tagsName, Convert.ToDateTime(tagsInfo.DateTime)); _log.Info($"取数完成,时间:{DateTime.Now.ToLongTimeString()}"); return(ds); }
public void UpdateTags(TagsInfo tags) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@productID", SqlDbType.Int), new SqlParameter("@word", SqlDbType.NVarChar), new SqlParameter("@color", SqlDbType.NVarChar), new SqlParameter("@size", SqlDbType.Int), new SqlParameter("@isTop", SqlDbType.Int) }; pt[0].Value = tags.ID; pt[1].Value = tags.ProductID; pt[2].Value = tags.Word; pt[3].Value = tags.Color; pt[4].Value = tags.Size; pt[5].Value = tags.IsTop; ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateTags", pt); }
public int AddTags(TagsInfo tags) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@productID", SqlDbType.Int), new SqlParameter("@word", SqlDbType.NVarChar), new SqlParameter("@color", SqlDbType.NVarChar), new SqlParameter("@size", SqlDbType.Int), new SqlParameter("@isTop", SqlDbType.Int), new SqlParameter("@userID", SqlDbType.Int), new SqlParameter("@userName", SqlDbType.NVarChar) }; pt[0].Value = tags.ProductID; pt[1].Value = tags.Word; pt[2].Value = tags.Color; pt[3].Value = tags.Size; pt[4].Value = tags.IsTop; pt[5].Value = tags.UserID; pt[6].Value = tags.UserName; return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddTags", pt))); }
public static int Add(TagsInfo entity) { int result; if (entity == null) { result = 0; } else { result = BizBase.dbo.InsertModel <TagsInfo>(entity); } return(result); }
public APIReturn Post_insert([FromForm] string Keyname, [FromForm] string Name, [FromForm] ulong[] mn_Topics) { TagsInfo item = new TagsInfo(); item.Create_time = DateTime.Now; item.Keyname = Keyname; item.Name = Name; item = Tags.Insert(item); //关联 Topics foreach (ulong mn_Topics_in in mn_Topics) { item.FlagTopics(mn_Topics_in); } return(new APIReturn(0, "成功", "item", item.ToBson())); }
public void PrepareTagsModel(SqlDataReader dr, List <TagsInfo> tagsList) { while (dr.Read()) { TagsInfo item = new TagsInfo(); item.ID = dr.GetInt32(0); item.ProductID = dr.GetInt32(1); item.Word = dr[2].ToString(); item.Color = dr[3].ToString(); item.Size = dr.GetInt32(4); item.IsTop = dr.GetInt32(5); item.UserID = dr.GetInt32(6); item.UserName = dr[7].ToString(); tagsList.Add(item); } }
/// <summary> /// Solicita el procesamiento de una transacción de pago sin validar localmente. Se expone como internal con el fin de validar el comportamiento del servicio Aspen. /// </summary> /// <param name="docType">Tipo de documento del usuario.</param> /// <param name="docNumber">Número de documento del usuario.</param> /// <param name="token">Token transacional asociado con el usuario.</param> /// <param name="accountType">Tipo de cuenta de la que se toman los fondos.</param> /// <param name="amount">Valor del pago.</param> /// <param name="tags">Tags relacionados con la solicitud.</param> /// <param name="excludeDocType"></param> /// <param name="excludeDocNumber"></param> /// <param name="excludeAmount"></param> /// <param name="excludeAccountType"></param> /// <param name="excludeTags"></param> internal void PaymentAvoidingValidation( string docType, string docNumber, string token, string accountType, object amount, TagsInfo tags = null, bool excludeDocType = false, bool excludeDocNumber = false, bool excludeAmount = false, bool excludeAccountType = false, bool excludeTags = false) { IRestRequest request = new AspenRequest(this, Routes.Financial.Payment, Method.POST); dynamic body = new ExpandoObject(); if (!excludeDocType) { body.DocType = docType; } if (!excludeDocNumber) { body.DocNumber = docNumber; } body.Token = token; if (!excludeAmount) { body.Amount = amount; } if (!excludeAccountType) { body.AccountType = accountType; } if (!excludeTags) { body.Tags = tags; } request.AddJsonBody(body); this.Execute(request); }
public static void CheckTags(IJEnumerable <JToken> expected, TagsInfo actual) { var expectedCategoryTags = expected["category"]; if (expectedCategoryTags != null) { expectedCategoryTags = expectedCategoryTags["livetag"]; } var ci = 0; var expectedLockedTags = expected["locked"]; if (expectedLockedTags != null) { expectedLockedTags = expectedLockedTags["livetag"]; } var li = 0; var expectedTags = expected["free"]; if (expectedTags != null) { expectedTags = expectedTags["livetag"]; } var fi = 0; for (var i = 0; i < actual.Tags.Count; ++i) { var actualTag = actual.Tags[i]; if (actualTag.IsCategoryTag) { var expectedTag = expectedCategoryTags.Value <string>(); if (expectedTag == null) { expectedTag = expectedCategoryTags[ci++].Value <string>(); } Assert.AreEqual(expectedTag, actualTag.Value); } else if (actualTag.IsLocked) { var expectedTag = expectedLockedTags[li++].Value <string>(); Assert.AreEqual(expectedTag, actualTag.Value); } else { var expectedTag = expectedTags[fi++].Value <string>(); Assert.AreEqual(expectedTag, actualTag.Value); } } }
public ActionResult InitPage(TagsInfo tagsInfo) { string[] rtn = new string[2] { "", "Failed" }; if (tagsInfo.Error) { return(Json(new string[] { tagsInfo.ErrorMsg, "" })); } ; var tags = tagsInfo.Tags; if (tags.Count > 0) { rtn[1] = tags.ToJson(); } return(this.ToJsonNet(rtn)); }
public ReversalInfo( string transactionId, string docType, string docNumber, string accountType, int amount, TagsInfo tags = null) { Throw.IfNullOrEmpty(docType, nameof(docType)); Throw.IfNullOrEmpty(docNumber, nameof(docNumber)); Throw.IfNullOrEmpty(transactionId, nameof(transactionId)); Throw.IfNullOrEmpty(accountType, nameof(accountType)); Throw.IfEmpty(amount, nameof(amount)); this.TransactionId = transactionId; this.DocType = docType; this.DocNumber = docNumber; this.AccountType = accountType; this.Amount = amount; this.Tags = tags; }
public APIReturn Put_update(uint?Id, [FromForm] string Keyname, [FromForm] string Name, [FromForm] ulong[] mn_Topics) { TagsInfo item = new TagsInfo(); item.Id = Id; item.Create_time = DateTime.Now; item.Keyname = Keyname; item.Name = Name; int affrows = Tags.Update(item); //关联 Topics if (mn_Topics.Length == 0) { item.UnflagTopicsALL(); } else { List <ulong> mn_Topics_list = mn_Topics.ToList(); foreach (TopicsInfo Obj_topics in item.Obj_topicss) { int idx = mn_Topics_list.FindIndex(a => a == Obj_topics.Id); if (idx == -1) { item.UnflagTopics(Obj_topics.Id); } else { mn_Topics_list.RemoveAt(idx); } } mn_Topics_list.ForEach(a => item.FlagTopics(a)); } if (affrows > 0) { return(new APIReturn(0, "成功")); } return(new APIReturn(99, "失败")); }
public IActionResult 发布话题([FromForm] string tab, [FromForm] string title, [FromForm] string t_content, [FromForm] uint[] topic_tags, [FromForm] string _csrf) { SqlHelper.Transaction(() => { TopicsInfo topic = Topics.Insert(new TopicsInfo { Title = title, Count_posts = 0, Count_views = 0, Create_time = DateTime.Now, Owner_users_id = LoginUser.Id, Top = 0 }); PostsInfo post = Posts.Insert(new PostsInfo { Content = t_content, Count_good = 0, Count_notgood = 0, Create_time = DateTime.Now, Topics_id = topic.Id, Users_id = LoginUser.Id, Index = 1 }); var tags_id = topic_tags.ToList(); TagsInfo tag = Tags.GetItemByKeyname(tab); if (tag.Id > 1) { tags_id.Add(tag.Id.Value); } foreach (uint tagid in tags_id) { topic.FlagTags(tagid); } }); RedisHelper.Remove("author_nonereply", "indextopics_all1", "indextopics_all2", "indextopics_all3", "indextopics_all4", "indextopics_good1", "indextopics_good2", "indextopics_good3", "indextopics_good4", "indextopics_share1", "indextopics_share2", "indextopics_share3", "indextopics_share4", "indextopics_ask1", "indextopics_ask2", "indextopics_ask3", "indextopics_ask4", "indextopics_job1", "indextopics_job2", "indextopics_job3", "indextopics_job4"); return(new RedirectResult("/")); }
public TagsInfo ReadTags(int id, int userID) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@userID", SqlDbType.Int) }; pt[0].Value = id; pt[1].Value = userID; TagsInfo info = new TagsInfo(); using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadTags", pt)) { if (reader.Read()) { info.ID = reader.GetInt32(0); info.ProductID = reader.GetInt32(1); info.Word = reader[2].ToString(); info.Color = reader[3].ToString(); info.Size = reader.GetInt32(4); info.IsTop = reader.GetInt32(5); info.UserID = reader.GetInt32(6); info.UserName = reader[7].ToString(); } } return(info); }
public List <TagsInfo> SearchTagsList(int currentPage, int pageSize, TagsSearchInfo tagsSearch, ref int count) { List <TagsInfo> list = new List <TagsInfo>(); ShopMssqlPagerClass class2 = new ShopMssqlPagerClass(); class2.TableName = " " + ShopMssqlHelper.TablePrefix + "Tags INNER JOIN " + ShopMssqlHelper.TablePrefix + "Product ON " + ShopMssqlHelper.TablePrefix + "Tags.[ProductID]=" + ShopMssqlHelper.TablePrefix + "Product.[ID] "; class2.Fields = ShopMssqlHelper.TablePrefix + "Tags.[ID],[ProductID],[Word]," + ShopMssqlHelper.TablePrefix + "Tags.[Color],[Size]," + ShopMssqlHelper.TablePrefix + "Tags.[IsTop],[UserID],[UserName]," + ShopMssqlHelper.TablePrefix + "Product.[Name]"; class2.CurrentPage = currentPage; class2.PageSize = pageSize; class2.OrderField = ShopMssqlHelper.TablePrefix + "Tags.[ID]"; class2.OrderType = OrderType.Desc; class2.MssqlCondition.Add(ShopMssqlHelper.TablePrefix + "Tags.[Word]", tagsSearch.Word, ConditionType.Like); class2.MssqlCondition.Add(ShopMssqlHelper.TablePrefix + "Tags.[IsTop]", tagsSearch.IsTop, ConditionType.Equal); class2.MssqlCondition.Add(ShopMssqlHelper.TablePrefix + "Product.[Name]", tagsSearch.ProductName, ConditionType.Like); class2.MssqlCondition.Add("[UserID]", tagsSearch.UserID, ConditionType.Equal); class2.Count = count; count = class2.Count; using (SqlDataReader reader = class2.ExecuteReader()) { while (reader.Read()) { TagsInfo item = new TagsInfo(); item.ID = reader.GetInt32(0); item.ProductID = reader.GetInt32(1); item.Word = reader[2].ToString(); item.Color = reader[3].ToString(); item.Size = reader.GetInt32(4); item.IsTop = reader.GetInt32(5); item.UserID = reader.GetInt32(6); item.UserName = reader[7].ToString(); item.Product.Name = reader[8].ToString(); list.Add(item); } } return(list); }