public ResponseDto SavePersonProduct(PersonProductIncludeExcludeDto saveDto)
        {
            ResponseDto responseDto = new ResponseDto();

            PersonProductIncludeExcludeBo saveBo = new PersonProductIncludeExcludeBo()
            {
                PersonProductId = saveDto.PersonProductId,
                IsInclude       = saveDto.IsInclude,

                IncludeExcludeList = saveDto.IncludeExcludeList == null ? null :
                                     (from x in saveDto.IncludeExcludeList
                                      select new IncludeExcludeBo()
                {
                    Id = x.Id,
                    Name = x.Name,
                    PriceGap = x.PriceGap
                }).ToList(),

                Session = Session
            };

            ResponseBo responseBo = ieBusiness.SavePersonProduct(saveBo);

            responseDto = responseBo.ToResponseDto();

            return(responseDto);
        }
示例#2
0
        public ResponseBo SavePersonProduct(PersonProductIncludeExcludeBo saveBo)
        {
            ResponseBo responseBo = new ResponseBo();

            try
            {
                string includeExcludeListJson = null;
                if (saveBo.IncludeExcludeList != null && saveBo.IncludeExcludeList.Count() > 0)
                {
                    includeExcludeListJson = JsonConvert.SerializeObject(saveBo.IncludeExcludeList);
                }

                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255);
                    p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output);

                    p.Add("@PersonProductId", saveBo.PersonProductId, DbType.Int64, ParameterDirection.Input);
                    p.Add("@IsInclude", saveBo.IsInclude, DbType.Boolean, ParameterDirection.Input);

                    p.Add("@IncludeExcludeListJson", includeExcludeListJson, DbType.String, ParameterDirection.Input, int.MaxValue);

                    p.Add("@MyPersonId", saveBo.Session.MyPerson.Id, DbType.Int64, ParameterDirection.Input);
                    p.Add("@OperatorRealId", saveBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input);
                    p.Add("@LanguageId", saveBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input);

                    conn.Execute("spPersonProductIncludeExcludeSave", p, commandType: CommandType.StoredProcedure);
                    responseBo.Message   = p.Get <string>("@Message");
                    responseBo.IsSuccess = p.Get <bool>("@IsSuccess");
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, saveBo);
            }

            return(responseBo);
        }