Create letters, contract templates with rich text, save then in SQL Server table - sql

I need to dev a web app that permits users create or write their own templates for letters, contracts, or mails.
This templates must be written with Rich Text Formatted on a user interface like stack overflow use.
The user can use some names columns of a SQL Server table or view, to insert then in the text, similar what MS Word do.
Documents must be saved in a SQL table and then that text must be use to create the final view this the data of the related field.
Example:
Columns of table clients:
clientId Name ProductName
-----------------------------
1 Cris Tablet
Letter created by user:
Hello dear *Name*
We've send you your *ProductName*
Sincerly
My Company
Final view in html:
Hello dear Cris
We've send you your Tablet
Sincerly
My Company
I've work with asp.net and SQL Server... What do you recommend to achieve this?

This can be achieved using C#, i doubt if SQL alone can do it, which language are you using in asp.net?If it is C#, I can explain.

First
On the User login page
After Each user as logged on
On the Button Onclick event
Session["user"] = username.Text;
Response.Redirect("nameofthepagetocreateletter");
Second(To create the letter template)
On the nameofthepagetocreateletter
page_load event
loginname.Text = Session["user"].ToString();
also you will have a text control named "loginname", as well as 5 text field to write the letter
First text field-this will have its default value set to "Hello dear"
Second text field-this is the loginname
Third text field-this will have its default value set to "We've send you your"
Fourth text field-this is the product name field
Label field- this can be set as "sincerely"
Fifth text field-this is company name
I hope this helps.

Related

How to read RFC822 content as plain text?

First thing to note...I have tried a simple doc.computewithform(false,false) and it did not resolve this.
I have an agent set to run after new mail arrives. This agent will do different things depending on the email address it was sent to. Several email addresses are pointed to this mail-in db. So, in order for this to work, I need to read the 'sendto' field on the incoming email. Sometimes this value is plain text, and that works fine. Sometimes, depending on where the email was initiated, the sendto value is RFC822 text. I am hoping to find a way to convert this or extract from it the plain text representation of the sendto address.
I have a local memo form in this database that I could add an #Formula language function to, should one exist (so I could look there after the computewithform call).
If anyone has any ideas, I would be grateful for your input.
Matt
#Name([Abbreviate];SendTo) will extract the text from a field of RFC822 type 'Address'
or
The NotesName class in LotusScript can retrieve any part of a field of type 'RFC822 Text'

Asp.NET database multi-lang design [Include HTML]

,
I read lots of answer here and learn something about this topic but I need more help.Some pages in my project are getting the html(page body) from database.For my controls I use resx files and it works great, but now I need save the html values with multi-lang in my database.
I have a admin panel for my project and I edit sometimes the html or text or pictures in my editor and save it back to DB.I cache the html values in my website and get better performance for my project.But the html text parts is yet in my default lang I will create multi-lang.
I thought of a few possible solutions,
First solution was copying all of the same HTML data and create for all lang one by one
First solution problem : But later this doesnt make sense If I copy the values and create for other lang, then I had be repeating unnecessarily in my database the html values.
My second solution was like this :
this I hid it in the normal way in my DB (only a part of html in one column)
<li>Hello World</li>
<li>Hello Me</li>
Solution :
<li>[HelloWorld]</li>
<li>[HelloMe]</li>
string newHtmlValue = oldValue.ReplaceByLang("[HelloWorld]", GetCulture();,"Hallo Welt");
***// GetCulture(); return for this example german !
I create a new table for the replace text like the key is [HelloWorld]
1(ROW)- [HelloWorld] eng Hello World
2(ROW)- [HelloWorld] german Hallo Welt
3(ROW)- [HelloWorld] fr bonjour tout le monde
and in my project I select the right html value by culture lang.
Now my question is have you any better idea ?
I hope I've been clear and not messy, but if you need more informations I'll be glad to tell you more.Sorry for english.
I would prefer to store all your localized string in single repository like - DB or Satellite assembly.
For Example if you choose DB as repository - Define 3 tables (minimal structure)
1.Locale - Define your locale
2.Resourcemaster - Define your source string and reference Key and this key should be unique in you application and define a standard format like Module_Control_Section ..
3.LocalizedResource - Define your localized sting of Resourcemaster with Locale Key. Foreign key with ResourceMaster and Locale
In front End you can resole any string like control , Html string with localized string and Unique reference key.
Also Implement UI Caching / API caching for better performance.
Regards
Abdul

#Dblookup and formatting on web

I have been developing a web application using domino, therein I have dblookup-ing the field from notes client; Now, this is working fine but the format of value is missing while using on web.
For example in lotus notes client the field value format is as above
I am one, I am two, I am one , I am two, labbblallalalalalalalalalalalalalalalalalalaallllal
Labbbaalalalallalalalalalaalallaal
Hello there, labblalalallalalalllaalalalalalalalalalalalalalalalalalalalalalalala
Now when I retrieve the value of the field on web it seems it takes 2 immediate after 1. and so forth, I was expecting line feed here which is not happening.
The field above is multi valued field. Also on web I have used computed text which does db lookup from notes client.
Please help me what else could/alternate solution for this case.
Thanks
HD
Your multi-valued field has display options associated with it and the Notes client honors those. Obviously, your options are set up to display entries separated by newlines.
The computed text that you are using for the web does not have options like that and the field options are irrelevant because you aren't displaying the field. Your code has to insert the #Newlines. That's pretty easy because #DbLookup returns a list, and if you concatenate a list and a scalar, the scalar will be appended to each element of the list. (Look at the third example under "concatenation, pairwise" here to see what I mean.
The way you've worded your question is a little unclear to me, but what you need in your computed text formula is either something like this:
list := #DbLookup(etc,. etc.);
list + #Newline;
Or something like this:
multiValueFieldContainingListWithDbLookupResult + #NewLine;
I used #implode(Dblookupreturnedvalue;"");
thanks All :)

How to Personalize window behavior in odoo 8 livechat

How to Personalize window behavior in Odoo 8
Goals for now are:
add fields asking visitors Name, Email and Concern, As you can see at first image "A" the customer name is "Visitor"
change visitors name base on his/her Name input
change the design (background color, font, etc)
I already search on odoo documentation but no tutorials for Live Chat customization.
TIA
The appearance and the behaviour of the live_chat window is defined in the files addons/im_chat/static/src/js/im_chat.js, addons/im_chat/static/src/xml/im_chat.xml and addons/im_livechat/static/src/js/im_livechat.js
Depending on your needs your will have to modify these files. For the needs you have outlined in your question you have to:
1) add fields asking visitors Name, Email and Concern, As you can see
at first image "A" the customer name is "Visitor"
You have to modify the send_welcome_message function on the im_livechat.js in order for you to send a custom initial message and you have to change the im_chat.Conversation_message_bubble template in order to give each "text bubble" a different look (for example to insert a textbox asking for user's info)
2) change visitors name base on his/her Name input
When you collect your data, the user's name is saved in the variable defaultUsername in im_livechat.js, you will have to set it there
3) change the design (background color, font, etc)
All of this can happen from changing the template with the name = im_chat.Conversation_message_bubble from the im_chat.xml file accordingly.

Best way to add target ='_blank' for href in a string using UDF

I've got data in sql server 2012 that contains text with links test with out target i need to add target for the string data. I need to create a User defined function for that. Does any one have any sample code for this.
Example text -
If you've ever thought one of your text message threads was so good it deserved to be published, you may be on to something.view. njkhj In future iterations, users will be able to post .<br><br>You may update your email address at any time by going to sdffsd. Our whole goal is to have the reader go through an entire narrative arc in five minutes and consume it in a way that's native to mobile," says Gupta go to sdfsdf which is one of my favorite books, is told as letters back and forth between the two main
I think a simple replace would do the trick
Declare #String varchar(max) = 'Some large text with a link to content'
Select Replace(#String,' href=','_target="blank" href=')
Returns
(No column name)
Some large text with a <a _target="blank" href="test/test">link</a> to content
We can also use
SELECT REPLACE(text,'<a','<a target="_blank" ');
Go