public int InsertBirthRecord(EntityMedicalCertificate entDept) { try { tblMedicalCertificate obj = new tblMedicalCertificate() { PatientAdmitID = entDept.PatientAdmitID, Age = entDept.Age, Daignosis = entDept.Daignosis, OPDFrom = entDept.OPDFrom, OPDTo = entDept.OPDTo, IndoorOn = entDept.IndoorOn, DischargeOn = entDept.DischargeOn, OperatedFor = entDept.OperatedFor, OperatedForOn = entDept.OperatedForOn, AdvisedRestDays = entDept.AdvisedRestDays, AdvisedRestFrom = entDept.AdvisedRestFrom, ContinuedRestDays = entDept.ContinuedRestDays, ContinueRestFrom = entDept.ContinueRestFrom, WorkFrom = entDept.WorkFrom }; objData.tblMedicalCertificates.InsertOnSubmit(obj); objData.SubmitChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void BtnSave_Click(object sender, EventArgs e) { try { int lintcnt = 0; EntityMedicalCertificate entDept = new EntityMedicalCertificate(); if (ddlPatientName.SelectedIndex == 0) { lblMsg.Text = "Please Patient Name"; return; } else { entDept.PatientAdmitID = Convert.ToInt32(ddlPatientName.SelectedValue); entDept.Age = Convert.ToInt32(txtAge.Text); entDept.Daignosis = txtDaignosis.Text; entDept.OPDFrom = Convert.ToDateTime(txtOPDFrom.Text); entDept.OPDTo = Convert.ToDateTime(txtOPDTo.Text); entDept.IndoorOn = Convert.ToDateTime(txtIndoorOn.Text); entDept.DischargeOn = Convert.ToDateTime(txtDischargeOn.Text); entDept.OperatedFor = txtOperatedFor.Text; entDept.OperatedForOn = Convert.ToDateTime(txtOperatedForOn.Text); entDept.AdvisedRestDays = txtAdvisedRestDays.Text; entDept.AdvisedRestFrom = Convert.ToDateTime(txtAdvisedRestFrom.Text); entDept.ContinueRestFrom = Convert.ToDateTime(txtContinueRestFrom.Text); entDept.ContinuedRestDays = txtContinuedRestDays.Text; entDept.WorkFrom = Convert.ToDateTime(txtWorkFrom.Text); lintcnt = mobjBirthBLL.InsertBirthRecord(entDept); if (lintcnt > 0) { GetBirthDetails(); lblMessage.Text = "Record Inserted Successfully...."; Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); } else { lblMessage.Text = "Record Not Inserted..."; } } } catch (Exception ex) { lblMessage.Text = ex.Message; } MultiView1.SetActiveView(View1); }