Beispiel #1
0
        /// <summary>
        /// 保存要发送的营收信息
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public bool SaveRevenueMsg(Business_WeChatPush_Information weChatPush, Business_WeChatPushDetail_Information weChatPushDetail)
        {
            using (SqlSugar.SqlSugarClient _dbMsSql = SugarDao.SugarDao_MsSql.GetInstance())
            {
                bool result = false;
                try
                {
                    _dbMsSql.BeginTran();
                    result = _dbMsSql.Insert <Business_WeChatPush_Information>(weChatPush, false) != DBNull.Value;
                    if (result)
                    {
                        //短信接收者
                        result = _dbMsSql.Insert <Business_WeChatPushDetail_Information>(weChatPushDetail, false) != DBNull.Value;
                    }
                    _dbMsSql.CommitTran();
                }
                catch (Exception ex)
                {
                    Common.LogHelper.LogHelper.WriteLog(ex.Message);
                    _dbMsSql.RollbackTran();
                }
                finally
                {
                }

                return(result);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 插入
        /// 使用说明:sqlSugar.Insert(entity);
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity">插入对象</param>
        /// <param name="isIdentity">主键是否为自增长,true可以不填,false必填</param>
        /// <returns></returns>
        public object Insert <T>(T entity, bool isIdentity = true) where T : class
        {
            var connName = CloudPubMethod.GetConnection(this.configList);
            var db       = new SqlSugarClient(connName);

            SettingConnection(db);
            return(db.Insert <T>(entity, isIdentity));
        }
 /// <summary>
 /// 保存系统操作日志
 /// </summary>
 /// <param name="operationLogModel"></param>
 /// <returns></returns>
 public void SaveLog(Business_OperationLog operationLogModel)
 {
     using (SqlSugar.SqlSugarClient _dbMsSql = SugarDao.SugarDao_MsSql.GetInstance())
     {
         bool result = false;
         try
         {
             result = _dbMsSql.Insert <Business_OperationLog>(operationLogModel, false) != DBNull.Value;
         }
         catch (Exception ex)
         {
             Common.LogHelper.LogHelper.WriteLog(ex.Message + "/n" + ex.ToString() + "/n" + ex.StackTrace);
         }
     }
 }