/// <summary> /// 添加实体 /// </summary> /// <param name="entity">The entity.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Logintoken entity, OpertionUser opertionUser) { if (entity.Token.IsNull()) { return(new Result() { IsSucceed = false, Message = "Token不允许为空,请重试" }); } try { var ret = new LogintokenRepository(entity.Token).Add <Logintoken>(entity); DbLog.WriteDbLog(nameof(Logintoken), "添加记录", ret, entity.ToJsonString(), null, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); } catch (Exception ex) { FastDev.Log.LogHelper.WriteLog(ex, "LogintokenLogic.Add Entity异常"); return(new Result() { IsSucceed = false, Message = ex.Message }); } }
/// <summary> /// 删除数据,逗号连接多条 /// </summary> /// <param name="kid">主键ID,多个逗号连接</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Delete(string kid, OpertionUser opertionUser) { var deldic = new Dictionary <string, object>(); deldic.Add(nameof(Bloginfo.IsDeleted), 1); var keydic = new Dictionary <string, object>(); if (kid.IndexOf(",") > -1) { keydic.Add(nameof(Bloginfo.KID) + "|i", kid); } else { keydic.Add(nameof(Bloginfo.KID), kid); } var ret = BloginfoRepository.Instance.Update <Bloginfo>(deldic, keydic); DbLog.WriteDbLog(nameof(Bloginfo), "删除记录", kid, null, OperLogType.除, opertionUser); return(new Result() { IsSucceed = ret > 0 }); }
/// <summary> /// 修改次数 /// </summary> /// <param name="fields">需要修改的字段</param> /// <param name="addNums">次数 负数表示减少 正数表示增加</param> /// <param name="whereKey">字典条件</param> /// <param name="opertionUser">操作者信息</param> /// <returns></returns> public static Result UpdateNums(string fields, int addNums, Dictionary <string, object> whereKey, OpertionUser opertionUser) { var ret = BloginfoRepository.Instance.UpdateNums <Bloginfo>(fields, addNums, whereKey); DbLog.WriteDbLog(nameof(Bloginfo), "修改记录", whereKey.ToJsonString(), whereKey, OperLogType.编辑, opertionUser); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); }
/// <summary> /// Edits the specified dicwhere. /// </summary> /// <param name="valuedata">修改的值</param> /// <param name="dicwhere">修改条件</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result UpdateByWhere(Dictionary <string, object> valuedata, Dictionary <string, object> dicwhere, OpertionUser opertionUser) { var ret = BloginfoRepository.Instance.Update <Bloginfo>(valuedata, dicwhere); DbLog.WriteDbLog(nameof(Bloginfo), "批量修改记录", valuedata.ToJsonString(), valuedata, OperLogType.编辑, opertionUser); return(new Result() { IsSucceed = ret > 0 }); }
/// <summary> /// Edits the specified dicwhere. /// </summary> /// <param name="dicwhere">修改条件</param> /// <param name="kID">当前数据主键KID</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Update(Dictionary <string, object> dicwhere, int kID, OpertionUser opertionUser) { var ret = SysmenuRepository.Instance.UpdateByKey <Sysmenu>(dicwhere, kID); DbLog.WriteDbLog(nameof(Sysmenu), "修改记录", kID, dicwhere, OperLogType.编辑, opertionUser); return(new Result() { IsSucceed = ret > 0 }); }
/// <summary> /// Adds the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Dictionary <string, object> dicwhere, OpertionUser opertionUser) { var ret = SysmenuRepository.Instance.Add <Sysmenu>(dicwhere); DbLog.WriteDbLog(nameof(Sysmenu), "添加记录", ret, dicwhere.ToJsonString(), opertionUser, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); }
/// <summary> /// Deletes the specified kid. /// </summary> /// <param name="dicwhere">删除条件</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result DeleteByWhere(Dictionary <string, object> dicwhere, OpertionUser opertionUser) { var deldic = new Dictionary <string, object>(); deldic.Add(nameof(Bloginfo.IsDeleted), 1); var ret = BloginfoRepository.Instance.Update <Bloginfo>(deldic, dicwhere); DbLog.WriteDbLog(nameof(Bloginfo), "批量删除记录", dicwhere.ToJsonString(), dicwhere, OperLogType.除, opertionUser); return(new Result() { IsSucceed = ret > 0 }); }
/// <summary> /// Adds the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Dictionary <string, object> dicwhere, OpertionUser opertionUser) { var ret = CommentRepository.Instance.Add <Comment>(dicwhere); DbLog.WriteDbLog(nameof(Comment), "添加记录", ret, dicwhere.ToJsonString(), opertionUser, OperLogType.添加); Task.Run(() => { if (ret > 0) { CommentRepository.UpdateBloginfo(dicwhere[nameof(Comment.BlogNum)].ToString()); } }); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); }
/// <summary> /// Adds the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Dictionary <string, object> dicwhere, OpertionUser opertionUser) { try { var memid = dicwhere[nameof(ArticlePraise.MemberId)].ToString(); var blognum = dicwhere[nameof(ArticlePraise.BlogNum)].ToString(); var ap = ArticlePraiseLogic.GetModelByWhere(new Dictionary <string, object>() { { nameof(ArticlePraise.MemberId), memid }, { nameof(ArticlePraise.BlogNum), blognum } }); if (ap != null || ap?.KID > 0) { return(new Result() { IsSucceed = false, Message = "该文章你已点赞" }); } var ret = ArticlePraiseRepository.Instance.Add <ArticlePraise>(dicwhere); Task.Run(() => { if (ret > 0) { ArticlePraiseRepository.UpdateBloginfo(blognum); } }); DbLog.WriteDbLog(nameof(ArticlePraise), "添加记录", ret, dicwhere.ToJsonString(), opertionUser, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); } catch (Exception ex) { LogHelper.WriteLog(ex, "ArticlePraiseLogic/add"); return(new Result() { IsSucceed = false, Message = "系统错误" + ex.Message }); } }
/// <summary> /// Adds the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Dictionary <string, object> dicwhere, OpertionUser opertionUser) { try { var ret = AccessRepository.Instance.Add <Access>(dicwhere); DbLog.WriteDbLog(nameof(Access), "添加记录", ret, dicwhere.ToJsonString(), opertionUser, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); } catch (Exception ex) { LogHelper.WriteLog(ex, "AccessLogic/add"); return(new Result() { IsSucceed = false, Message = "系统错误" + ex.Message }); } }
/// <summary> /// Edits the specified dicwhere. /// </summary> /// <param name="dicwhere">修改条件</param> /// <param name="kID">当前数据主键KID</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Update(Dictionary <string, object> dicwhere, int kID, OpertionUser opertionUser) { var ret = ArticlePraiseRepository.Instance.UpdateByKey <ArticlePraise>(dicwhere, kID); Task.Run(() => { if (ret > 0) { var model = ArticlePraiseRepository.Instance.GetEntityByKey <ArticlePraise>(kID); ArticlePraiseRepository.UpdateBloginfo(model.BlogNum); } }); DbLog.WriteDbLog(nameof(ArticlePraise), "修改记录", kID, dicwhere, OperLogType.编辑, opertionUser); return(new Result() { IsSucceed = ret > 0 }); }
/// <summary> /// Edits the specified dicwhere. /// </summary> /// <param name="dicwhere">修改条件</param> /// <param name="kID">当前数据主键KID</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Update(Dictionary <string, object> dicwhere, int kID, OpertionUser opertionUser) { var res = new Result() { IsSucceed = false }; var ret = BloginfoRepository.Instance.UpdateByKey <Bloginfo>(dicwhere, kID); if (ret > 0) { var cont = ""; if (dicwhere.ContainsKey(nameof(Blogcontent.Content))) { cont = dicwhere[nameof(Blogcontent.Content)].ToString(); } var t = BlogcontentRepository.Instance.UpdateByKey <Blogcontent>(dicwhere, kID); res.IsSucceed = t > 0; } DbLog.WriteDbLog(nameof(Bloginfo), "修改记录", kID, dicwhere, OperLogType.编辑, opertionUser); return(res); }
/// <summary> /// 根据字典添加多条数据 /// </summary> /// <param name="diclst">The diclst.</param> /// <param name="opertionUser">操作者信息</param> /// <returns></returns> public static Result Adds(List <Dictionary <string, object> > diclst, OpertionUser opertionUser) { try { var ret = BloginfoRepository.Instance.Adds <Bloginfo>(diclst); DbLog.WriteDbLog <List <Dictionary <string, object> > >(nameof(Bloginfo), "添加记录", ret, diclst, opertionUser, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); } catch (Exception ex) { FastDev.Log.LogHelper.WriteLog(ex, "BloginfoLogic.Adds diclst异常"); return(new Result() { IsSucceed = false, Message = ex.Message }); } }
/// <summary> /// 添加实体 /// </summary> /// <param name="entity">The entity.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Bloginfo entity, OpertionUser opertionUser) { try { var ret = BloginfoRepository.Instance.Add <Bloginfo>(entity); DbLog.WriteDbLog(nameof(Bloginfo), "添加记录", ret, entity.ToJsonString(), opertionUser, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); } catch (Exception ex) { FastDev.Log.LogHelper.WriteLog(ex, "BloginfoLogic.Add Entity异常"); return(new Result() { IsSucceed = false, Message = ex.Message }); } }
/// <summary> /// 批量添加实体 /// </summary> /// <param name="entity">The entity.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Adds(List <Sysmenu> entity, OpertionUser opertionUser) { try { var ret = SysmenuRepository.Instance.Adds <Sysmenu>(entity); DbLog.WriteDbLog <List <Sysmenu> >(nameof(Sysmenu), "添加记录", ret, entity, opertionUser, OperLogType.添加); return(new Result() { IsSucceed = ret > 0, Message = ret.ToString() }); } catch (Exception ex) { FastDev.Log.LogHelper.WriteLog(ex, "SysmenuLogic.Add Entity异常"); return(new Result() { IsSucceed = false, Message = ex.Message }); } }
/// <summary> /// Adds the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="opertionUser">操作者信息</param> /// <returns>Result.</returns> public static Result Add(Dictionary <string, object> dicwhere, OpertionUser opertionUser) { var res = new Result() { IsSucceed = false }; if (!dicwhere.ContainsKey(nameof(Blogcontent.Content))) { return(new Result { IsSucceed = false }); } var ret = BloginfoRepository.Instance.Add <Bloginfo>(dicwhere); if (ret > 0) { var content = BlogcontentRepository.Instance.Add <Blogcontent>(new Dictionary <string, object>() { { nameof(Blogcontent.BloginfoNum), dicwhere[nameof(Blogcontent.BloginfoNum)] }, { nameof(Blogcontent.Content), dicwhere[nameof(Blogcontent.Content)] }, { nameof(Blogcontent.CreateUserId), dicwhere[nameof(Blogcontent.CreateUserId)] }, { nameof(Blogcontent.CreateUserName), dicwhere[nameof(Blogcontent.CreateUserName)] } }); if (content <= 0) { return(new Result { IsSucceed = false, Message = "部分添加失败" }); } res.IsSucceed = true; } DbLog.WriteDbLog(nameof(Bloginfo), "添加记录", ret, dicwhere.ToJsonString(), opertionUser, OperLogType.添加); return(res); }