protected void uiDropDownListCivil_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (uiDropDownListCivil.SelectedIndex != 0 && uiDropDownListGov.SelectedIndex != 0)
     {
         health_office obj = new health_office();
         uiDropDownListHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListGov.SelectedValue), short.Parse(uiDropDownListCivil.SelectedValue)).DefaultView;
         uiDropDownListHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR;
         uiDropDownListHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD;
         uiDropDownListHealthOffice.DataBind();
         uiDropDownListHealthOffice.Items.Insert(0, new ListItem("---", "0"));
         uiDropDownListHealthOffice.SelectedIndex = 0;
     }
 }
    private void setCurrentUserInfo()
    {
        try
        {
            OrgUser Current = new OrgUser();
            if (MHOCommon.CurrentLoggedUserID != null && MHOCommon.CurrentLoggedUserID != Guid.Empty)
            {
                Current.LoadByPrimaryKey(MHOCommon.CurrentLoggedUserID);
                uiTextBoxNotifierName.Text = Current.FirstName.Trim() + " " + Current.FatherName.Trim();

                if (Current.GovId != 0)
                {
                    uiDropDownListGov.SelectedValue = Current.GovId.ToString();
                    uiDropDownListGov.Enabled = false;
                    uiDropDownListMachineGov.SelectedValue = Current.GovId.ToString();
                    uiDropDownListMachineGov.Enabled = false;

                    /*********************/
                    if (uiDropDownListGov.SelectedIndex != 0)
                    {
                        CIVIL_OFFICE pol = new CIVIL_OFFICE();
                        pol.Where.FK_GOVCD.Value = short.Parse(uiDropDownListGov.SelectedValue);
                        pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                        pol.Query.AddOrderBy(CIVIL_OFFICE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
                        pol.Query.Load();
                        uiDropDownListCivil.DataSource = pol.DefaultView;
                        uiDropDownListCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR;
                        uiDropDownListCivil.DataValueField = POLICE_STATION.ColumnNames.CD;
                        uiDropDownListCivil.DataBind();
                        uiDropDownListCivil.Items.Insert(0, new ListItem("---", "0"));
                        uiDropDownListCivil.SelectedIndex = 0;
                    }

                    if (uiDropDownListMachineGov.SelectedIndex != 0)
                    {
                        CIVIL_OFFICE pol = new CIVIL_OFFICE();
                        pol.Where.FK_GOVCD.Value = short.Parse(uiDropDownListMachineGov.SelectedValue);
                        pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                        pol.Query.AddOrderBy(CIVIL_OFFICE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
                        pol.Query.Load();
                        uiDropDownListMachineCivil.DataSource = pol.DefaultView;
                        uiDropDownListMachineCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR;
                        uiDropDownListMachineCivil.DataValueField = POLICE_STATION.ColumnNames.CD;
                        uiDropDownListMachineCivil.DataBind();
                        uiDropDownListMachineCivil.Items.Insert(0, new ListItem("---", "0"));
                        uiDropDownListMachineCivil.SelectedIndex = 0;
                    }

                    if (Current.CivilId != 0)
                    {
                        uiDropDownListCivil.SelectedValue = Current.CivilId.ToString();
                        uiDropDownListCivil.Enabled = false;
                        uiDropDownListMachineCivil.SelectedValue = Current.CivilId.ToString();
                        uiDropDownListMachineCivil.Enabled = false;

                        if (uiDropDownListCivil.SelectedIndex != 0 && uiDropDownListGov.SelectedIndex != 0)
                        {
                            health_office obj = new health_office();
                            uiDropDownListHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListGov.SelectedValue), short.Parse(uiDropDownListCivil.SelectedValue)).DefaultView;
                            uiDropDownListHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR;
                            uiDropDownListHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD;
                            uiDropDownListHealthOffice.DataBind();
                            uiDropDownListHealthOffice.Items.Insert(0, new ListItem("---", "0"));
                            uiDropDownListHealthOffice.SelectedIndex = 0;
                        }

                        if (uiDropDownListMachineGov.SelectedIndex != 0 && uiDropDownListMachineCivil.SelectedIndex != 0)
                        {
                            health_office obj = new health_office();
                            uiDropDownListMachineHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListMachineGov.SelectedValue), short.Parse(uiDropDownListMachineCivil.SelectedValue)).DefaultView;
                            uiDropDownListMachineHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR;
                            uiDropDownListMachineHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD;
                            uiDropDownListMachineHealthOffice.DataBind();
                            uiDropDownListMachineHealthOffice.Items.Insert(0, new ListItem("---", "0"));
                            uiDropDownListMachineHealthOffice.SelectedIndex = 0;
                        }
                    }
                }
                /************************/
            }
        }
        catch (Exception)
        {
            // gives error when log out
        }
    }
 private void Filter()
 {
     health_office obj = new health_office();
     grdGovernate.DataSource = obj.GetHealthOfficeDetails(short.Parse(drpGove.SelectedValue), short.Parse(drpCivilOffice.SelectedValue)).DefaultView;
     grdGovernate.DataBind();
 }