/Web/UserControls/AddClient.ascx.cs

http://github.com/simonbegg/Invoicing · C# · 41 lines · 37 code · 4 blank · 0 comment · 0 complexity · 181718f4284de4964c235f9d5b5009da MD5 · raw file

  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Data.Linq;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Security;
  9. using System.Web.UI;
  10. using System.Web.UI.HtmlControls;
  11. using System.Web.UI.WebControls;
  12. using System.Web.UI.WebControls.WebParts;
  13. using System.Xml.Linq;
  14. using DAL;
  15. public partial class UserControls_AddClient : System.Web.UI.UserControl
  16. {
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. }
  20. protected void btnAddClient_Click(object sender, EventArgs e)
  21. {
  22. InvoicingDataContext db = new InvoicingDataContext();
  23. ClientDetail client = new ClientDetail
  24. {
  25. name = this.txtName.Text,
  26. email = this.txtEmail.Text,
  27. telephone = Convert.ToInt32(this.txtTelephone.Text),
  28. address_line1 = this.txtAddress1.Text,
  29. address_line2 = this.txtAddress2.Text,
  30. city = this.txtCity.Text,
  31. county = this.txtCounty.Text,
  32. post_code = this.txtPostCode.Text
  33. };
  34. db.ClientDetails.InsertOnSubmit(client);
  35. db.SubmitChanges();
  36. }
  37. }