internal int UpdatePatientInfo(HMS_PatientInfo objPatient, int pId)
        {
            try
            {
                HMS_PatientInfo obj = _context.HMS_PatientInfo.First(x => x.PatientID == pId);
                obj.PatientName       = objPatient.PatientName;
                obj.Age               = objPatient.Age;
                obj.M_Y_D             = objPatient.M_Y_D;
                obj.Gender            = objPatient.Gender;
                obj.BloodGroup        = objPatient.BloodGroup;
                obj.MaritalStatus     = objPatient.MaritalStatus;
                obj.Mobile            = objPatient.Mobile;
                obj.Address           = objPatient.Address;
                obj.GuardianName      = objPatient.GuardianName;
                obj.GuardianContactNo = objPatient.GuardianContactNo;
                obj.VisitDate         = objPatient.VisitDate;
                obj.BillCategoryId    = objPatient.BillCategoryId;
                obj.BillHeadId        = objPatient.BillHeadId;
                obj.Amount            = objPatient.Amount;
                obj.Bed_CabinNo       = objPatient.Bed_CabinNo;
                obj.RefdBy            = objPatient.RefdBy;
                obj.Remarks           = objPatient.Remarks;
                obj.Edit_User         = objPatient.Edit_User;
                obj.Edit_Date         = objPatient.Edit_Date;

                _context.SaveChanges();
                return(1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 internal int InsertPatient(HMS_PatientInfo objPatient)
 {
     try
     {
         _context.HMS_PatientInfo.AddObject(objPatient);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (btnSubmit.Text == "Submit")
                {
                    if (txtPatientName.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Patient Name !!')", true);
                    }
                    else if (ddlGender.SelectedItem.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Gender !!')", true);
                    }

                    else if (ddlBloodGrp.SelectedItem.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Blood Group !!')", true);
                    }
                    else if (txtAge.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Age!!')", true);
                    }
                    else if (txtMobile.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Mobile !!')", true);
                    }
                    else if (txtVisitDate.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Visit Date!!')", true);
                    }
                    else
                    {
                        HMS_PatientInfo objPatient = new HMS_PatientInfo();

                        objPatient.OCODE             = ((SessionUser)Session["SessionUser"]).OCode;
                        objPatient.PatientName       = txtPatientName.Text;
                        objPatient.Age               = txtAge.Text;
                        objPatient.M_Y_D             = ddlAgeFormat.SelectedItem.Text;
                        objPatient.Gender            = ddlGender.SelectedItem.Text;
                        objPatient.BloodGroup        = ddlBloodGrp.SelectedItem.Text;
                        objPatient.MaritalStatus     = ddlMarital.SelectedItem.Text;
                        objPatient.Mobile            = txtMobile.Text;
                        objPatient.Address           = txtAddress.Text;
                        objPatient.GuardianName      = txtGuardian.Text;
                        objPatient.GuardianContactNo = txtEmerContact.Text;
                        objPatient.VisitDate         = Convert.ToDateTime(txtVisitDate.Text);
                        objPatient.BillCategoryId    = Convert.ToInt32(ddlCategory.SelectedValue.ToString());
                        objPatient.BillHeadId        = Convert.ToInt32(ddlHead.SelectedValue.ToString());
                        objPatient.Amount            = Convert.ToDecimal(txtAmount.Text);
                        objPatient.Bed_CabinNo       = txtBedNo.Text;
                        objPatient.RefdBy            = txtRefdBy.Text;
                        objPatient.Remarks           = txtRemarks.Text;

                        objPatient.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                        objPatient.Create_Date = DateTime.Now;
                        int result = objPatient_Bll.InsertPatient(objPatient);

                        if (result == 1)
                        {
                            HMS_PatientCollectionSummary objSummary = new HMS_PatientCollectionSummary();

                            Session["Patient_Id"] = objPatient.PatientID;

                            objSummary.PatientID             = objPatient.PatientID;
                            objSummary.CollectionDate        = Convert.ToDateTime(txtVisitDate.Text);
                            objSummary.CollectionAmount      = Convert.ToDecimal(txtAmount.Text);
                            objSummary.AdvanceAmount         = Convert.ToDecimal(txtAmount.Text);
                            objSummary.Discount_Percent      = 0;
                            objSummary.ServiceCharge_Percent = 0;
                            objSummary.Create_User           = ((SessionUser)Session["SessionUser"]).UserId;
                            objSummary.Create_Date           = DateTime.Now;
                            objSummary.OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                            int aResult = objPatient_Bll.InsertPatientSummary(objSummary);

                            //----------------------------------------------------------
                            HMS_PatientBillInfo objBill = new HMS_PatientBillInfo();

                            objBill.PatientId        = objPatient.PatientID;
                            objBill.Bill_Category_Id = Convert.ToInt32(ddlCategory.SelectedValue.ToString());;
                            objBill.Bill_Head_Id     = Convert.ToInt32(ddlHead.SelectedValue.ToString());
                            objBill.CollectionDate   = Convert.ToDateTime(txtVisitDate.Text);
                            objBill.Amount           = Convert.ToDecimal(txtAmount.Text);
                            objBill.Qty         = 1;
                            objBill.TotalAmount = Convert.ToDecimal(txtAmount.Text);
                            objBill.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                            objBill.Create_Date = DateTime.Now;
                            objBill.OCODE       = ((SessionUser)Session["SessionUser"]).OCode;
                            int bResult = objPatient_Bll.InsertPatientBill(objBill);
                            //---------------------------------------------------------------

                            if (bResult == 1)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully !')", true);
                                btnSubmit.Text = "Print";
                            }
                        }
                    }
                }
                else
                {
                    gridPatient.Visible = false;

                    string OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                    int    _patientId = Convert.ToInt32(Session["Patient_Id"]);

                    var Patient = objPatient_Bll.GetPatientInfoForReport(_patientId, OCODE).ToList();

                    if (Patient.Count > 0)
                    {
                        Session["rptDs"]   = "ds_PatientInfo";
                        Session["rptDt"]   = Patient;
                        Session["rptFile"] = "/HMS/reports/HMS_Rpt_PatientInfo.rdlc";
                        // Session["rptTitle"] = "Patient Money Receipt";

                        string rptDs            = Convert.ToString(Session["rptDs"]);
                        var    reportDataSource = new ReportDataSource
                        {
                            Name  = rptDs,
                            Value = Session["rptDt"]
                        };
                        ReportViewer2.LocalReport.DataSources.Clear();
                        ReportViewer2.LocalReport.DataSources.Add(reportDataSource);
                        ReportViewer2.LocalReport.ReportPath = Server.MapPath(Convert.ToString(Session["rptFile"]));
                        //ReportParameter prm_1 = new ReportParameter("datePrint", Convert.ToString(DateTime.Now.Date));
                        //ReportParameter prm_2 = new ReportParameter("rptTitle", Convert.ToString(Session["rptTitle"]));
                        //ReportViewer2.LocalReport.SetParameters(new ReportParameter[] { prm_1, prm_2 });
                        ReportViewer2.LocalReport.Refresh();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true);
                    }
                }

                GetPatientInfo();
                ClearPatientInfo();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Beispiel #4
0
 internal int UpdatePatientInfo(HMS_PatientInfo objPatient, int pId)
 {
     return(objPatient_DAL.UpdatePatientInfo(objPatient, pId));
 }
Beispiel #5
0
 internal int InsertPatient(HMS_PatientInfo objPatient)
 {
     return(objPatient_DAL.InsertPatient(objPatient));
 }