Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ORM.OnLinePrescriptionDataContext oOnLinePrescriptionDataContext = new ORM.OnLinePrescriptionDataContext();
            PatientBasicInfo oPatietnBasicInfo = new PatientBasicInfo();

            //PatientID,RegistrationDt,PatientType,StudyName,StudyID,EmployeeID,RelCode,PatientName,MaritalStatus,Gender,
            oPatietnBasicInfo.RegistrationDt = DateTime.Now;
            oPatietnBasicInfo.PatientType = byte.Parse(ddlPatientType.SelectedValue);

            if (byte.Parse(ddlPatientType.SelectedValue) == 2)
            {
                oPatietnBasicInfo.StudyName = ddlStudyName.SelectedValue;
                oPatietnBasicInfo.StudyID = txtStudyPatientId.Text;
            }
            else if (byte.Parse(ddlPatientType.SelectedValue) == 3)
                oPatietnBasicInfo.StudyID = txtEmployeeId.Text;

            if (txtEmployeeId.Enabled == true)
                oPatietnBasicInfo.EmployeeID = txtEmployeeId.Text;
            else
                oPatietnBasicInfo.EmployeeID = null;

            oPatietnBasicInfo.RelCode = byte.Parse(ddlRelationship.SelectedValue);
            oPatietnBasicInfo.PatientName = txtPatientName.Text;
            oPatietnBasicInfo.MaritalStatus = byte.Parse(ddlMaritalStatus.SelectedValue);
            oPatietnBasicInfo.Gender = byte.Parse(ddlSex.SelectedValue);

            //SpouseName,FatherName,MotherName,DateOfBirth,NationalID,ContactNo,AreaCode,PDistrict,PThana,PUnion,
            oPatietnBasicInfo.SpouseName = txtSpouseName.Text;
            oPatietnBasicInfo.FatherName = txtFathersName.Text;
            oPatietnBasicInfo.MotherName = txtMothersName.Text;

            //DateOfBirth
            if (chkDOB.Checked)
                oPatietnBasicInfo.DateOfBirth = RdpDOB.SelectedDate;
            else
            {
                int AgeTotalDays;
                AgeTotalDays = int.Parse(RNtxtAgeMonth.Text) * 30 + int.Parse(RNtxtAgeDay.Text) + int.Parse(RNtxtAgeYear.Text) * 365;
                oPatietnBasicInfo.DateOfBirth = DateTime.Now.AddDays(-AgeTotalDays);
            }
            //DateOfBirth

            oPatietnBasicInfo.NationalID = txtNID.Text;
            oPatietnBasicInfo.ContactNo = txtMobile.Text;

            var varAreaCode = (from lkpAreDet in oOnLinePrescriptionDataContext.lkp_AreaDetails
                               where lkpAreDet.DistCode.Equals(ddlDistrict.SelectedValue) &&
                               lkpAreDet.ThanaCode.Equals(ddlThana.SelectedValue)
                               select lkpAreDet.AreaCode).SingleOrDefault();
            oPatietnBasicInfo.AreaCode = varAreaCode;

            oPatietnBasicInfo.PDistrict = ddlDistrict.SelectedValue;
            oPatietnBasicInfo.PThana = ddlThana.SelectedValue;
            oPatietnBasicInfo.PUnion = txtUnion.Text;

            //PVillage,PAddress,RegistrationFee,MedDiscount,TestDiscount,Remarks
            oPatietnBasicInfo.PVillage = txtVillage.Text;
            oPatietnBasicInfo.PAddress = txtAddress.Text;

            //var varRegFee = oOnLinePrescriptionDataContext.lkp_Relationships.Where(id => id.RelMedDiscount.Equals(ddlRelationship.SelectedValue));

            var varRegFeeMax = oOnLinePrescriptionDataContext.lkp_RegistrationFees.Max(x => x.RFTaka);

            var varMedDis = (from lkpRel in oOnLinePrescriptionDataContext.lkp_Relationships
                             where lkpRel.RelCode.Equals(ddlRelationship.SelectedValue)
                             select lkpRel.RelMedDiscount).SingleOrDefault();

            var varTestDis = (from lkpRel in oOnLinePrescriptionDataContext.lkp_Relationships
                             where lkpRel.RelCode.Equals(ddlRelationship.SelectedValue)
                             select lkpRel.RelTestDiscount).SingleOrDefault();

            oPatietnBasicInfo.RegistrationFee = varRegFeeMax;
            oPatietnBasicInfo.MedDiscount = varMedDis;
            oPatietnBasicInfo.TestDiscount = varTestDis;

            oPatietnBasicInfo.Remarks = txtRemarks.Text;

            //Create Error message Object
            BL.Classes.Patient oPatient = new BL.Classes.Patient();
            string sError = oPatient.Verify(oPatietnBasicInfo);

            if (string.IsNullOrEmpty(sError))
                oPatient.Register(oPatietnBasicInfo);
            else
            {
                RadWindowManager.RadAlert(sError, 200, 200, "Alert!!", null);
                return;

            }

            ClearControlled();
            //May be function generation
            //lblForFunctionCall.Text = "<script type='text/javascript'>returnToParent();</script>";
        }
	partial void DeletePatientBasicInfo(PatientBasicInfo instance);
	partial void InsertPatientBasicInfo(PatientBasicInfo instance);
	partial void UpdatePatientBasicInfo(PatientBasicInfo instance);
Exemplo n.º 5
0
        //Save data *******************************************************************************************************************************************
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //
            //ddlThana.Attributes.Add("onchange", " return VerifyThana();");
            ddlThana.Attributes.Add("onClick", "return VerifyThana()");

            //Create ORM Object
            PatientBasicInfo oPatietnBasicInfo = new PatientBasicInfo();

            //Patient type
            oPatietnBasicInfo.PatientType = byte.Parse(ddlPatientType.SelectedValue);

            if (byte.Parse(ddlPatientType.SelectedValue) == 2)
            {
                oPatietnBasicInfo.StudyName = ddlStudyName.SelectedValue;
                oPatietnBasicInfo.StudyID = txtStudyPatientId.Text;
            }
            else if (byte.Parse(ddlPatientType.SelectedValue) == 3)
                oPatietnBasicInfo.StudyID = txtEmployeeId.Text;

            oPatietnBasicInfo.Relationship = byte.Parse(ddlRelationship.SelectedValue);
            //End Patient type

            //Patient Basic Information
            oPatietnBasicInfo.PatientName = txtPatientName.Text;
            oPatietnBasicInfo.FatherName = txtFathersName.Text;
            oPatietnBasicInfo.MotherName = txtMothersName.Text;
            //Check
            oPatietnBasicInfo.Gender = byte.Parse(ddlSex.SelectedValue);
            //need a check here for MS
            oPatietnBasicInfo.MaritalStatus = byte.Parse(ddlMaritalStatus.SelectedValue);
            oPatietnBasicInfo.SpouseName = txtSpouseName.Text;
            //End Patient Basic Information

            //NID & Mobile
            oPatietnBasicInfo.NationalID = txtNID.Text;
            oPatietnBasicInfo.ContactNo = txtMobile.Text;
            //End NID & Mobile

            //Patient Address
            oPatietnBasicInfo.PDistrict = ddlDistrict.SelectedValue;
            oPatietnBasicInfo.PThana = ddlThana.SelectedValue;
            oPatietnBasicInfo.PUnion = ddlUnion.SelectedValue;
            oPatietnBasicInfo.PVillage = ddlVillage.SelectedValue;

            oPatietnBasicInfo.PAddress = txtAddress.Text;
            oPatietnBasicInfo.Remarks = txtRemarks.Text;
            oPatietnBasicInfo.RegistrationDt = DateTime.Now;
            //End Patient Address

            //Age Info
            if (chkDOB.Checked)
                oPatietnBasicInfo.DateOfBirth = RdpDOB.SelectedDate;
            else
            {
                int AgeTotalDays;
                AgeTotalDays = int.Parse(RNtxtAgeMonth.Text) * 30 + int.Parse(RNtxtAgeDay.Text) + int.Parse(RNtxtAgeYear.Text) * 365;
                oPatietnBasicInfo.PatientAge = String.Concat(RNtxtAgeDay.Text, 'D', RNtxtAgeMonth.Text, 'M', RNtxtAgeYear.Text, 'Y');
                oPatietnBasicInfo.DateOfBirth = DateTime.Now.AddDays(-AgeTotalDays);
            }
            //End Age Info

            //Create Error message Object
            BL.Classes.Patient oPatient = new BL.Classes.Patient();
            string sError= oPatient.Verify(oPatietnBasicInfo);

            if (string.IsNullOrEmpty(sError))
                oPatient.Register(oPatietnBasicInfo);
            else
            {
                RadWindowManager.RadAlert(sError, 200, 200, "Alert!!", null);
                return;

            }

            //May be function generation
            lblForFunctionCall.Text = "<script type='text/javascript'>returnToParent();</script>";
            //\\End Save data **********************************************************************************************************************************

            //Refresh Registration Grid
            //RegistrationGrid ORegistrationGrid=new RegistrationGrid();
            //ORegistrationGrid.LoadGridData();
        }