Exemple #1
0
 /// <summary>
 /// 修改功能(sql语句修改)
 /// </summary>
 /// <param name="sqlStr"></param>
 /// <returns></returns>
 public int Update(string sqlStr)
 {
     try
     {
         return(dapperHelps.ExecuteSqlInt(sqlStr));
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         return(0);
     }
 }
Exemple #2
0
 /// <summary>
 /// 批量更新实体,返回更新状态
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="List"></param>
 /// <returns></returns>
 public bool UpdateList <T>(List <T> List) where T : class
 {
     try
     {
         if (List.Count <= 0)
         {
             return(false);
         }
         return(dapperHelps.ExecuteUpdateList <T>(List));
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         return(false);
     }
 }
Exemple #3
0
 /// <summary>
 /// 修改单个实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateModel <T>(T model) where T : class
 {
     try
     {
         if (model == null)
         {
             return(false);
         }
         return(dapperHelps.UpdateModel <T>(model));
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         return(false);
     }
 }
Exemple #4
0
 /// <summary>
 /// 添加集合
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="modelList"></param>
 /// <returns></returns>
 public bool InsertList <T>(List <T> modelList) where T : class
 {
     try
     {
         if (modelList.Count <= 0)
         {
             return(false);
         }
         dapperHelps.ExecuteInsertList <T>(modelList);
         return(true);
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         return(false);
     }
 }
Exemple #5
0
 /// <summary>
 /// 新增操作(主键为Guid)
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="model"></param>
 /// <returns></returns>
 public string InsertModelGuid <T>(T model) where T : class
 {
     try
     {
         if (model == null)
         {
             return(String.Empty);
         }
         var id = dapperHelps.ExecuteInsertGuid <T>(model);
         return(id);
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         return(String.Empty);
     }
 }
Exemple #6
0
 /// <summary>
 /// 新增操(主键为Int类型)
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="model"></param>
 /// <returns></returns>
 public long InsertModelInt <T>(T model) where T : class
 {
     try
     {
         if (model == null)
         {
             return(0);
         }
         var id = dapperHelps.ExecuteInsert <T>(model);
         return(id);
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         return(0);
     }
 }
Exemple #7
0
 /// <summary>
 /// 批量修改返回成功和失败的条数
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="List"></param>
 /// <param name="ErrorCount"></param>
 /// <returns></returns>
 public int UpdateList <T>(List <T> List, out int ErrorCount) where T : class
 {
     try
     {
         if (List.Count <= 0)
         {
             ErrorCount = 0;
             return(0);
         }
         return(dapperHelps.ExecuteUpdateList <T>(List, out ErrorCount));
     }
     catch (Exception ex)
     {
         WriteLogMethod.WriteLogs(ex);
         ErrorCount = 0;
         return(0);
     }
 }