public JsonResult Add()
        {
            var Video        = "Http://" + Request.Url.Authority.ToString() + Request["Video"] ?? "";
            var desc_content = Request["desc_content"] ?? "";

            if (Video == "")
            {
                return(Json(new BaseResponse {
                    result = false, msg = "请求参数不能为空"
                }));
            }

            var creativeEntity = new CreativeEntity
            {
                CreateTime     = DateTime.Now.ToString(),
                DataType       = "1",
                Introduce      = desc_content,
                LastUpdateTime = DateTime.Now.ToString(),
                SourceID       = "SMALL_VIDEO_" + new Random(Guid.NewGuid().GetHashCode()).Next(0, 999999999).ToString("d5").PadRight(8, '0'),
                Status         = "0",
                VideoUrl       = Video,
                UserManageId   = base.UserInfo.UserManageID,
                UserName       = base.UserInfo.UserName,
                BusinessID     = base.UserInfo.BusinessID
            };

            var caResponse = CreativeLogic.Insert(creativeEntity);

            return(Json(caResponse));
        }
Exemple #2
0
        public BaseResponse Insert(CreativeEntity request)
        {
            var res = creativeCmd.Inser(request);

            return(new BaseResponse
            {
                result = res,
                msg = res ? "成功" : "操作失败"
            });
        }
        public bool Inser(CreativeEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tblSourceMaterial (");
            strSql.Append("SourceID,VideoUrl,Introduce,LastUpdateTime,CreateTime,Status,DataType,UserManageId,UserName,BusinessID)");
            strSql.Append(" values (");
            strSql.Append("@SourceID,@VideoUrl,@Introduce,@LastUpdateTime,@CreateTime,@Status,@DataType,@UserManageId,@UserName,@BusinessID)");
            strSql.Append(";select @@IDENTITY");

            using (IDbConnection connection = new SqlConnection(DBConnectionStringConfig.Default.JMGGConnectionString))
            {
                return(connection.Execute(strSql.ToString(), model) > 0);
            }
        }
Exemple #4
0
        public void ConstructWithBuilder()
        {
            var srcEntity = new SrcEntity
            {
                Name = "Slim",
                Val  = 1001
            };

            var mapper = new Mapper();

            mapper.Register <SrcEntity, CreativeEntity>().ConstructWith(kgva => CreativeEntity.Build(kgva.Val));
            var destEntity = mapper.Map <SrcEntity, CreativeEntity>(srcEntity);

            Assert.AreEqual("Slim", destEntity.Name);
            Assert.AreEqual(1001, destEntity.Val);
        }