protected void btnsave_Click(object sender, EventArgs e) { if (!_transRepo.checkTruckIsPendingOrNot(txtTruckNo.Text)) { string truckNo = txtTruckNo.Text; string securityName = txtSecurity.Text; string remarks = txtRemarks.Text; tblGateEntryRecord record = new tblGateEntryRecord(); record.GatePassNo = Convert.ToInt32(txtgatePassNo.Text); record.EntryDate = DateTime.Now; record.SecurityMarks = txtRemarks.Text; record.SecurityName = txtSecurity.Text; record.TruckNo = txtTruckNo.Text; db.tblGateEntryRecords.InsertOnSubmit(record); db.SubmitChanges(); ScriptManager.RegisterStartupScript(this, this.GetType(), "toastr", "toastr.success('Truck Entry Record added Successfully')", true); HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; meta.Content = "2;url=GateEntryForm"; this.Page.Controls.Add(meta); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "toastr", "toastr.error('Truck No is already in pending records.')", true); } }
internal string gettuckNofromgateEntry(string gateNo) { string result = "0"; tblGateEntryRecord rec = db.tblGateEntryRecords.FirstOrDefault(x => x.GatePassNo == Convert.ToInt32(gateNo)); if (rec != null) { result = rec.TruckNo.ToString(); } return(result); }