Template:
[Ownername] [ownertitle], hello! I'm a [projectname] Insurance Company clerk [username], your [quotecontent]. If you are not clear, contact the service hotline: (PublicCompany [projectcontactphone]) or (personal [usermobilephone]). Thank you for checking it! Wish you good health!
Task: Set […] Content is replaced with the actual content
Code:
String SQL = "declare @ ownermobile varchar (250) \ r \ n ";
SQL + = "declare @ ownername varchar (250) \ r \ n ";
SQL + = "declare @ ownertitle varchar (250) \ r \ n ";
SQL + = "declare @ projectname varchar (100) \ r \ n ";
SQL + = "declare @ username varchar (100) \ r \ n ";
SQL + = "declare @ projectcontactphone varchar (100) \ r \ n ";
SQL + = "declare @ usermobilephone varchar (100) \ r \ n ";
SQL + = "declare @ quotecontent varchar (4000) \ r \ n ";
SQL + = "declare @ messagetemplate varchar (1000) \ r \ n ";
SQL + = "select @ ownermobile =. mobile, @ ownername =. ownername, @ ownertitle = case. sex when '1' Mr. 'when' 2 'then' Miss 'else' 'end, @ quotecontent = B. quotecontent, @ projectname = C. projectname, @ projectcontactphone = C. contactphone, @ username = D. username, @ usermobilephone = isnull (D. mobilephone, ''), @ messagetemplate = C. messagetemplate from [sales_carowners] A \ r \ n"
+ "Left join [sales_quotebill] B on A. [carid] = B. [carid] \ r \ n"
+ "Left join [sales_system_project] C on B. projectid = C. ID \ r \ n"
+ "Left join [system_users] D on B. quoteuserid = D. userid \ r \ n"
+ "Where B. [ID] =" + quoteid + "\ r \ n ";
// Replace
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[ownername]', @ ownername) \ r \ n ";
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[ownertitle]', @ ownertitle) \ r \ n ";
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[projectname]', @ projectname) \ r \ n ";
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[username]', @ username) \ r \ n ";
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[quotecontent]', @ quotecontent) \ r \ n ";
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[projectcontactphone]', @ projectcontactphone) \ r \ n ";
SQL + = "set @ messagetemplate = Replace (@ messagetemplate, '[usermobilephone]', @ usermobilephone) \ r \ n ";