Exemplo n.º 1
0
 private void BindFormView()
 {
     try
     {
         List <DC_LiverFunctionReports> _lstDC_VitalSignsReports = new List <DC_LiverFunctionReports>();
         DC_LiverFunctionReports        _objvsr = new DC_LiverFunctionReports();
         _lstDC_VitalSignsReports.Add(_objvsr);
         grdvwLiverFunctionDetails.DataSource = _lstDC_VitalSignsReports;
         grdvwLiverFunctionDetails.DataBind();
     }
     catch (Exception)
     {
         throw;
     }
 }
        public DC_Message AddUpdateLiverFunReports(DC_LiverFunctionReports _objSave)
        {
            DC_Message _msg = new DC_Message();

            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    if (_objSave.LFR_TestReportID != null && _objSave.LFR_TestReportID != Guid.Empty)
                    {
                        var isDuplicate = (from x in context.tbl_LiverFunctionReports
                                           where x.LFR_TestReportID != _objSave.LFR_TestReportID &&
                                           x.PatientID == x.PatientID && x.TestDate == _objSave.TestDate
                                           select x).Count() == 0 ? false : true;

                        if (isDuplicate)
                        {
                            _msg.StatusMessage = "Report " + ReadOnlyMessage.strAlreadyExist;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Duplicate;
                            return(_msg);
                        }
                        var report = context.tbl_LiverFunctionReports.Find(_objSave.LFR_TestReportID);

                        if (report != null)
                        {
                            report.TestDate      = _objSave.TestDate;
                            report.IsActive      = _objSave.IsActive;
                            report.EditedBy      = _objSave.EditedBy;
                            report.EditedDate    = _objSave.EditedDate;
                            report.SBilirubin    = _objSave.SBilirubin;
                            report.SGOT          = _objSave.SGOT;
                            report.SGPT          = _objSave.SGPT;
                            report.GGT           = _objSave.GGT;
                            report.SAlkPhosphate = _objSave.SAlkPhosphate;
                            report.SProtein      = _objSave.SProtein;
                            report.Albumin       = _objSave.Albumin;
                            report.Globulin      = _objSave.Globulin;
                            report.AGRatio       = _objSave.AGRatio;
                            if (context.SaveChanges() == 1)
                            {
                                _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strUpdatedSuccessfully;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                            }
                            else
                            {
                                _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strFailed;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                            }
                        }
                        else
                        {
                            tbl_LiverFunctionReports _objnew = new tbl_LiverFunctionReports();
                            _objnew.LFR_TestReportID = Guid.NewGuid();
                            _objnew.PatientID        = _objSave.PatientID;
                            _objnew.CreatedBy        = _objSave.CreatedBy;
                            _objnew.CreatedDate      = _objSave.CreatedDate;
                            _objnew.IsActive         = _objSave.IsActive;
                            _objnew.TestDate         = _objSave.TestDate;
                            _objnew.SBilirubin       = _objSave.SBilirubin;
                            _objnew.SGOT             = _objSave.SGOT;
                            _objnew.SGPT             = _objSave.SGPT;
                            _objnew.GGT           = _objSave.GGT;
                            _objnew.SAlkPhosphate = _objSave.SAlkPhosphate;
                            _objnew.SProtein      = _objSave.SProtein;
                            _objnew.Albumin       = _objSave.Albumin;
                            _objnew.Globulin      = _objSave.Globulin;
                            _objnew.AGRatio       = _objSave.AGRatio;
                            context.tbl_LiverFunctionReports.Add(_objnew);
                            if (context.SaveChanges() == 1)
                            {
                                _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strAddedSuccessfully;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                            }
                            else
                            {
                                _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strFailed;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                            }
                        }
                    }
                    else
                    {
                        tbl_LiverFunctionReports _objnew = new tbl_LiverFunctionReports();
                        _objnew.LFR_TestReportID = Guid.NewGuid();
                        _objnew.PatientID        = _objSave.PatientID;
                        _objnew.CreatedBy        = _objSave.CreatedBy;
                        _objnew.CreatedDate      = _objSave.CreatedDate;
                        _objnew.IsActive         = _objSave.IsActive;
                        _objnew.TestDate         = _objSave.TestDate;
                        _objnew.SBilirubin       = _objSave.SBilirubin;
                        _objnew.SGOT             = _objSave.SGOT;
                        _objnew.SGPT             = _objSave.SGPT;
                        _objnew.GGT           = _objSave.GGT;
                        _objnew.SAlkPhosphate = _objSave.SAlkPhosphate;
                        _objnew.SProtein      = _objSave.SProtein;
                        _objnew.Albumin       = _objSave.Albumin;
                        _objnew.Globulin      = _objSave.Globulin;
                        _objnew.AGRatio       = _objSave.AGRatio;

                        context.tbl_LiverFunctionReports.Add(_objnew);
                        if (context.SaveChanges() == 1)
                        {
                            _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strAddedSuccessfully;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                        }
                        else
                        {
                            _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strFailed;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                        }
                    }
                }
            }
            catch (Exception ex) { }
            return(_msg);
        }
Exemplo n.º 3
0
        protected void frmvwAddUpdateLiverFunction_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            #region Controls
            TextBox txtTestDate      = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtTestDate");
            TextBox txtSBilirubin    = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtSBilirubin");
            TextBox txtSGOT          = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtSGOT");
            TextBox txtSGPT          = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtSGPT");
            TextBox txtGGT           = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtGGT");
            TextBox txtSAlkPhosphate = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtSAlkPhosphate");
            TextBox txtSProtein      = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtSProtein");
            TextBox txtAlbumin       = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtAlbumin");
            TextBox txtGlobulin      = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtGlobulin");
            TextBox txtAGRatio       = (TextBox)frmvwAddUpdateLiverFunction.FindControl("txtAGRatio");
            #endregion

            if (e.CommandName == "AddLiverFunction")
            {
                DC_Message _msg = new DC_Message();
                DC_LiverFunctionReports _objAdd = new DC_LiverFunctionReports();
                _objAdd.TestDate      = Convert.ToDateTime(txtTestDate.Text);
                _objAdd.PatientID     = GetPatientID();
                _objAdd.SBilirubin    = txtSBilirubin.Text;
                _objAdd.SGOT          = txtSGOT.Text;
                _objAdd.SGPT          = txtSGPT.Text;
                _objAdd.GGT           = txtGGT.Text;
                _objAdd.SAlkPhosphate = txtSAlkPhosphate.Text;
                _objAdd.SProtein      = txtSProtein.Text;
                _objAdd.Albumin       = txtAlbumin.Text;
                _objAdd.Globulin      = txtGlobulin.Text;
                _objAdd.AGRatio       = txtAGRatio.Text;
                _objAdd.CreatedBy     = "Ajay";
                _objAdd.CreatedDate   = DateTime.Today;
                _msg = _objDL.AddUpdateLiverFunReports(_objAdd);
                if (_msg.StatusCode == ReadOnlyMessage.StatusCode.Success)
                {
                    BootstrapAlert.BootstrapAlertMessage(divmsg, _msg.StatusMessage, BootstrapAlertType.Success);
                    frmvwAddUpdateLiverFunction.ChangeMode(FormViewMode.Insert);
                    BindGridDetails();
                }
            }
            if (e.CommandName == "UpdateLiverFunction")
            {
                DC_Message _msg = new DC_Message();
                DC_LiverFunctionReports _objAdd = new DC_LiverFunctionReports();
                _objAdd.LFR_TestReportID = Guid.Parse(Convert.ToString(frmvwAddUpdateLiverFunction.DataKey.Value));
                _objAdd.TestDate         = Convert.ToDateTime(txtTestDate.Text);
                _objAdd.SBilirubin       = txtSBilirubin.Text;
                _objAdd.SGOT             = txtSGOT.Text;
                _objAdd.SGPT             = txtSGPT.Text;
                _objAdd.GGT           = txtGGT.Text;
                _objAdd.SAlkPhosphate = txtSAlkPhosphate.Text;
                _objAdd.SProtein      = txtSProtein.Text;
                _objAdd.Albumin       = txtAlbumin.Text;
                _objAdd.Globulin      = txtGlobulin.Text;
                _objAdd.AGRatio       = txtAGRatio.Text;
                _objAdd.EditedBy      = "Ajay";
                _objAdd.EditedDate    = DateTime.Today;
                _msg = _objDL.AddUpdateLiverFunReports(_objAdd);
                if (_msg.StatusCode == ReadOnlyMessage.StatusCode.Success)
                {
                    BootstrapAlert.BootstrapAlertMessage(divmsg, _msg.StatusMessage, BootstrapAlertType.Success);
                    frmvwAddUpdateLiverFunction.ChangeMode(FormViewMode.Insert);
                    BindGridDetails();
                }
            }
        }