protected void btnAddInvoice_Click(object sender, EventArgs e) { InvoicingDataContext db = new InvoicingDataContext(); InvoiceDetail invoice = new InvoiceDetail(); invoice.invoice_number = this.txtInvoiceRef.Text; invoice.personal_details = this.ddlPersonalDetails.SelectedIndex + 1; invoice.client_details = this.ddlClient.SelectedIndex + 1; invoice.bank_details = this.ddlBank.SelectedIndex + 1; invoice.time_worked = Convert.ToInt32(this.txtTimeWorked.Text); invoice.rate = Convert.ToInt32(this.txtRate.Text); invoice.date_from = Convert.ToDateTime(this.txtDateFrom.Text); invoice.date_to = Convert.ToDateTime(this.txtDateTo.Text); db.InvoiceDetails.InsertOnSubmit(invoice); try { db.SubmitChanges(); } catch { Response.Write("Couldn't add invoice"); } finally { Response.Write("success"); } }
private void FillBankDetails() { InvoicingDataContext db = new InvoicingDataContext(); var bankdetails = from b in db.BankDetails select new { b.bank_name }; this.ddlBank.DataSource = bankdetails; this.ddlBank.DataValueField = "bank_name"; this.ddlBank.DataBind(); }
protected void btnAddBank_Click(object sender, EventArgs e) { InvoicingDataContext db = new InvoicingDataContext(); BankDetail bank = new BankDetail { bank_name = this.txtBankName.Text, sort_code = Convert.ToInt32(this.txtSortCode.Text), account_number = this.txtAccountNumber.Text }; }
private void FillPersonalDetails() { InvoicingDataContext db = new InvoicingDataContext(); var personal = from p in db.PersonalDetails select new { p.business_name }; this.ddlPersonalDetails.DataSource = personal; this.ddlPersonalDetails.DataValueField = "business_name"; this.ddlPersonalDetails.DataBind(); }
private void FillClientDetails() { InvoicingDataContext db = new InvoicingDataContext(); var client = from c in db.ClientDetails select new { c.name }; this.ddlClient.DataSource = client; this.ddlClient.DataValueField = "name"; this.ddlClient.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { InvoicingDataContext db = new InvoicingDataContext(); var invoice = from c in db.InvoiceDetails select new { refnum = c.invoice_number, businessName = c.PersonalDetail.business_name, value = c.rate * c.time_worked }; this.lvInvoiceList.DataSource = invoice; this.lvInvoiceList.DataBind(); }
protected void btnAddClient_Click(object sender, EventArgs e) { InvoicingDataContext db = new InvoicingDataContext(); ClientDetail client = new ClientDetail { name = this.txtName.Text, email = this.txtEmail.Text, telephone = Convert.ToInt32(this.txtTelephone.Text), address_line1 = this.txtAddress1.Text, address_line2 = this.txtAddress2.Text, city = this.txtCity.Text, county = this.txtCounty.Text, post_code = this.txtPostCode.Text }; db.ClientDetails.InsertOnSubmit(client); db.SubmitChanges(); }
protected void btnAddPersonal_Click(object sender, EventArgs e) { InvoicingDataContext db = new InvoicingDataContext(); }