Exemplo n.º 1
0
        public ActionResult AjaxVideoNewsEdit(VideoNewsParameter param)
        {
            var result = new JsonNetResult();
            var r      = new GeneralResponse();

            try
            {
                if (param.Forever)
                {
                    param.VideoNews.EndDate = new System.DateTime(9999, 12, 31, 23, 59, 59);
                }
                param.VideoNews.StartDate = TimeZoneInfo.ConvertTimeToUtc(param.VideoNews.StartDate,
                                                                          Section.Get.Common.TimeZone);
                param.VideoNews.EndDate = TimeZoneInfo.ConvertTimeToUtc(param.VideoNews.EndDate,
                                                                        Section.Get.Common.TimeZone);

                r.Code = (0L < param.VideoNews.VideoNewsId
                    ? VideoNewsTableProvider.Update(param)
                    : VideoNewsTableProvider.Create(param)).ToString(Section.Get.Common.Culture);
                //通知Master更新快取
                //  MasterServer.GetInstance().RefreshGameAnnouncements();
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                r.Code = "-11" + ex.Message;
            }
            result.Data = r;
            return(result);
        }
Exemplo n.º 2
0
        public ActionResult AjaxVideoNewsDeleteFile(VideoNewsParameter param)
        {
            var result = new JsonNetResult();

            Io.DeleteFile(HttpContext.Server.MapPath($"~{param.VideoNews.ImgPath}"));
            result.Data = new { Ststus = "OK" };
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public ActionResult VideoNews(VideoNewsParameter param)
 {
     param.KeyWord = HttpUtility.UrlDecode(param.KeyWord);
     return(View(
                new InternalDataTransferToView
     {
         List = VideoNewsTableProvider.List(param),
         Data = param
     }));
 }
Exemplo n.º 4
0
 public ActionResult VideoNewsEdit(VideoNewsParameter param)
 {
     if (0L < param.VideoNews.VideoNewsId)
     {
         param.VideoNews.Fill(VideoNewsTableProvider.Detail(param));
     }
     return(View(new InternalDataTransferToView {
         Data = param
     }));
 }
Exemplo n.º 5
0
 public static int Delete(VideoNewsParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.Write(CommandType.Text, " DELETE FROM [dbo].[VideoNews] WHERE VideoNewsId = @VideoNewsId;", new DbParameter[] {
             new SqlParameter {
                 Value = param.VideoNews.VideoNewsId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@VideoNewsId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
Exemplo n.º 6
0
 public static DataSet List(VideoNewsParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.DataSet(
                    CommandType.StoredProcedure,
                    "[dbo].[sp_VideoNewsList_Sel]",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.KeyWord,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@argStrKeyWord",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.StartUtcDateTime,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@argDteStart",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.EndUtcDateTime,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@argDteEnd",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Page,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@argIntPage",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.PageSize,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@argIntPageSize",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNewsType,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@argIntType",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
Exemplo n.º 7
0
 public static StringDictionary Detail(VideoNewsParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.First(
                    CommandType.Text,
                    "SELECT [VideoNewsId],[Sort], [Type],[ImgPath], [Link],[IsTop],[Title],  [TextBody], [StartDate],[EndDate],[CreateTime],[UpdateTime],[Status]FROM [dbo].[VideoNews] WITH(READUNCOMMITTED)WHERE [VideoNewsId] = @VideoNewsId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.VideoNews.VideoNewsId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@VideoNewsId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
Exemplo n.º 8
0
        public ActionResult AjaxVideoNewsDelete(VideoNewsParameter param)
        {
            var result = new JsonNetResult();
            var r      = new GeneralResponse();

            try
            {
                var detail = VideoNewsTableProvider.Detail(param);
                r.Code = VideoNewsTableProvider.Delete(param).ToString(Section.Get.Common.Culture);

                if (!string.IsNullOrEmpty(detail["ImgPath"]))
                {
                    Io.DeleteFile(System.Web.HttpContext.Current.Server.MapPath($"~{detail["ImgPath"]}"));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                r.Code = "-11";
            }
            result.Data = r;
            return(result);
        }
Exemplo n.º 9
0
 //Update
 public static int Update(VideoNewsParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.Write(
                    CommandType.Text,
                    "  UPDATE [dbo].[VideoNews]SET [Sort] = @Sort,[Type] = @Type,[ImgPath] = @ImgPath,[Link] = @Link,[IsTop] = @IsTop,[Title] = @Title,[TextBody] = @TextBody,[StartDate] = @StartDate,[EndDate] = @EndDate,[UpdateTime] = GETUTCDATE(),[Status] = @Status  WHERE [VideoNewsId] = @VideoNewsId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.VideoNews.VideoNewsId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@VideoNewsId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Sort,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@Sort",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.StartDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@StartDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.EndDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@EndDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Status,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Status",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Type,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Type",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Link,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 256,
                 ParameterName = "@Link",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 512,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.IsTop ? 1 : 0,
                 SqlDbType = SqlDbType.Bit,
                 ParameterName = "@IsTop",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Title,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 128,
                 ParameterName = "@Title",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.TextBody,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = -1,
                 ParameterName = "@TextBody",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
Exemplo n.º 10
0
 public static int Create(VideoNewsParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.Write(
                    CommandType.Text,
                    "INSERT INTO [dbo].[VideoNews]([Sort],[Type],[Link],[ImgPath],[IsTop],[Title],[TextBody],[StartDate],[EndDate],[Status],[CreateTime],[UpdateTime])VALUES(@Sort,@Type,@Link,@ImgPath,@IsTop,@Title,@TextBody,@StartDate,@EndDate,@Status,GETUTCDATE(),GETUTCDATE());",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.VideoNews.Sort,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@Sort",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.StartDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@StartDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.EndDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@EndDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Status,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Status",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Type,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Type",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Link,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 256,
                 ParameterName = "@Link",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 512,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.IsTop ? 1 : 0,
                 SqlDbType = SqlDbType.Bit,
                 ParameterName = "@IsTop",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.Title,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 128,
                 ParameterName = "@Title",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.VideoNews.TextBody,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = -1,
                 ParameterName = "@TextBody",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }