protected void btnadd_Click(object sender, EventArgs e) { tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text); if (_allotte != null) { decimal charge = 0; decimal.TryParse(txtPayment.Text, out charge); tbChallan quarterDamage = new tbChallan(); quarterDamage.AAN = _allotte.AAN; quarterDamage.Payment = charge; quarterDamage.ChallanNumber = txtChallanNumber.Text; quarterDamage.BankName = txtBankName.Text; quarterDamage.DateRecevied = Convert.ToDateTime(txtMonth.Text); quarterDamage.QuarterNumber = _allotte.tblQuarter.QuarterNumber; quarterDamage.Remarks = txtRemarks.Text; Quarters.AddChallan(quarterDamage); lblmessage.Text = "Information saved sucessfully!"; lblmessage.Visible = true; empty(); tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Licence fee"; _userhistory.description = _user.Username + " has added quarter damage charges for quarter " + _allotte.tblQuarter.QuarterNumber; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else { lblmessage.Text = "This quarter is not allotted to anyone yet"; lblmessage.Visible = true; } }
public static void AddChallan(tbChallan quarterDamage) { DataClassesDataContext datacontext = new DataClassesDataContext(); datacontext.tbChallans.InsertOnSubmit(quarterDamage); datacontext.SubmitChanges(); }