Beispiel #1
0
        public static VoiceTheme GetVoiceThemeById(int voiceThemeId)
        {
            VoiceTheme theme = SQLDataAccess.ExecuteReadOne("SELECT [VoiceThemeID], [PSYID], [Name], [IsHaveNullVoice], [IsDefault], [IsClose], [DateAdded], [DateModify], (SELECT SUM([CountVoice]) FROM [Voice].[Answer] WHERE (FKIDTheme = [Voice].[VoiceTheme].[VoiceThemeID]) AND (IsVisible = 1)) AS [CountVoice] FROM [Voice].[VoiceTheme] WHERE [VoiceThemeID] = @VoiceThemeID ORDER BY [IsDefault] DESC, [PSYID] ASC",
                                                            CommandType.Text, GetVoiceThemeFromReader, new SqlParameter("@VoiceThemeID", voiceThemeId));

            return(theme);
        }
Beispiel #2
0
        public static VoiceTheme GetTopTheme()
        {
            VoiceTheme theme = SQLDataAccess.ExecuteReadOne(
                "SELECT TOP (1) [VoiceThemeID], [PSYID], [Name], [IsHaveNullVoice], [IsDefault], [IsClose], [DateAdded], [DateModify], (SELECT SUM([CountVoice]) FROM [Voice].[Answer] WHERE (FKIDTheme = [Voice].[VoiceTheme].[VoiceThemeID]) AND (IsVisible = 1)) AS [CountVoice] FROM [Voice].[VoiceTheme] ORDER BY [IsDefault] DESC, [PSYID] ASC",
                CommandType.Text, GetVoiceThemeFromReader);

            return(theme);
        }
Beispiel #3
0
 public static void AddTheme(VoiceTheme voiceTheme)
 {
     SQLDataAccess.ExecuteNonQuery("INSERT INTO [Voice].[VoiceTheme] ([PsyID], [Name], [IsDefault], [IsHaveNullVoice], [IsClose], [DateAdded], [DateModify]) VALUES ( @PsyID, @Name, @IsDefault, @IsHaveNullVoice, @IsClose, GETDATE(), GETDATE())",
                                     CommandType.Text,
                                     new SqlParameter("@Name", voiceTheme.Name),
                                     new SqlParameter("@PsyID", voiceTheme.PsyId),
                                     new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                     new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                     new SqlParameter("@IsClose", voiceTheme.IsClose)
                                     );
 }
Beispiel #4
0
 public static void AddTheme(VoiceTheme voiceTheme)
 {
     SQLDataAccess.ExecuteNonQuery("INSERT INTO [Voice].[VoiceTheme] ([PsyID], [Name], [IsDefault], [IsHaveNullVoice], [IsClose], [DateAdded], [DateModify]) VALUES ( @PsyID, @Name, @IsDefault, @IsHaveNullVoice, @IsClose, GETDATE(), GETDATE())",
                                   CommandType.Text,
                                   new SqlParameter("@Name", voiceTheme.Name),
                                   new SqlParameter("@PsyID", voiceTheme.PsyId),
                                   new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                   new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                   new SqlParameter("@IsClose", voiceTheme.IsClose)
                                   );
 }
Beispiel #5
0
 public static void UpdateTheme(VoiceTheme voiceTheme)
 {
     SQLDataAccess.ExecuteNonQuery("Update [Voice].[VoiceTheme] set [PsyID]=@PsyID, [Name]=@Name, [IsDefault]=@IsDefault, [IsHaveNullVoice]=@IsHaveNullVoice, [IsClose]=@IsClose, [DateModify]=GetDate() where VoiceThemeId = @VoiceThemeId",
                                   CommandType.Text,
                                   new SqlParameter("@PsyID", voiceTheme.PsyId),
                                   new SqlParameter("@Name", voiceTheme.Name),
                                   new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                   new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                   new SqlParameter("@IsClose", voiceTheme.IsClose),
                                   new SqlParameter("@VoiceThemeId", voiceTheme.VoiceThemeId)
                                   );
 }
Beispiel #6
0
 public static void InsertVoiceTheme(VoiceTheme voiceTheme)
 {
     voiceTheme.VoiceThemeId = SQLDataAccess.ExecuteScalar <int>(@"INSERT INTO [Voice].[VoiceTheme] ([PSYID], [Name], [IsHaveNullVoice], [IsDefault], [IsClose], [DateAdded], [DateModify]) VALUES(@PSYID,  @Name,  @IsHaveNullVoice,  @IsDefault,  @IsClose,  @DateAdded,  @DateModify); SELECT scope_identity();",
                                                                 CommandType.Text,
                                                                 new SqlParameter("@PSYID", voiceTheme.PsyId),
                                                                 new SqlParameter("@Name", voiceTheme.Name),
                                                                 new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                                                 new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                                                 new SqlParameter("@IsClose", voiceTheme.IsClose),
                                                                 new SqlParameter("@DateAdded", voiceTheme.DateAdded),
                                                                 new SqlParameter("@DateModify", voiceTheme.DateModify)
                                                                 );
 }
Beispiel #7
0
 public static void UpdateVoiceTheme(VoiceTheme voiceTheme)
 {
     SQLDataAccess.ExecuteNonQuery(@"UPDATE [Voice].[VoiceTheme] SET [PSYID] = @PSYID, [Name] = @Name, [IsHaveNullVoice] = @IsHaveNullVoice, [IsDefault] = @IsDefault, [IsClose] = @IsClose, [DateAdded] = @DateAdded, [DateModify] = @DateModify WHERE [VoiceThemeID] = @VoiceThemeID",
                                   CommandType.Text,
                                   new SqlParameter("@VoiceThemeID", voiceTheme.VoiceThemeId),
                                   new SqlParameter("@PSYID", voiceTheme.PsyId),
                                   new SqlParameter("@Name", voiceTheme.Name),
                                   new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                   new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                   new SqlParameter("@IsClose", voiceTheme.IsClose),
                                   new SqlParameter("@DateAdded", voiceTheme.DateAdded),
                                   new SqlParameter("@DateModify", voiceTheme.DateModify)
                                   );
 }
Beispiel #8
0
 public static void UpdateVoiceTheme(VoiceTheme voiceTheme)
 {
     SQLDataAccess.ExecuteNonQuery(@"UPDATE [Voice].[VoiceTheme] SET [PSYID] = @PSYID, [Name] = @Name, [IsHaveNullVoice] = @IsHaveNullVoice, [IsDefault] = @IsDefault, [IsClose] = @IsClose, [DateAdded] = @DateAdded, [DateModify] = @DateModify WHERE [VoiceThemeID] = @VoiceThemeID",
                                     CommandType.Text,
                                     new SqlParameter("@VoiceThemeID", voiceTheme.VoiceThemeId),
                                     new SqlParameter("@PSYID", voiceTheme.PsyId),
                                     new SqlParameter("@Name", voiceTheme.Name),
                                     new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                     new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                     new SqlParameter("@IsClose", voiceTheme.IsClose),
                                     new SqlParameter("@DateAdded", voiceTheme.DateAdded),
                                     new SqlParameter("@DateModify", voiceTheme.DateModify)
                                     );
 }
Beispiel #9
0
 public static void UpdateTheme(VoiceTheme voiceTheme)
 {
     SQLDataAccess.ExecuteNonQuery("Update [Voice].[VoiceTheme] set [PsyID]=@PsyID, [Name]=@Name, [IsDefault]=@IsDefault, [IsHaveNullVoice]=@IsHaveNullVoice, [IsClose]=@IsClose, [DateModify]=GetDate() where VoiceThemeId = @VoiceThemeId",
                                     CommandType.Text,
                                     new SqlParameter("@PsyID", voiceTheme.PsyId),
                                     new SqlParameter("@Name", voiceTheme.Name),
                                     new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                     new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                     new SqlParameter("@IsClose", voiceTheme.IsClose),
                                     new SqlParameter("@VoiceThemeId", voiceTheme.VoiceThemeId)
                                     );
 }
Beispiel #10
0
 public static void InsertVoiceTheme(VoiceTheme voiceTheme)
 {
     voiceTheme.VoiceThemeId = SQLDataAccess.ExecuteScalar<int>(@"INSERT INTO [Voice].[VoiceTheme] ([PSYID], [Name], [IsHaveNullVoice], [IsDefault], [IsClose], [DateAdded], [DateModify]) VALUES(@PSYID,  @Name,  @IsHaveNullVoice,  @IsDefault,  @IsClose,  @DateAdded,  @DateModify); SELECT scope_identity();",
                                          CommandType.Text,
                                          new SqlParameter("@PSYID", voiceTheme.PsyId),
                                          new SqlParameter("@Name", voiceTheme.Name),
                                          new SqlParameter("@IsHaveNullVoice", voiceTheme.IsHaveNullVoice),
                                          new SqlParameter("@IsDefault", voiceTheme.IsDefault),
                                          new SqlParameter("@IsClose", voiceTheme.IsClose),
                                          new SqlParameter("@DateAdded", voiceTheme.DateAdded),
                                          new SqlParameter("@DateModify", voiceTheme.DateModify)
                                          );
 }
        protected string GetHtmlThemeTable(VoiceTheme voiceTheme)
        {
            var sb = new StringBuilder();
            sb.Append("<table border=\"0\" cellpadding=\"3px\" cellspacing=\"0\" style=\"width: 100%; height: 100%;\">");

            foreach (var answer in voiceTheme.Answers)
            {
                sb.Append(GetHtmlAnswerRow(answer));
            }

            sb.Append("</table>");
            return sb.ToString();
        }
        protected string GetHtmlThemeName(VoiceTheme voiceTheme)
        {
            string str = voiceTheme.IsDefault
                             ? "<span class=\"ThemeNameDefault\">" + voiceTheme.Name + "</span> "
                             : "<span class=\"ThemeName\">" + voiceTheme.Name + "</span> ";

            if (voiceTheme.IsClose)
            {
                str += " " + Resources.Resource.Admin_VotingHistory_ClosedWithBrakets;
            }

            return str;
        }