private List <SqlParameter> CreateParameterOPDPatient(EntityOPDPatient entOPDPatient) { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@PatientCode", DbType.String, entOPDPatient.PatientCode); Commons.ADDParameter(ref lstParam, "@PatientName", DbType.String, entOPDPatient.PatientName); Commons.ADDParameter(ref lstParam, "@Medicine", DbType.String, entOPDPatient.DrugName); Commons.ADDParameter(ref lstParam, "@Morning", DbType.Boolean, entOPDPatient.Morning); Commons.ADDParameter(ref lstParam, "@AfterNoon", DbType.Boolean, entOPDPatient.AfterNoon); Commons.ADDParameter(ref lstParam, "@Night", DbType.Boolean, entOPDPatient.Night); Commons.ADDParameter(ref lstParam, "@EntryBy", DbType.String, entOPDPatient.EntryBy); Commons.ADDParameter(ref lstParam, "@DiagnosisNo", DbType.String, entOPDPatient.DiagnosisCode); return(lstParam); }
protected void BtnSave_Click(object sender, EventArgs e) { List <EntityOPDPatient> lstentOPDPatient = new List <EntityOPDPatient>(); Decimal ldcTotalRateOfInj = 0.0M; Decimal ldcInjection = 0.0M; Decimal ldcDressing = 0.0M; decimal ldcRevisit = 0.0M; Decimal ldcTotalOPDBill = 0.0M; Decimal ldcConsultantCharges = 0.0M; int cnt = 0; try { EntityOPDPatient entOPDPatient = new EntityOPDPatient(); entOPDPatient.EntryBy = SessionWrapper.UserName; entOPDPatient.AppointNO = Commons.ConvertToInt(Session["AppointmentNo"]); ldcDressing = Commons.ConvertToDecimal(Session["DressingRate"]); ldcRevisit = Commons.ConvertToDecimal(Session["Revisit"]); ldcInjection = Commons.ConvertToDecimal(Session["InjectionRate"]); ldcConsultantCharges = Commons.ConvertToDecimal(Session["ConsultantCharge"]); if (ldcRevisit == 0.0M && ldcRevisit == null) { entOPDPatient.ConsultantCharge = ldcConsultantCharges; entOPDPatient.RevisitCharge = 0.0M; entOPDPatient.PatientVisitType = "N"; } else { entOPDPatient.RevisitCharge = ldcRevisit; entOPDPatient.ConsultantCharge = 0.0M; entOPDPatient.PatientVisitType = "R"; } ldcTotalOPDBill = ldcTotalRateOfInj + ldcRevisit + ldcDressing + ldcConsultantCharges; entOPDPatient.InjectionCharge = ldcTotalRateOfInj; entOPDPatient.DressingCharge = ldcDressing; entOPDPatient.ConsultantCharge = ldcConsultantCharges; entOPDPatient.TotalOPDBill = ldcTotalOPDBill; entOPDPatient.ConsultedBy = Commons.ConvertToInt(Session["ConsultantId"]); DataTable ldt = new DataTable(); string lstrDiagnosisNo = string.Empty; ldt = mobjPatientMasterBLL.GetNewDiagnosisCode(); if (ldt.Rows.Count > 0 && ldt != null) { lstrDiagnosisNo = ldt.Rows[0]["DiagnosisCode"].ToString(); } entOPDPatient.DiagnosisCode = lstrDiagnosisNo; cnt = mobjPatientMasterBLL.InsertOPDPatientTreatmentDetail(lstentOPDPatient, entOPDPatient); if (cnt > 0) { lblMessage.Text = "Patient Inserted Successfully"; GetOPDPatientList(); } else { lblMessage.Text = "Error!!!!!"; } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
public int InsertOPDPatientTreatmentDetail(List <EntityOPDPatient> lstentOPDMaster, EntityOPDPatient entOPDMaster) { int cnt = 0; List <string> lstspNames = new List <string>(); List <List <SqlParameter> > lstParamVals = new List <List <SqlParameter> >(); List <SqlParameter> lstParam; try { foreach (EntityOPDPatient entOPD in lstentOPDMaster) { lstspNames.Add("sp_InsertOPDPatient"); lstParamVals.Add(CreateParameterOPDPatient(entOPD)); } lstspNames.Add("sp_InsertOPDPatientDiagnosis"); lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@PatientCode", DbType.String, entOPDMaster.PatientCode); Commons.ADDParameter(ref lstParam, "@PatientName", DbType.String, entOPDMaster.PatientName); Commons.ADDParameter(ref lstParam, "@Injections", DbType.Int32, entOPDMaster.TotalInjections); Commons.ADDParameter(ref lstParam, "@InjectionCharge", DbType.Decimal, entOPDMaster.InjectionCharge); Commons.ADDParameter(ref lstParam, "@DressingCharge", DbType.Decimal, entOPDMaster.DressingCharge); Commons.ADDParameter(ref lstParam, "@RevisitCharge", DbType.Decimal, entOPDMaster.RevisitCharge); Commons.ADDParameter(ref lstParam, "@ConsultantCharge", DbType.Decimal, entOPDMaster.ConsultantCharge); Commons.ADDParameter(ref lstParam, "@TotalOPDBill", DbType.Decimal, entOPDMaster.TotalOPDBill); Commons.ADDParameter(ref lstParam, "@PatientVisitType", DbType.String, entOPDMaster.PatientVisitType); Commons.ADDParameter(ref lstParam, "@ConsultedBy", DbType.Int32, entOPDMaster.ConsultedBy); Commons.ADDParameter(ref lstParam, "@EntryBy", DbType.String, entOPDMaster.EntryBy); Commons.ADDParameter(ref lstParam, "@DiagnosisNo", DbType.String, entOPDMaster.DiagnosisCode); Commons.ADDParameter(ref lstParam, "@Symptoms", DbType.String, entOPDMaster.Symptoms); Commons.ADDParameter(ref lstParam, "@Diagnosis", DbType.String, entOPDMaster.Diagnosis); Commons.ADDParameter(ref lstParam, "@XRays", DbType.String, entOPDMaster.XRay); Commons.ADDParameter(ref lstParam, "@BloodTests", DbType.String, entOPDMaster.BloodTest); lstParamVals.Add(lstParam); lstspNames.Add("sp_CloseOPDPatient"); lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@PatientCode", DbType.String, entOPDMaster.PatientCode); Commons.ADDParameter(ref lstParam, "@AppointNo", DbType.Int32, entOPDMaster.AppointNO); lstParamVals.Add(lstParam); cnt = mobjDataAcces.ExecuteTransaction(lstspNames, lstParamVals); } catch (Exception ex) { throw ex; } return(cnt); }