Esempio n. 1
0
 /// <summary>
 /// Load current organization data through current org ID
 /// </summary>
 /// <param name="ip"></param>
 public static bool LoadCurrentOrgData(string ip)
 {
     health_office objHealth = new health_office();
     DataTable dtHealth = objHealth.GetDefaultHealthOfficeData(ip);
     if (dtHealth.Rows.Count > 0)
     {
         if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 1)
         {
             // return Ministry of health as title.
             UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString();
             return true;
         }
         if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 2)
         {
             // return Ministry of health as title.
             UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString() + " " + dtHealth.Rows[0]["GoveName"].ToString();
             CurrentOrgGovID = short.Parse(dtHealth.Rows[0]["GovId"].ToString());
             return true;
         }
         if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 3)
         {
             // return Ministry of health as title.
             UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString() + " " + dtHealth.Rows[0]["CivilName"].ToString();
             return true;
         }
         if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 4)
         {
             CurrentOrgID = int.Parse(dtHealth.Rows[0]["HealthOfficeId"].ToString());
             CurrentOrgName = dtHealth.Rows[0]["HEALTHDESCR"].ToString();
             CurrentOrgGovID = short.Parse(dtHealth.Rows[0]["GovId"].ToString());
             CurrentOrgGovName = dtHealth.Rows[0]["GoveName"].ToString();
             if (!string.IsNullOrEmpty(dtHealth.Rows[0]["PoliceID"].ToString()))
             {
                 CurrentOrgPoliceStationID = int.Parse(dtHealth.Rows[0]["PoliceID"].ToString());
                 CurrentOrgPoliceStationName = dtHealth.Rows[0]["PoliceName"].ToString();
             }
             if (!string.IsNullOrEmpty(dtHealth.Rows[0]["AreaID"].ToString()))
             {
                 CurrentOrgAreaID = int.Parse(dtHealth.Rows[0]["AreaID"].ToString());
                 CurrentOrgAreaName = dtHealth.Rows[0]["AreaName"].ToString();
             }
             UnitDisplayTitle = UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString() + " " + dtHealth.Rows[0]["HEALTHDESCR"].ToString();
         }
         return true;
     }
     else
     {
         return false;
     }
 }
    private bool LogicValidateData()
    {
        if (drpLocation.SelectedValue == "2" && drpGov.SelectedValue == "-1")
        {
            lblMsg.Text = "برجاء اختيار مديرية الصحة";
            lblGov.BackColor = System.Drawing.Color.Red;
            return false;
        }
        if (drpLocation.SelectedValue == "3" && drpGov.SelectedValue == "-1")
        {
            lblMsg.Text = "برجاء اختيار مديرية الصحة";
            lblGov.BackColor = System.Drawing.Color.Red;
            return false;
        }
        else if (drpLocation.SelectedValue == "3" && drpCivil.SelectedValue == "-1")
        {
            lblMsg.Text = "برجاء اختيار الادارة الصحية";
            lblCivil.BackColor = System.Drawing.Color.Red;
            return false;
        }
        if (drpLocation.SelectedValue == "4" && drpGov.SelectedValue == "-1")
        {
            lblMsg.Text = "برجاء اختيار مديرية الصحة";
            lblGov.BackColor = System.Drawing.Color.Red;
            return false;
        }
        else if (drpLocation.SelectedValue == "4" && drpCivil.SelectedValue == "-1")
        {
            lblMsg.Text = "برجاء اختيار الادارة الصحية";
            lblCivil.BackColor = System.Drawing.Color.Red;
            return false;
        }
        else if (drpLocation.SelectedValue == "4" && drpHealthOffice.SelectedValue== "-1")
        {
            lblMsg.Text = "برجاء اختيار مكتب الصحة";
            lblOffice.BackColor = System.Drawing.Color.Red;
            return false;
        }
        health_office hoObject = new health_office();
        if (Session["Edit"] != null)
        {
            // update case
            if (txtIP.Text == OldIP)
            {
                return true;
            }
        }
        DataTable dtHodetails = hoObject.GetDefaultHealthOfficeData(txtIP.Text);
        if (dtHodetails.Rows.Count > 0)
        {
            string message="";

            if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "4")
            {
                message = "رقم تعريف الحاسب موجود بالفعل فى" + "<br>" +  " مديرية:" + dtHodetails.Rows[0]["GoveName"].ToString() +
                           "<br> " + "  ادارة:" + dtHodetails.Rows[0]["CivilName"].ToString() +
                           "<br> " + "  مكتب صحة:" + dtHodetails.Rows[0]["HEALTHDESCR"].ToString();
            }
            else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "3")
            {
                message = "رقم تعريف الحاسب موجود بالفعل فى مديرية:" + dtHodetails.Rows[0]["GoveName"].ToString() +
                           "<br> " + "  ادارة:" + dtHodetails.Rows[0]["CivilName"].ToString();
            }
            else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "2")
            {
                message = "رقم تعريف الحاسب موجود بالفعل فى مديرية:" + dtHodetails.Rows[0]["GoveName"].ToString();
            }
            else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "1")
            {
                message = "رقم تعريف الحاسب موجود بالفعل فى ديوان عام وزارة الصحة";
            }
            lblMsg.Text = message;
            return false;
        }
        return true;
    }
Esempio n. 3
0
    private void GetLogicValidation()
    {
        health_office hoObject = new health_office();
        DataTable dtHodetails = hoObject.GetDefaultHealthOfficeData(MHOCommon.CurrentOrgIP);
        if (dtHodetails.Rows.Count > 0)
        {

            if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "4")
            {
                drpGov.SelectedIndex = drpGov.Items.IndexOf(drpGov.Items.FindByText(dtHodetails.Rows[0]["GoveName"].ToString()));
                drpGov_SelectedIndexChanged(null,null);
                drpCivil.SelectedIndex = drpCivil.Items.IndexOf( drpCivil.Items.FindByText(dtHodetails.Rows[0]["CivilName"].ToString()));
                drpCivil_SelectedIndexChanged(null,null);
                drpHealthOffice.SelectedIndex = drpHealthOffice.Items.IndexOf(drpHealthOffice.Items.FindByText(dtHodetails.Rows[0]["HEALTHDESCR"].ToString()));
                drpGov.Enabled = false;
                drpCivil.Enabled = false;
                drpHealthOffice.Enabled = false;
            }
            else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "3")
            {
                drpGov.SelectedIndex = drpGov.Items.IndexOf(drpGov.Items.FindByText(dtHodetails.Rows[0]["GoveName"].ToString()));
                drpGov_SelectedIndexChanged(null,null);
                drpCivil.SelectedIndex = drpCivil.Items.IndexOf( drpCivil.Items.FindByText(dtHodetails.Rows[0]["CivilName"].ToString()));
                drpCivil_SelectedIndexChanged(null,null);
                drpGov.Enabled = false;
                drpCivil.Enabled = false;

            }
            else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "2")
            {
                drpGov.SelectedIndex = drpGov.Items.IndexOf(drpGov.Items.FindByText(dtHodetails.Rows[0]["GoveName"].ToString()));
                drpGov_SelectedIndexChanged(null,null);
                drpCivil.SelectedIndex = drpCivil.Items.IndexOf( drpCivil.Items.FindByText(dtHodetails.Rows[0]["CivilName"].ToString()));
                drpCivil_SelectedIndexChanged(null,null);
                drpGov.Enabled = false;

            }
            else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "1")
            {
             // TO DO
            }

        }
    }