public async Task <bool> UpdateGeneralBeautyServerCodeProductsAsync(ThirdPartyBeautyPackageProductConfigModel model)
        {
            #region SQL
            string sql = @"Update [Tuhu_groupon].[dbo].[ThirdPartyBeautyPackageProductConfig] WITH(ROWLOCK) 
SET
  [Name]=@Name
 ,[CodeTypeConfigId]=@CodeTypeConfigId
 ,[IsActive]=@IsActive
 ,[UpdatedDateTime]=GetDate()
 ,[Description]=@Description 
WHERE  PKID=@PKID";
            #endregion
            using (var conn = new SqlConnection(strConn_Write))
            {
                var sqlPara = new[]
                {
                    new SqlParameter("Name", model.Name),
                    new SqlParameter("IsActive", model.IsActive),
                    new SqlParameter("Description", model.Description),
                    new SqlParameter("PKID", model.PKID),
                    new SqlParameter("CodeTypeConfigId", model.CodeTypeConfigId),
                };
                return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlPara) > 0);
            }
        }
        public async Task <bool> SaveGeneralBeautyServerCodeProductsAsync(ThirdPartyBeautyPackageProductConfigModel model)
        {
            #region SQL
            string sql = @"INSERT INTO  [Tuhu_groupon].[dbo].[ThirdPartyBeautyPackageProductConfig] 
( [CooperateId]
 ,[CodeTypeConfigId]
 ,[Name]
 ,[SettlementMethod]
 ,[SettlementPrice]
 ,[IsActive]
 ,[IsDeleted]
 ,[CreatedUser]
 ,[CreatedDateTime]
 ,[UpdatedDateTime]
 ,[Number]
 ,[PackageId]
 ,[Description]
 ,[ValidDate])
VALUES(
  @CooperateId
 ,@CodeTypeConfigId
 ,@Name
 ,@SettlementMethod
 ,@SettlementPrice
 ,@IsActive
 ,0
 ,@CreatedUser
 ,GetDate()
 ,GetDate()
 ,@Number
 ,@PackageId
 ,@Description
 ,@ValidDate
)";
            #endregion

            IEnumerable <ThirdPartyBeautyPackageProductConfigModel> result = new List <ThirdPartyBeautyPackageProductConfigModel>();
            using (var conn = new SqlConnection(strConn_Write))
            {
                var sqlPara = new[]
                {
                    new SqlParameter("CooperateId", model.CooperateId),
                    new SqlParameter("CodeTypeConfigId", model.CodeTypeConfigId),
                    new SqlParameter("Name", model.Name),
                    new SqlParameter("SettlementMethod", model.SettlementMethod),
                    new SqlParameter("SettlementPrice", model.SettlementPrice),
                    new SqlParameter("IsActive", model.IsActive),
                    new SqlParameter("CreatedUser", model.CreatedUser),
                    new SqlParameter("Number", model.Number),
                    new SqlParameter("PackageId", model.PackageId),
                    new SqlParameter("Description", model.Description),
                    new SqlParameter("ValidDate", model.ValidDate),
                };
                return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlPara) > 0);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存通用美容服务码产品服务详情
        /// </summary>
        /// <returns></returns>
        public async Task <JsonResult> SaveGeneralBeautyServerCodeProductDetail(ThirdPartyBeautyPackageProductConfigModel model)
        {
            var tmp = GeneralBeautyServerCodeManager.Instanse.GetGeneralBeautyServerCodeTmpDetail(model.PackageId);

            model.SettlementMethod = tmp.SettlementMethod;
            model.CreatedUser      = User.Identity.Name;
            var result = await GeneralBeautyServerCodeManager.Instanse.SaveGeneralBeautyServerCodeProductsAsync(model);

            return(Json(new { Result = result }));
        }
        public async Task <ThirdPartyBeautyPackageProductConfigModel> GetGeneralBeautyServerCodeProductsDetailAsync(int pkid)
        {
            #region SQL
            string sql = @"SELECT [PKID]
      ,[CooperateId]
      ,[CodeTypeConfigId]
      ,[Name]
      ,[SettlementMethod]
      ,[SettlementPrice]
      ,[IsActive]
      ,[CreatedUser]
      ,[CreatedDateTime]
      ,[UpdatedDateTime]
      ,[Number]
      ,[PackageId]
      ,[Description]
      ,[ValidDate]
  FROM [Tuhu_groupon].[dbo].[ThirdPartyBeautyPackageProductConfig] WITH(NOLOCK) 
  WHERE PKID=@PKID";
            #endregion

            ThirdPartyBeautyPackageProductConfigModel result = null;
            using (var conn = new SqlConnection(strConn_OnlyRead))
            {
                var sqlPara = new[]
                {
                    new SqlParameter("PKID", pkid)
                };
                var row = SqlHelper.ExecuteDataRow(conn, CommandType.Text, sql, sqlPara);
                if (row != null)
                {
                    result = new ThirdPartyBeautyPackageProductConfigModel
                    {
                        PKID             = row.GetValue <Int32>("PKID"),
                        CooperateId      = row.GetValue <Int32>("CooperateId"),
                        CodeTypeConfigId = row.GetValue <Int32>("CodeTypeConfigId"),
                        Name             = row.GetValue <String>("Name"),
                        SettlementMethod = row.GetValue <String>("SettlementMethod"),
                        SettlementPrice  = row.GetValue <decimal>("SettlementPrice"),
                        IsActive         = row.GetValue <Boolean>("IsActive"),
                        CreatedUser      = row.GetValue <String>("CreatedUser"),
                        CreatedDateTime  = row.GetValue <DateTime>("CreatedDateTime"),
                        UpdatedDateTime  = row.GetValue <DateTime>("UpdatedDateTime"),
                        Number           = row.GetValue <int>("Number"),
                        PackageId        = row.GetValue <Guid>("PackageId"),
                        Description      = row.GetValue <String>("Description"),
                        ValidDate        = row.GetValue <int>("ValidDate"),
                    }
                }
                ;
            }
            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取美容服务包下所有产品
        /// </summary>
        /// <param name="packageId"></param>
        /// <returns></returns>
        public async Task <ThirdPartyBeautyPackageProductConfigModel> GetGeneralBeautyServerCodeProductsDetailAsync(int pkid)
        {
            ThirdPartyBeautyPackageProductConfigModel result = null;

            try
            {
                result = await _DalGeneralBeautyServerCode.GetGeneralBeautyServerCodeProductsDetailAsync(pkid);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
            }
            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 保存美容服务包下产品
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <bool> SaveGeneralBeautyServerCodeProductsAsync(ThirdPartyBeautyPackageProductConfigModel model)
        {
            var result = false;

            try
            {
                if (model.PKID > 0)
                {
                    result = await _DalGeneralBeautyServerCode.UpdateGeneralBeautyServerCodeProductsAsync(model);
                }
                else
                {
                    result = await _DalGeneralBeautyServerCode.SaveGeneralBeautyServerCodeProductsAsync(model);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
            }
            return(result);
        }