public static int Create(UserCommentParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "INSERT INTO [dbo].[UserComment]([Name],[Title],[Comment],[ImgPath],[CreateTime])VALUES(@Name,@Title,@Comment,@ImgPath,GETUTCDATE());",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.Name,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Name",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Title,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Title",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Comment,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Comment",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#2
0
 public static int Update(OurGoal param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[OurGoal] SET [LeftImg] = @LeftImg,[RightImg] = @RightImg  WHERE [OurGoalId] = @OurGoalId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.LeftImg,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@LeftImg",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.RightImg,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@RightImg",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.OurGoalId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@OurGoalId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
            public static int DeleteActions(long id)
            {
                string sql = $"DELETE FROM [dbo].[Actions] WHERE ID={id}";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
            public static int Clear(long userId)
            {
                string sql = $"DELETE FROM [dbo].[UserAction] WHERE UserID={userId};";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
            public static int Update(long userId, string values)
            {
                string sql =
                    $"DELETE FROM [dbo].[UserRole] WHERE UserID={userId};INSERT INTO [dbo].[UserRole] ([UserID], [RoleID]) VALUES {values};";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
            public static int Update(long UserID, string Values)
            {
                string sql =
                    $"DELETE FROM [dbo].[UserAction]WHERE UserID={UserID};INSERT INTO [dbo].[UserAction] ([UserID], [ActionID])VALUES {Values};";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
            public static int Insert(RoleParameter param)
            {
                string sql =
                    $"INSERT INTO [dbo].[Role] ([Name], [Description], [Disable], [CreateTime], [UpdateTime])VALUES ('{param.Name}','{param.Description}', {param.Disable}, GETUTCDATE(), GETUTCDATE());";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
            public static int Update(RoleParameter param)
            {
                var sql =
                    Format(
                        "UPDATE [dbo].[Role]SET [Name]='{1}',[Description]='{2}',[Disable]={3},[UpdateTime]=GETUTCDATE()WHERE ID={0}",
                        param.ID, param.Name, param.Description, param.Disable);

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
            public static int ChangePassword(string account, string password, string encryptPassword)
            {
                var sql =
                    Format(
                        "UPDATE [dbo].[User]SET [Password]='{1}',[EncryptPassword]='{2}',UpdateTime=GETUTCDATE()WHERE [Account]='{0}'",
                        account, password, encryptPassword);

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
示例#10
0
            public static int Delete(RoleParameter param)
            {
                string sql =
                    $@"
                        DELETE FROM [dbo].[Role]
                        WHERE ID={param.ID}
                    ";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
 public static int Delete(AnnouncementParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(CommandType.Text, " DELETE FROM [dbo].[Announcement] WHERE AnnouncementId = @AnnouncementId;", new DbParameter[] {
             new SqlParameter {
                 Value = param.Announcement.AnnouncementId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@AnnouncementId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#12
0
            public static int UpdateActions(ActionParameter param)
            {
                var sql =
                    Format(
                        "UPDATE [dbo].[Actions]SET [Name]='{1}',[Description]='{2}',[Default]={3},[Area]='{4}',[Controller]='{5}',[Action]='{6}',[Type]={7},[Disable]={8},[UpdateTime]=GETUTCDATE() WHERE ID={0}",
                        param.ID, param.Name, param.Description, param.Default, param.Area, param.Controller,
                        param.Action,
                        param.Type,
                        param.Disable);

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
示例#13
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
             }
         }));
     }
 }
示例#14
0
 public static int Update(InvestorParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[Investor] SET [DocPath] = @DocPath, [TypesOfCatagory]=@TypesOfCatagory,[Titel]=@Titel,[HyperLink]=@HyperLink,[PublishDate]=@PublishDate,[UpdateTime]=GETUTCDATE() WHERE [InvestorId] = @InvestorId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.InvestorId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@InvestorId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.TypesOfCatagory ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@TypesOfCatagory",
                 Size = 256,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Titel ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Titel",
                 Size = 1024,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.HyperLink ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@HyperLink",
                 Size = 512,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.PublishDate,
                 SqlDbType = SqlDbType.Date,
                 ParameterName = "@PublishDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.DocPath,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@DocPath",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#15
0
            public static int InsertActions(List <ActionParameter> list)
            {
                var values = Join(",",
                                  list.Select(
                                      action =>
                                      $"('{action.Name}', '{action.Description}', {action.Default}, '{action.Area}', '{action.Controller}', '{action.Action}', {action.Type}, {0}, {"GETUTCDATE()"}, {"GETUTCDATE()"})")
                                  .ToArray());

                string sql =
                    $"INSERT INTO [dbo].[Actions] ([Name],[Description],[Default],[Area],[Controller],[Action],[Type],[Disable],[CreateTime],[UpdateTime])VALUES {values};";

                using (var db = new MsSql(DbName.Official)) {
                    return(db.Write(CommandType.Text, sql));
                }
            }
示例#16
0
 public static int UpdateSort(long functionId)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [Function] SET [Sort] = [dbo].[fn_GetSortCode]([FunctionId]);",
                    new DbParameter[] {
             new SqlParameter {
                 Value = functionId,
                 SqlDbType = SqlDbType.BigInt,
                 ParameterName = "@argIntFunctionId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
 public static int Delete(LiteratureParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "DELETE FROM [dbo].[Literature] WHERE [LiteratureId] = @LiteratureId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.LiteratureId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@LiteratureId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
 public static int Update(LiteratureParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[Literature] SET [TypesOfCancer]=@TypesOfCancer,[LiteratureTitel]=@LiteratureTitel,[HyperLink]=@HyperLink,[PublishDate]=@PublishDate,[UpdateTime]=GETUTCDATE() WHERE [LiteratureId] = @LiteratureId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.LiteratureId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@LiteratureId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.TypesOfCancer ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@TypesOfCancer",
                 Size = 256,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.LiteratureTitel ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@LiteratureTitel",
                 Size = 1024,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.HyperLink ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@HyperLink",
                 Size = 512,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.PublishDate,
                 SqlDbType = SqlDbType.Date,
                 ParameterName = "@PublishDate",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
 //Update
 public static int Update(UserCommentParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[UserComment] SET [Name] = @Name,[Title] = @Title,[ImgPath] = @ImgPath,[Comment] = @Comment WHERE [UserCommentId] = @UserCommentId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.UserCommentId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@UserCommentId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Name,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Name",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Title,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Title",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Comment,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Comment",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#20
0
 public static int UpdatePriority(long functionId, int priority, string code, string parent, int depth)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[Function] SET [Priority] = @argIntPriority, [Code] = @argStrCode, [Parent] = @argStrParent, [Depth] = @argIntDepth WHERE [FunctionId] = @argIntFunctionId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = functionId,
                 SqlDbType = SqlDbType.BigInt,
                 ParameterName = "@argIntFunctionId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = priority,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@argIntPriority",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = code,
                 SqlDbType = SqlDbType.VarChar,
                 ParameterName = "@argStrCode",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = parent,
                 SqlDbType = SqlDbType.VarChar,
                 ParameterName = "@argStrParent",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = depth,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@argIntDepth",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#21
0
 public static int Create(InvestorParameter param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.Write(
                    CommandType.Text,
                    "INSERT INTO [dbo].[Investor]([DocPath],[TypesOfCatagory],[Titel],[HyperLink],[PublishDate],[CreateTime])VALUES(@DocPath,@TypesOfCatagory,@Titel,@HyperLink,@PublishDate,GETUTCDATE());",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.TypesOfCatagory ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@TypesOfCatagory",
                 Size = 256,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Titel ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Titel",
                 Size = 1024,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.HyperLink ?? "",
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@HyperLink",
                 Size = 512,
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.PublishDate,
                 SqlDbType = SqlDbType.Date,
                 ParameterName = "@PublishDate",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
 public static int Update(Partner param)
 {
     using (var db = new MsSql(DbName.Official))
     {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[Partner] SET [ImgPath] = @ImgPath WHERE [PartnerId] = @PartnerId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.PartnerId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@PartnerId",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#23
0
 public static int Update(IndexBannerParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "UPDATE [dbo].[IndexBanner] SET [ImgPath] = @ImgPath,[Link] = @Link, [Align]=@Align,[FirstString] = @FirstString,[FirstStringColor] = @FirstStringColor,[SecondString] = @SecondString,[SecondStringColor] = @SecondStringColor,[ThreeString] = @ThreeString,[ThreeStringColor] = @ThreeStringColor WHERE [IndexBannerId] = @IndexBannerId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.IndexBannerId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@IndexBannerId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.FirstString,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@FirstString",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.FirstStringColor,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@FirstStringColor",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.SecondString,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@SecondString",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.SecondStringColor,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@SecondStringColor",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ThreeString,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ThreeString",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ThreeStringColor,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ThreeStringColor",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Align,
                 SqlDbType = SqlDbType.VarChar,
                 ParameterName = "@Align",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Link,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Link",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
 //Update
 public static int Update(AnnouncementParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "  UPDATE [dbo].[Announcement]SET [Sort] = @Sort,[Type] = @Type,[ImgPath] = @ImgPath,[Link] = @Link,[IsTop] = @IsTop,[Title] = @Title,[TextBody] = @TextBody,[StartDate] = @StartDate,[EndDate] = @EndDate,[UpdateTime] = GETUTCDATE(),[Status] = @Status  WHERE [AnnouncementId] = @AnnouncementId;",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Announcement.AnnouncementId,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@AnnouncementId",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Sort,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@Sort",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.StartDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@StartDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.EndDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@EndDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Status,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Status",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Type,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Type",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Link,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 256,
                 ParameterName = "@Link",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 512,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.IsTop ? 1 : 0,
                 SqlDbType = SqlDbType.Bit,
                 ParameterName = "@IsTop",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Title,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 128,
                 ParameterName = "@Title",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.TextBody,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = -1,
                 ParameterName = "@TextBody",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
 public static int Create(AnnouncementParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "INSERT INTO [dbo].[Announcement]([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.Announcement.Sort,
                 SqlDbType = SqlDbType.Int,
                 ParameterName = "@Sort",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.StartDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@StartDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.EndDate,
                 SqlDbType = SqlDbType.DateTime,
                 ParameterName = "@EndDate",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Status,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Status",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Type,
                 SqlDbType = SqlDbType.TinyInt,
                 ParameterName = "@Type",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Link,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 256,
                 ParameterName = "@Link",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 512,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.IsTop ? 1 : 0,
                 SqlDbType = SqlDbType.Bit,
                 ParameterName = "@IsTop",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.Title,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = 128,
                 ParameterName = "@Title",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Announcement.TextBody,
                 SqlDbType = SqlDbType.NVarChar,
                 Size = -1,
                 ParameterName = "@TextBody",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }
示例#26
0
 public static int Create(IndexBannerParameter param)
 {
     using (var db = new MsSql(DbName.Official)) {
         return(db.Write(
                    CommandType.Text,
                    "INSERT INTO [dbo].[IndexBanner]([ImgPath],[FirstString],[FirstStringColor],[SecondString],[SecondStringColor],[ThreeString],[ThreeStringColor],[Align],[Link],[CreateTime])VALUES(@ImgPath,@FirstString,@FirstStringColor,@SecondString,@SecondStringColor,@ThreeString,@ThreeStringColor,@Align,@Link,GETUTCDATE());",
                    new DbParameter[] {
             new SqlParameter {
                 Value = param.Entity.FirstString,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@FirstString",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.FirstStringColor,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@FirstStringColor",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.SecondString,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@SecondString",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.SecondStringColor,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@SecondStringColor",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ThreeString,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ThreeString",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ThreeStringColor,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ThreeStringColor",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Align,
                 SqlDbType = SqlDbType.VarChar,
                 ParameterName = "@Align",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.Link,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@Link",
                 Direction = ParameterDirection.Input
             },
             new SqlParameter {
                 Value = param.Entity.ImgPath,
                 SqlDbType = SqlDbType.NVarChar,
                 ParameterName = "@ImgPath",
                 Direction = ParameterDirection.Input
             }
         }));
     }
 }