sábado, 27 de octubre de 2012

Email phrase bank: Useful expressions and phrases

Commercial: Request for information (customer)
Saying how you got the contact
We met last Thursday on your stand at the Munich Trade Fair.
I am emailing you off your website, which I found through Google.
Giving reason for writing
We are a manufacturer / supplier / provider of ... We are interested in ...
We are a Turkish company exporting to the EU, and we need ...
General requests
We would be grateful for some information about ...
Please send us information about your product range and prices.
Specific requests
In particular, we would like to know ...
Please send full details of your prices, discounts, terms of payment and delivery times.
Could you also say whether there is any minimum order.
Close
An early reply would be greatly appreciated.
I look forward to an early reply, and am sure that there is a market for your products here in Hungary.

Giving information (supplier)
Thanks
Thank you for your email of 4 June inquiring about ...
Giving factual information
We can quote a price of ... CIF / FOB Istanbul.
We can delivery by ... (date) / within ... (period of time)
The goods will be shipped 3 days from receipt of a firm order.
We can offer a discount of ... on orders over ... .
We require payment by bank transfer / letter of credit.
Our normal procedure is to ...
Our normal terms for first-time customers are ...
We can supply the items you require directly from stock.
Saying what you are attaching
I am attaching a document that gives full details of ...
I am attaching our current catalogue and price list as a pdf file.
Highlighting one or two key points
You will see that ...
You will note that our line of .... is on special offer.

Answering specific questions
You will also note that ... Our experience in this field includes ...
We dispatch the goods within 24 hours of a firm order, and for first-time customers our minimum order is $ 1,000.
I am afraid that model is no longer available. However, ...
Close
We feel sure that ... May I suggest that I call you at your convenience to discuss the matter further?
If you need any further information, please do not hesitate to contact me. My direct line is...

Making an order (customer)
Open
Thank you for your recent email, and we accept your quotation. Our completed order form is attached, and we give full bank details below.
Close
Please acknowledge receipt of this order.

Confirming an order (supplier)
Open
Your order has been received.
We can confirm that your goods have been shipped.
You can track shipping details on our website.
Due to exceptional demand these items are temporarily out of stock. We hope to be able to ship your order within ... days and will keep you fully informed. We apologize for any inconvenience this may cause.
Close
We are confident that the goods will meet your expectations. Should there be any questions, please do not hesitate to contact me, either by email or phone

Asking for payment (supplier)
First reminder – open
We are writing concerning a payment of $12,600 for invoice number KJ678 which is now overdue. A copy of the invoice is attached.
According to our records, the sum of $4,500 is still outstanding on your account
First reminder – action
Please send a bank transfer to settle the account, or an explanation of why the balance is still outstanding. If you have already dealt with this matter, please disregard this email.
We could appreciate your cooperation in resolving this matter as soon as possible.
Second/third reminder – open
On (date) I wrote to you regarding your company’s unpaid account , amounting to $4,500. May we please remind you that this amount is still outstanding.
I wish to draw your attention to my previous emails of (dates) about the overdue payment on your account. We are very concerned that the matter has not yet receive your attention.
Second/third reminder – action
We need a bank transfer in full settlement without further delay.
Clearly, this situation cannot be allowed to continue, and we must ask you to take immediate action to settle your account.
If you have any queries on this mater, please do not hesitate to contact me. Thank you for your cooperation.
Final demand – open
Following my emails of (dates) I must inform you that we have still not received payment for the outstanding sum of $4,500.
I wrote to you on (dates) regarding the balance of $12,600 on your account. I attach copies of both emails. This sum is now two months overdue. We are very concerned that the matter has not yet received your attention.
Final demand – action
Unless we receive payment within seven days, we shall have no alternative but to take legal action to recover the money.
In the meantime, your existing credit facilities have been suspended.

Complaints and Apologies
Complaining (customer)
Open
I am writing ...
in connection with my order FS690 which arrived this morning.
to complain about the quality of a product I bought from your website.
to complain about the poor service we received from your company.
to draw your attention to the negative attitude of some people in your customer services section
Complaint
Our order dated 16 September clearly stated that we wanted 1,000 items, however you ...
The goods were faulty / damaged / in poor condition.
There seems to be an error in the invoice /a misunderstanding.
The equipment I ordered has still not been delivered, despite my phone call you last week to say that it is needed urgently.
The product I received was well below the standard expected.
To make matters worse, when I called your company staff ...
Request for action
Please replace the faulty goods as soon as possible.
We must insist on an immediate replacement / full refund.
Unless I receive the goods by the end of this week, I will have no choice but to cancel my order.
Close
I hope that you will deal with this matter promptly as it is causing me considerable inconvenience.

Apologizing (supplier)
Open
I am writing in relation to your recent complaint.
Apologizing I was very concerned to learn about ... Please accept my sincere apologies.
I would like to apologize for the inconvenience you have suffered.
Denying responsibility
We appreciate that this has caused you considerable inconvenience, but we cannot accept any responsibility in this matter.
Promising action
Can you leave it with me? I’ll look into the matter and get back to you tomorrow.
I have looked into the matter and ...
I have spoken to the staff involved, and ...
We will send replacement items / give you a refund immediately.
I can assure you that this will not happen again.
We’re having a temporary problem with ... . We’re doing everything we can to sort it out.
Compensation
To compensate for the inconvenience, we would like to offer you ...
Close
Thank you for bringing this matter to my attention. Please accept my assurance that it will not happen again.
Once again, I hope you will accept my apologies for the inconvenience caused.
I very much hope you will continue to use our services in the future.
If you have any further queries, please do not hesitate to contact me on my direct line...

Personal
Friendly
You heard something, but you are not sure
It seems that ... Apparently, ...
Something is true, but surprising
Actually, ... In fact, ...
Something is obvious or already known
Obviously, ... Of course ...
Good/ bad fortune
Unfortunately, ... Luckily, ...
Saying what you really think
To be honest, ... Frankly, ...
Going back to a topic
Well, ... So, ... Anyway, ...
Changing the topic
Anyway, ... So, ... By the way, ...
Summarizing with the most important point
Anyway, ... Basically, ...
Asking for advice
Formal/Neutral
Informal
OpenI’d like your advice about a problem I have
I’ve got a bit of a problem.
Asking for adviceI was wondering if you had any ideas about ...?
What would you advise me to do?
Do you have any ideas about ...?
What should I do?
ClosePlease write back when you have the time and let me know what you think.Please email me when you get the chance.

Giving
Formal/NeutralInformal
OpenI was sorry to hear about your current difficulties.I’m sorry you’re having such a hard time at the moment.
Giving adviceI think it might be a good idea to ...
Have you thought of ... (+ing)?
I think you should ...
What about ... (+ing)?
ResultThis would mean that ...That way, ...
OptionsI think this option would be preferable to ... (+ing)I think it’s better than ... (+ing)
CloseI hope I have been of some help.I hope I’ve helped a bit.

Suggestions
Making a suggestion
I think we should / I suggest that we / Let’s go to ...
Shall we / Perhaps we could/Why don’t we go to ...?
I suggest... /How about going to ...?
Accepting
It’s a great idea!
I think your idea would work really well.
It might be worth trying.
Rejecting
I’m not so sure about your idea.
It sounds like a good idea, but I don’t think it would work in practice.
It sounds like a good idea, but I can see one or two problems.
Special situations
Thanks
Just a quick note to say many thanks for ...
I really appreciate everything that you have done.
Good luck
Good luck with ...I would like to take this opportunity to wish you every success in the future.
Congratulations
Many congratulations on your promotion / new job.
I was delighted to hear the news about ...
Well done!
Best wishes
Please give my best wishes/regards to ...
Bad news
I was so sorry to hear about ...
I was really sorry to hear you’re not well ...Hope you feel better soon.
If there’s anything I can do to help, let me know.

Job Application
Greeting
Dear Sir/Madam
Reason for writing
With reference to your advertisement on the ... website, I am interested in applying for the post of...
Your background and experience
I am 26 years old and am currently studying for a degree in ... at ... University.
For the last two months I have been working as a ... at ... .
The job itself
I am interested in this job because ...
I feel that I would be well-suited for this job/have a lot of experience in ...
Referring to your CV
I have attached my CV as a Word document. You will notice that I ... as well as ... . You will also notice that ... .
Final comments
I would be grateful if you would consider my application.
You will see from my CV that two people can be contacted as references, one is ... and the other is from ... .
I am available for interview in .../ by phone any weekday afternoon, and you can email me or telephone me on the number below.
Close
I look forward to hearing from you soon.
Yours faithfully
Reports
Report structure

Introduction / Background
As requested at the Board meeting of 18 April, here is my report.
The report will discus / consider / describe / analyze / review ...
The report is based on ...
I have divided the report into three sections.
Findings
The findings / figures / results / investigations show that ...
It appears that ... . This has led to a situation where ...
The graph/table shows that ...
Signposts
As can be seen in table 1 / section 2 / figure 3, ...
As mentioned above, ... / ..., see below.
...and I will discuss this in more detail below /in section 3.2.
Conclusion / Recommendations
I (would like to) suggest /recommend that ...
My specific recommendations are as follows.
Closing comments
Please have a look at the report and let me have your comments.
Please feel free to contact me if you have any questions.
Linking words
Sequence
Firstly / secondly / finally
Talking generally
In general / usually / on the whole
Contrast
However / nevertheless / on the other hand
Adding another point
In addition / moreover / on another point
Examples
For example / for instance / e.g.
Alternatives
Either ... or ... / alternatively / instead of ...
Real (surprising) situation
In fact, / actually, / as a matter of fact
Something is obvious
Clearly / obviously / of course
Most important point
Especially / above all / in particular
Rephrasing
In other words / that is to say / i.e.
Result/consequence
As a result / therefore / for this reason
New topic
In relation to / regarding / with reference to
Careful, balanced style
Giving both sides of an argument
In general ..., however ...
On the whole ..., but ...
Making a statement less general
Many / some ...
Usually / typically / often ...
Making a statement less certain
It is possible / probable that ...
It seems / appears that ...
... tends to be...
Making a comparison less strong
Substantially / considerably / much (+ comparative adjective)
Significantly / relatively (+ comparative adjective)
Marginally / slightly (+ comparative adjective)
Concluding
On balance, ...
Taking all the above points into consideration, ...

sábado, 6 de octubre de 2012

Llenar combobox con campos concatenados de una base de datos en C#

En este ejemplo utilizare la Base de Datos Northwind y concatenare los campos Nombre de Contacto y Compañia en un combobox.
El codigo es el siguiente:

public void llenarProfesor()
        {
            string enlace="Data Source=XSaint;Database=Northwind;Integrated Security=SSPI";
            string conect;            
            //enlace con la base de datos
            SqlConnection conexion = new SqlConnection();
            conexion.ConnectionString = enlace;
            conect = conexion.ConnectionString;
            //se declara el DataSet
            DataSet ds3 = new DataSet();
            //se indica la consulta e sql donde se elige el ID_Profesor
            //y se concatenan los campos Nombre y Apellido_P
            //en una variable llamada Name_Full
            SqlDataAdapter da3 = new SqlDataAdapter("Select CustomerID,(ContactName + \' \' + CompanyName) as Name_Full FROM Customers", conect);
            //se especifica la tabla
            da3.Fill(ds3, "Customers");
            comboBox1.DataSource = ds3.Tables[0].DefaultView;
            //el valor real será el ID_Profesor
            comboBox1.ValueMember = "CustomerID";
            //lo que mostrará sera la variable Name_Full la cual tiene concatenados los campos Nombre y Apellido_P
            comboBox1.DisplayMember = "Name_Full";
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            llenarProfesor();
        }

Como poner letra capital de todas las palabras de un string en C#

A menudo necesitamos capitalizar la primera letra de algunas palabras o algun texto(por ejemplo cuando queremos mostrar nombres completos de personas o ciudades, nombres, etcetera).
Como la clase string no tiene un metodo para hacer esto nosotros podemos pensar que no hay una solucion built-in en C# para este problema.
Bueno en realidad hay 2 formas de hacer esto:
Para este proyecto agregaremos 2 textbox y un boton:
Solucion 1
public static string Capitalize(string value)
        {
            return System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = Capitalize(textBox1.Text);            
        }

public static string CapitalizeWords(string value)
        {
            if (value == null)
                throw new ArgumentNullException("value");
            if (value.Length == 0)
                return value;

            StringBuilder result = new StringBuilder(value);
            result[0] = char.ToUpper(result[0]);
            for (int i = 1; i < result.Length; ++i)
            {
                if (char.IsWhiteSpace(result[i - 1]))
                    result[i] = char.ToUpper(result[i]);
            }
            return result.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = CapitalizeWords(textBox1.Text);            
        }

Usando Regex matches para comprobar si un String es alphanumerico en C#

El metodo regex.match de C# es tipicamente usado para validar un string o para asegurar que un string esta conformado de un patron particular sin necesidad de manipularlo. Abajo utilizo un metodo de extension de strings que usa regex matches en C# para comprobar si el string es alphanumerico. Retornara verdadero si el string dado contiene solo numeros y letras del alfabeto.
using System.Text.RegularExpressions;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public static class CheckString
        {
            public static bool IsAlphanumeric(string source)
            {
                Regex pattern = new Regex("[^0-9a-zA-Z]");
                return !pattern.IsMatch(source);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string testString = textBox1.Text;

            if (CheckString.IsAlphanumeric(testString))
                textBox2.Text="Yes string is Alphanumeric!";
            else
                textBox2.Text="No string is not Alphanumeric!";

            
        }

viernes, 5 de octubre de 2012

AutoCompletar TextBox desde base de datos con Northwind y VB.NET

Hay que tener en cuenta que para utilizar esta opción, debes asignar las siguientes propiedades:
AutoCompleteMode: que sirve para indicar cómo queremos que se muestren los datos que encuentra mientras se escribe en el control.
AutoCompleteSource: que sirve para indicarle de dónde se obtendrán los datos que se usarán mientras se escribe.
En este ejemplo se utiliza AutoCompleteSource asignado a CustomSource debido a que la fuente de datos la obtenemos desde una ruta personalizada.
En el evento Load del formulario, se llama a la función AutoCompletar como se muestra debajo, asignándole el control TextBox.
Imports System.Data.SqlClient
Public Class Form1

    Dim myCommand As SqlCommand
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AutoCompletar(Me.TextBox1)
        Me.ActiveControl = TextBox1
    End Sub
Esta es la función AutoCompletar que se deberá utilizar asignándole el control TextBox.
Public Function AutoCompletar(ByVal Control As TextBox) As AutoCompleteStringCollection
        Dim Coleccion As New AutoCompleteStringCollection
        Dim Comando, Coneccion As String
        'Dim myConnection As SqlConnection
        Comando = "select LastName from Employees"
        'Creamos una nueva cadena de coneccion 
        Coneccion = "Data Source=XSaint;Initial Catalog=Northwind;Integrated Security=SSPI"
        'myConnection = New SqlConnection(Coneccion)
        Using myConnection As New SqlConnection(Coneccion)
            Dim Ejecutar As New SqlClient.SqlCommand(Comando, myConnection)
            'Abrimos la coneccion
            myConnection.Open()
            Dim Lector As SqlDataReader = Ejecutar.ExecuteReader()
            ' Realizamos un Loop mientras se est‚ leyendo.
            While Lector.Read()
                Coleccion.AddRange(New String() {Lector(0)})
            End While
            'Cerramos el SqlReader
            Lector.Close()
            'Cerramos la coneccion
            myConnection.Close()
        End Using
        'Ajustamos el control TextBox o ComboBox para recibir los datos de la siguiente manera.
        With Control
            .AutoCompleteMode = AutoCompleteMode.Suggest
            .AutoCompleteSource = AutoCompleteSource.CustomSource
            .AutoCompleteCustomSource = Coleccion
        End With
        'Devolvemos los datos recuperados de la base de datos
        Return Coleccion
    End Function
End Class

Cambiar color de filas en un dataGridView con CheckBox en VB.NET

Ejemplo para alternar mediante la propiedad backcolor del objeto alternatingrowsdefaultcellstyle , el color de filas en un control datagridview
CONTROLES
  1. Un DataGridview ( DataGridView1 )
  2. un CheckBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With ListBox1.Items
            .Add("1")
            .Add("2")
            .Add("3")
            .Add("1")
            .Add("2")
            .Add("3")
            ListBox1.SelectedIndex = 0
        End With
        Button1.Text = "Eliminar duplicados "
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(Eliminar(ListBox1), MsgBoxStyle.Information, "Elementos duplicados en el List ")
    End Sub
    Function Eliminar(ByVal LB As ListBox) As Int32
        Dim i As Int32
        Dim j As Int32
        Dim n As Int32           ' Recorre los items ( compara empezando desde el primero , de abajo hacia arriba)         
        For i = 0 To LB.Items.Count - 2
            For j = LB.Items.Count - 1 To i + 1 Step -1                 ' ... si es el mismo                 
                If LB.Items(i).ToString = LB.Items(j).ToString Then
                    LB.Items.RemoveAt(j) ' elimina el elemento indicando el índice                     
                    n += 1 'lleva la cuenta de los duplicados                 
                End If
            Next
        Next
        Return n ' retorna los eliminados     End Function End Class 
    End Function

Eliminar duplicados de un listbox en VB.NET

Simple función en vb.net que recorre todos los elementos de la lista de un
combo o listbox para poder eliminar los elementos o items duplicados
El ejemplo comienza comparando desde el primer item con todos los demás
empezando desde abajo hacia arriba. Si el elemento es el mismo lo elimina con el
método RemoveAt del ListBox indicando el índice
Colocar en el formulario
  1. Un control ListBox llamado Listbox1
  2. Un control Button llamado Button1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With ListBox1.Items
            .Add("1")
            .Add("2")
            .Add("3")
            .Add("1")
            .Add("2")
            .Add("3")
            ListBox1.SelectedIndex = 0
        End With
        Button1.Text = "Eliminar duplicados "
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(Eliminar(ListBox1), MsgBoxStyle.Information, "Elementos duplicados en el List ")
    End Sub
    Function Eliminar(ByVal LB As ListBox) As Int32
        Dim i As Int32
        Dim j As Int32
        Dim n As Int32           ' Recorre los items ( compara empezando desde el primero , de abajo hacia arriba)         
        For i = 0 To LB.Items.Count - 2
            For j = LB.Items.Count - 1 To i + 1 Step -1                 ' ... si es el mismo                 
                If LB.Items(i).ToString = LB.Items(j).ToString Then
                    LB.Items.RemoveAt(j) ' elimina el elemento indicando el índice                     
                    n += 1 'lleva la cuenta de los duplicados                 
                End If
            Next
        Next
        Return n ' retorna los eliminados     End Function End Class 
    End Function