Advertisement
smaction

StreamWRiter q

Jan 26th, 2022
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.69 KB | None | 0 0
  1.     public static string PCardRTFtoPDF(
  2.       string sId,
  3.       SqlConnection dbConnection1,
  4.       string sAppType,
  5.       string sFilenameId)
  6.     {
  7.       string str1 = "E:\\VS\\";
  8.       using (dbConnection1)
  9.       {
  10.         dbConnection1.Open();
  11.         using (SqlCommand sqlCommand = new SqlCommand("InputData_SelectByInputMainId", dbConnection1))
  12.         {
  13.           sqlCommand.CommandType = CommandType.StoredProcedure;
  14.           sqlCommand.Parameters.Add(new SqlParameter("InputMainId", (object) sId));
  15.           SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
  16.           StreamReader streamReader = new StreamReader(str1 + "PCARD_Template" + sAppType + "_V6.rtf");
  17.           string str2 = streamReader.ReadToEnd();
  18.           streamReader.Close();
  19.           while (sqlDataReader.Read())
  20.           {
  21.             string str3 = sqlDataReader["ControlId"].ToString();
  22.             string newValue = sqlDataReader["ControlValue"].ToString();
  23.             if (str3 == "rblApplicationType")
  24.             {
  25.               if (!(sAppType == "0"))
  26.               {
  27.                 if (!(sAppType == "1"))
  28.                 {
  29.                   if (!(sAppType == "2"))
  30.                   {
  31.                     if (!(sAppType == "4"))
  32.                     {
  33.                       if (!(sAppType == "5"))
  34.                       {
  35.                         if (sAppType == "6")
  36.                           newValue = "Renewal - Liaison";
  37.                       }
  38.                       else
  39.                         newValue = "Renewal - Departmental";
  40.                     }
  41.                     else
  42.                       newValue = "Renewal - Individual";
  43.                   }
  44.                   else
  45.                     newValue = "Liaison";
  46.                 }
  47.                 else
  48.                   newValue = "Departmental";
  49.               }
  50.               else
  51.                 newValue = "Individual";
  52.             }
  53.             else if (str3 == "tbMMNP" && newValue.Length > 0)
  54.               newValue = "*****";
  55.             else if (str3 == "tbDOB" && newValue.Length > 0)
  56.               newValue = "*****";
  57.             else if (str3 == "tbCardholdersList")
  58.               newValue = newValue.Replace('\r', ';').Replace('\n', ' ');
  59.             str2 = str2.Replace("[" + str3 + "]", newValue);
  60.           }
  61.           sqlDataReader.Close();
  62.           string str4 = str2.Replace("[TodayDate]", DateTime.Now.ToShortDateString());
  63.           string str5 = "PCardAppOutput" + sId + sFilenameId + ".rtf";
  64.           StreamWriter streamWriter = new StreamWriter(str1 + str5);
  65.           streamWriter.Write(str4);
  66.           streamWriter.Close();
  67.           return str5.Replace(".rtf", ".pdf");
  68.         }
  69.       }
  70.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement