using System;
using System.Data;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                               Created On  : 12-Aug-2007
* Module          : Generic Master                                          Modified On : 21-July-2007
* Created By      : Arun Vinoth.T
* Modified By     : 
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Masters_Lookup_Remote : Base.BasePage
{
    EmployeeEventData objEmployee = new EmployeeEventData();
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking and reset date format
        base.Page_Load(sender, e);
        if (!IsPostBack)
        {
            if (Request.QueryString["type"] != null && Request.QueryString["type"] != "" && Request.QueryString["ID"] != null && Request.QueryString["ID"] != "")
            {
                int type = Convert.ToInt32(Request.QueryString["type"].ToString());
                int ID = Convert.ToInt32(Request.QueryString["ID"].ToString());
                if (type == 1)
                {
                    Session["country"] = ID;
                    getStates(ID);
                }
                if (type == 2)
                {
                    Session["state"] = ID;
                    getCity(ID);
                }
                if (type == 3)
                {
                    Session["city"] = ID;
                }
            }
        }
        //else
        //{
        //    Response.Clear();
        //    //Response.Write("Fail");
        //    Response.End();
        //}
    }
    private void getStates(int Id)
    {
        DataSet ds_state = new DataSet();
        ds_state = objEmployee.SelectStates(Id);
        if (ds_state.Tables[0].Rows.Count > 0)
        {
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(ds_state.GetXml());
            Response.End();
            ds_state.Dispose();
        }
    }
    private void getCity(int Id)
    {
        DataSet ds_city = new DataSet();
        ds_city = objEmployee.SelectCities(Id);
        if (ds_city.Tables[0].Rows.Count > 0)
        {
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(ds_city.GetXml());
            Response.End();
            ds_city.Dispose();
        }
    }
}
