/// <summary>
    /// Loads Data For Edit Mode
    /// </summary>
    private void LoadData()
    {
        // set default values
        lblRecordDateValue.Text = DateTime.Now.Date.ToShortDateString();
        lblHealthOfficeValue.Text = MHOCommon.CurrentOrgName;
        DecisionControl1.HealthOffice = "المعادي";
        if (BornEventIdParameter != null)
        {

            Born born = new Born();
            if (born.LoadByPrimaryKey(BornEventIdParameter.Value))
            {
                // load Born Basic Data
                UcBornInfo1.EventChildName = born.BornName;
                UcBornInfo1.EventChildGender = born.BornGender;
                UcBornInfo1.Month = born.BirthDate.Month.ToString();
                UcBornInfo1.Year = born.BirthDate.Year.ToString();
                UcBornInfo1.Day = born.BirthDate.Day.ToString();
                UcBornInfo1.Minute = born.BirthDate.Minute.ToString();
                UcBornInfo1.Hour = born.BirthDate.Hour.ToString();
                UcBornInfo1.EventChildGovernate = born.BornGovernorate;
                UcBornInfo1.LoadPoliceStation();
                UcBornInfo1.EventChildPoliceStation = born.BornSection;
                UcBornInfo1.LoadArea();
                UcBornInfo1.EventChildArea = born.BornArea;
                UcFatherInfo2.ParentNID = born.FatherNID;
                UcFatherInfo2.ParentFirstName = born.FirstFatherName;
                UcFatherInfo2.ParentFatherName = born.SecondFatherName;
                UcFatherInfo2.ParentFamilyName = born.FamilyFatherName;
                UcFatherInfo2.ParentJob = born.FatherJob;
                UcFatherInfo2.ParentRelegion = born.FatherReligion;
                UcFatherInfo2.LoadLookups();
                UcFatherInfo2.ParentNationality = born.FatherNationality;
                UcFatherInfo2.ProveNo = born.FatherProveNo;
                UcFatherInfo2.ProveType = born.FatherProveType;
                UcFatherInfo2.ParentSureName = born.FatherSureName;
                // If the parent was egyptian
                UcFatherInfo2.ShowHideNID(born.FatherNationality == 13818);

                UcMotherInfo2.ParentNID = born.MotherNID;
                UcMotherInfo2.ParentFirstName = born.FirstMotherName;
                UcMotherInfo2.ParentFatherName = born.SecondMotherName;
                UcMotherInfo2.ParentFamilyName = born.FamilyMotherName;
                UcMotherInfo2.ParentJob = born.MotherJob;
                UcMotherInfo2.ParentRelegion = born.MotherReligion;
                UcMotherInfo2.LoadLookups();
                UcMotherInfo2.ParentNationality = born.MotherNationality;
                UcMotherInfo2.ProveNo = born.MotherProveNo;
                UcMotherInfo2.ProveType = born.MotherProveType;
                UcMotherInfo2.ParentSureName = born.MotherSureName;

                // If the parent was egyptian
                UcMotherInfo2.ShowHideNID(born.MotherNationality == 13818);

                UcNotifierInfo1.NotifierRelation = born.InformerRelation;
                UcNotifierInfo1.NotifierFName = born.InformerFirstName;
                UcNotifierInfo1.NotifierFatherName = born.InformerSecondName;
                UcNotifierInfo1.NotifierphoneNo = born.InformerPhone;
                UcNotifierInfo1.NotifierNID = born.InformerNID;
                UcNotifierInfo1.NotifierAddress = born.InformerAddress;
                txtRecordNumber.Text = born.RegisterNo.ToString();
                drpRegestierNoList.Value = born.RegisterID.ToString();
                // Load Register Name
                ManualRegister obj = new ManualRegister();
                obj.LoadByPrimaryKey(new Guid(born.RegisterID.ToString()));
                txtRegestierNoList.Text = obj.RegisterCode;

                if (IsLostCase)
                {
                    if (born.IsFound)
                    {
                        rdTypeList.ClearSelection();
                        rdTypeList.Items.FindByValue("1").Selected = true;
                    }
                    DecisionControl1.NotesValue = born.BornDecisionNotes;
                    DecisionControl1.DecisionDate = born.BornDecisionDate;
                    DecisionControl1.DecisionDirectionValue = born.BornDecisionDirection;
                    DecisionControl1.DecisionNumber = born.BornDecisionNo;
                    if (rdTypeList.SelectedValue == "1")
                    {
                        DecisionControl1.lblDecisionDirector = "نيابة";
                    }
                }
            }

            // Load Medical Data
            BornMedicalInfo objBornMedicalInfo = new BornMedicalInfo();
            objBornMedicalInfo.Where.BornEventID.Value = BornEventIdParameter.Value;
            objBornMedicalInfo.Where.BornEventID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

            if (objBornMedicalInfo.Query.Load())
            {
                //txtWeight1.Text = objBornMedicalInfo.BornWeightGram.ToString();
                //txtWeight2.Text = objBornMedicalInfo.BornWeightKG.ToString();
                int _bornwieght = 1;
                if (objBornMedicalInfo.BornWeightKG < 1 || objBornMedicalInfo.BornWeightKG > 3)
                {
                    _bornwieght = 1;
                }
                else
                {
                    _bornwieght = objBornMedicalInfo.BornWeightKG;
                }
                drpBornWieght.SelectedIndex = drpBornWieght.Items.IndexOf(drpBornWieght.Items.FindByValue(_bornwieght.ToString()));

                txtBirthLocation.Text = objBornMedicalInfo.BirthPlace;
                txtCurrentInterval2.Text = objBornMedicalInfo.MarriageDurationYears.ToString();
                txtCurrentInterval1.Text = objBornMedicalInfo.MarriageDurationMonth.ToString();
                txtPastInterval2.Text = objBornMedicalInfo.XMarriageDurationYears.ToString();
                txtPastInterval1.Text = objBornMedicalInfo.XMarriageDurationMonth.ToString();
                txtTwinsNo.Text = objBornMedicalInfo.TwinsNo.ToString();
                txtOldBornNo.Text = objBornMedicalInfo.OlderBornNo.ToString();
                txtXOldBornNo.Text = objBornMedicalInfo.XOlderBornNo.ToString();
                txtPastDeadNoOfChildrent.Text = objBornMedicalInfo.DeadBornNo.ToString();
                txtNationalNumber.Text = objBornMedicalInfo.ObstetricsNID;
                txtFirstName.Text = objBornMedicalInfo.ObstetricsFName;
                txtRemainName.Text = objBornMedicalInfo.ObstetricsLName;
                drpRelation.SelectedValue = objBornMedicalInfo.ObstetricsRelation.ToString();
            }
            // default totals
            txtTotal1.Text = (int.Parse(txtTwinsNo.Text) + 1).ToString();
            txtTotal2.Text = (int.Parse(txtOldBornNo.Text) + 1).ToString();
            txtTotal3.Text = (int.Parse(txtXOldBornNo.Text) + 1).ToString();
        }
    }
    /// <summary>
    /// Load drop down list
    /// </summary>
    private void LoadLookups()
    {
        ManualRegister objReg = new ManualRegister();
        objReg.Where.CurrentRegister.Value = 1;
        objReg.Where.CurrentRegister.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.CurrentRegister.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.RegisterType.Value = 1;//for born
        objReg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
        objReg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Query.Load();

        //drpRegestierNoList.DataSource = objReg.DefaultView;
        //drpRegestierNoList.DataTextField = ManualRegister.ColumnNames.RegisterCode;
        //drpRegestierNoList.DataValueField = ManualRegister.ColumnNames.RegisterID;
        //drpRegestierNoList.DataBind();
        drpRegestierNoList.Value = objReg.RegisterID.ToString();
        txtRegestierNoList.Text = objReg.RegisterCode;

        // default totals
        txtTotal1.Text = (int.Parse(txtTwinsNo.Text) + 1).ToString();
        txtTotal2.Text = (int.Parse(txtOldBornNo.Text) + 1).ToString();
        txtTotal3.Text = (int.Parse(txtXOldBornNo.Text) + 1).ToString();
    }
    /// <summary>
    /// Load drop down list
    /// </summary>
    private void LoadLookups()
    {
        ManualRegister objReg = new ManualRegister();
        objReg.Where.CurrentRegister.Value = true;
        objReg.Where.CurrentRegister.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.CurrentRegister.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.RegisterType.Value = 2;//for born
        objReg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
        objReg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Query.Load();

        //drpRegestierNoList.DataSource = objReg.DefaultView;
        //drpRegestierNoList.DataTextField = ManualRegister.ColumnNames.RegisterCode;
        //drpRegestierNoList.DataValueField = ManualRegister.ColumnNames.RegisterID;
        //drpRegestierNoList.DataBind();

        drpRegestierNoList.Value = objReg.RegisterID.ToString();
        txtRegestierNoList.Text = objReg.RegisterCode;
    }
    private void LoadLookups()
    {
        ManualRegister objReg = new ManualRegister();
        objReg.Where.RegisterType.Value = 1;
        objReg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

        objReg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
        objReg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

        objReg.Query.AddOrderBy(ManualRegister.ColumnNames.CurrentRegister, MyGeneration.dOOdads.WhereParameter.Dir.DESC);

        objReg.Query.Load();
        drpRegestierNoList.DataSource = objReg.DefaultView;
        drpRegestierNoList.DataTextField = ManualRegister.ColumnNames.RegisterCode;
        drpRegestierNoList.DataValueField = ManualRegister.ColumnNames.RegisterID;
        drpRegestierNoList.DataBind();
    }
    /// <summary>
    /// Load drop down list
    /// </summary>
    private void LoadLookups()
    {
        if (MHOCommon.CurrentOrgID == null)
        {
            Response.Redirect("login.aspx");
        }

        ManualRegister objReg = new ManualRegister();
        objReg.Where.CurrentRegister.Value = true;
        objReg.Where.CurrentRegister.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.CurrentRegister.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.RegisterType.Value = 2;//for born
        objReg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
        objReg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

        if (objReg.Query.Load())
        {
            drpRegestierNoList.Value = objReg.RegisterID.ToString();
            txtRegestierNoList.Text = objReg.RegisterCode;
            uiLabelRegisterNo.Text = objReg.RegisterCode;
        }
        else
        {
            Response.Redirect("OpenRegister.aspx?ErrorFlag=Dead");
        }
    }
    private void LoadData()
    {
        DecisionControl1.HealthOffice = "المعادي";
        if (DeadEventIDParameter != null)
        {

            Dead objDead = new Dead();
            objDead.LoadByPrimaryKey(DeadEventIDParameter.Value);
            UcDeathInfo2.ShowHideNID(objDead.DeadNationality == 13818);
            UcDeathInfo2.EventDeadNID = objDead.DeadNID;
            UcDeathInfo2.EventDeadGender = objDead.DeadGender;
            UcDeathInfo2.EventDeadFristName = objDead.DeadFirstName;
            UcDeathInfo2.EventDeadFatherName = objDead.DeadFatherName;
            UcDeathInfo2.EventDeadFamilyName = objDead.DeadGrandName;
            UcDeathInfo2.EventDeadTitle = objDead.DeadFamilyName;
            UcDeathInfo2.EventDeadNationality = objDead.DeadNationality;
            UcDeathInfo2.EventDeadReligion = objDead.DeadReligion;
            UcDeathInfo2.EventDeadMartialStatus = objDead.DeadMartialStatus;
            UcDeathInfo2.EventDeadCardNo = objDead.PaperID;
            UcDeathInfo2.EventDeadCardType = objDead.PaperIDType;
            UcDeathInfo2.EventCardLocation = objDead.PaperIssuePlace;
            UcDeathInfo2.ProveType = objDead.ProveText;
            UcDeathInfo2.ProveNo = objDead.ProveNumber;
            UcDeathInfo2.EventDeadBirthDate = objDead.DeadBirthDate.ToShortDateString();

            UcAddressInfo1.EventDeadAddressNo = objDead.AddressNo;
            UcAddressInfo1.EventDeadAddressStreet = objDead.AddressStreet;
            UcAddressInfo1.EventDeadAddressSign = objDead.AddressFeatured;
            UcAddressInfo1.DeadAddressGovernate = objDead.DeadGovernorate;
            UcAddressInfo1.LoadPoliceStation();
            UcAddressInfo1.DeadAddressPoliceStation = objDead.DeadSection;
            UcAddressInfo1.LoadArea();
            UcAddressInfo1.DeadAddressArea = objDead.DeadArea;
            UcAddressInfo1.EventDeadAddressPhone = objDead.DeadPhone;
            UcAddressInfo1.EventDeadAddressJob = objDead.DeadJob;

            UcGeneralDeathInfo1.EventDeadDieDate = objDead.DeadDieDate.ToShortDateString();
            UcGeneralDeathInfo1.EventDeadPlace = objDead.DiePlace;
            UcGeneralDeathInfo1.EventDeadPlaceDescription = objDead.DiePlaceDescription;
            UcGeneralDeathInfo1.EventDeadDieHour = objDead.DeadDieHour;
            UcGeneralDeathInfo1.EventDeadDieMin = objDead.DeadDieMin;
            //objDead.DieGovernorate = -- ToDO
            //objDead.DieSection = --ToDo
            //objDead.DieArea = --ToDo
            UcMotherInfo2.ParentNID = objDead.DeadMotherNID;
            UcMotherInfo2.ParentNationality = objDead.DeadMotherNationality;
            UcMotherInfo2.ParentFirstName = objDead.DeadMotherFirstName;
            UcMotherInfo2.ParentFatherName = objDead.DeadMotherSecondName;
            UcMotherInfo2.ParentFamilyName = objDead.DeadMotherFamilyName;
            //UcMotherInfo2.ParentSureName = objDead.deadmo
            UcMotherInfo2.ParentRelegion = objDead.DeadMotherReligion;
            UcMotherInfo2.ParentJob = objDead.DeadMotherJob;
            UcNotifierInfo2.NotifierRelation = objDead.InformerRelation;
            UcNotifierInfo2.NotifierphoneNo = objDead.InformerPhone;
            UcNotifierInfo2.NotifierNID = objDead.InformerNID;
            UcNotifierInfo2.NotifierFName = objDead.InformerFirstName;
            UcNotifierInfo2.NotifierFatherName = objDead.InformerSecondName;
            UcMotherInfo2.ParentSureName = objDead.DaadMotherSureName;
            //objDead.InformerAddress = UcNotifierInfo2.
            drpRegestierNoList.Value = objDead.RegisterID.ToString();
            ManualRegister obj = new ManualRegister();
            obj.LoadByPrimaryKey(new Guid(objDead.RegisterID.ToString()));
            txtRegestierNoList.Text = obj.RegisterCode;

            txtRecordNumber.Text = objDead.RegisterNo.ToString();
            if (IsLostCase)
            {
                if (objDead.IsUnKown)
                {
                    rdTypeList.ClearSelection();
                    rdTypeList.Items.FindByValue("1").Selected = true;
                }
                DecisionControl1.NotesValue = objDead.DeadDecisionNotes;
                DecisionControl1.DecisionDate = objDead.DeadDecisionDate;
                DecisionControl1.DecisionDirectionValue = objDead.DeadDecisionDirection;
                DecisionControl1.DecisionNumber = objDead.DeadDecisionNo;
                if (rdTypeList.SelectedValue == "1")
                {
                    DecisionControl1.lblDecisionDirector = "نيابة";
                }
            }
        }
    }
    private void FilterReg()
    {
        ManualRegister reg = new ManualRegister();
        int filterYear;
        if (txtRegYear.Text != "" && int.TryParse(txtRegYear.Text,out filterYear))
        {

            reg.Where.RegisterYear.Value = filterYear;
            reg.Where.RegisterYear.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.RegisterYear.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        }
        reg.Where.RegisterType.Value = int.Parse(drpRegType.SelectedValue);
        reg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        reg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

        reg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
        reg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        reg.Query.AddOrderBy(ManualRegister.ColumnNames.RegisterCode, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
        reg.Query.Load();

        grdReg.DataSource = reg.DefaultView;
        grdReg.DataBind();
    }
 private void UpodateReg(int regYear,bool isCurrent)
 {
     if (changeCurrentReg(regYear, isCurrent))
     {
         ManualRegister regUpd = new ManualRegister();
         regUpd.LoadByPrimaryKey(CurrentRegID.Value);
         regUpd.CurrentRegister = true;
         regUpd.Save();
     }
 }
 private void deleteReg(Guid regIDtoDelete)
 {
     ManualRegister delReg = new ManualRegister();
     try
     {
         delReg.DeleteReg(regIDtoDelete);
     }
     catch
     {
         MHOCommon.ShowMessage("انت تحاول حذف دفتر يحتوى على سجلات او هذا هو الدفتر الوحيد", this.Page);
     }
 }
    private void ChangetoEditMode(Guid regID)
    {
        ManualRegister obgReg = new ManualRegister();
        obgReg.LoadByPrimaryKey(regID);

        txtCreateDate1.Text = obgReg.CreationDate.ToShortDateString();
        string _regCode = obgReg.RegisterCode.ToString();
        txtRegCode.Text = _regCode.Substring(0, 1);
        txtRegDefaultYear.Text = _regCode.Substring(2, 4);
        drpRegType.SelectedIndex = drpRegType.Items.IndexOf(
                                   drpRegType.Items.FindByValue(obgReg.RegisterType.ToString()));
        chkRegIsCurrent.Checked = obgReg.CurrentRegister;

        txtCreateDate1.ReadOnly = true;
        txtRegCode.ReadOnly = true;
        txtRegDefaultYear.ReadOnly = true;
        drpRegType.Enabled = false;
        //        clndrCreateDate.Enabled = false;
        if (obgReg.CurrentRegister)
            chkRegIsCurrent.Enabled = false;
        CurrentRegID = regID;
        btnAddNewReg.Text = "تعديل";
    }
    private bool changeCurrentReg(int regYear, bool isCurrent)
    {
        ManualRegister reg = new ManualRegister();
        if (!isCurrent)
        {
            reg.Where.CurrentRegister.Value = true;
            reg.Where.CurrentRegister.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.CurrentRegister.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

            reg.Where.RegisterType.Value = int.Parse(drpRegType.SelectedValue);
            reg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

            reg.Where.RegisterYear.Value = regYear;
            reg.Where.RegisterYear.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.RegisterYear.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
            reg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
            reg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

            if (!reg.Query.Load())
            {
                MHOCommon.ShowMessage("لابد ان يكون دفتر هو الحالى خلال هذا العام", this.Page);
                return false;
            }

        }
        else
        {
            reg.Where.CurrentRegister.Value = true;
            reg.Where.CurrentRegister.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.CurrentRegister.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

            reg.Where.RegisterType.Value = int.Parse(drpRegType.SelectedValue);
            reg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

            reg.Where.RegisterYear.Value = regYear;
            reg.Where.RegisterYear.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            reg.Where.RegisterYear.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;

            reg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
            reg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

            if (reg.Query.Load())
            {
                reg.CurrentRegister = false;
                reg.Save();
            }
        }
        return true;
    }
 private void AddNewReg()
 {
     try
     {
         //if (changeCurrentReg(int.Parse(txtRegDefaultYear.Text), chkRegIsCurrent.Checked) || (DateTime.Parse(txtCreateDate1.Text) > DateTime.Now.Date))
         //{
         //    ManualRegister reg = new ManualRegister();
         //    reg.AddNew();
         //    reg.RegisterCode = txtRegCode.Text + "/" + txtRegDefaultYear.Text;
         //    IFormatProvider culture = new CultureInfo("en-US", true);
         //    reg.CreationDate = DateTime.Parse (Convert.ToDateTime(txtCreateDate1.Text).ToShortDateString()); //DateTime.ParseExact(txtCreateDate1.Text, "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture);
         //    reg.RegisterYear = int.Parse(txtRegDefaultYear.Text);
         //    reg.RegisterType = int.Parse(drpRegType.SelectedValue);
         //    reg.OrgID = MHOCommon.CurrentOrgID.Value;
         //    reg.CurrentRegister = chkRegIsCurrent.Checked;
         //    reg.StartSerial = 1;
         //    reg.Save();
         //}
         ManualRegister objreg = new ManualRegister();
         objreg.InsertNewRegister(MHOCommon.CurrentOrgID.Value, int.Parse(txtRegDefaultYear.Text)
                                 , int.Parse(drpRegType.SelectedValue), txtRegCode.Text + "/" + txtRegDefaultYear.Text);
     }
     catch
     {
         MHOCommon.ShowMessage("لقد حاولت ادخال كود دفتر موجود من قبل او بيانات غير صحيحة", this.Page);
     }
 }
    /// <summary>
    /// Load drop down list
    /// </summary>
    private void LoadLookups()
    {
        if (MHOCommon.CurrentOrgID == null)
        {
            Response.Redirect("login.aspx");
        }

        ManualRegister objReg = new ManualRegister();
        objReg.Where.CurrentRegister.Value = 1;
        objReg.Where.CurrentRegister.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.CurrentRegister.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.RegisterType.Value = 1;//for born
        objReg.Where.RegisterType.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        objReg.Where.RegisterType.Conjuction = MyGeneration.dOOdads.WhereParameter.Conj.And;
        objReg.Where.OrgID.Value = MHOCommon.CurrentOrgID;
        objReg.Where.OrgID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

        if (objReg.Query.Load())
        {
            drpRegestierNoList.Value = objReg.RegisterID.ToString();
            txtRegestierNoList.Text = objReg.RegisterCode;
            uiLabelRecordNo.Text = objReg.RegisterCode;
        }
        else
        {
            Response.Redirect("OpenRegister.aspx?ErrorFlag=Born");
        }

        // default totals
        txtTotal1.Text = (int.Parse(txtTwinsNo.Text) + 1).ToString();
        txtTotal2.Text = (int.Parse(txtOldBornNo.Text) + 1).ToString();
        txtTotal3.Text = (int.Parse(txtXOldBornNo.Text) + 1).ToString();
    }