using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                         Started Date  : 12-Aug-2007
* Module          : Organisation Levels                               Last Modified : 20-Aug-2007
* Programmer      : Senthil Kumar NP
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Masters_TA_UI_Master_LevelChild : Base.BasePage
{
    ResourceManager rm;
    cls_Common objCommon = new cls_Common();
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking
        base.Page_Load(sender, e);
        //get the culture info to set the language
        CultureInfo ci;
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        LoadStrings(ci);
        try
        {
            if (!IsPostBack)
            {
                int levelid = Convert.ToInt16(Request.QueryString["tid"]);
                if (levelid != 0)
                {
                    Session["orgChildId"] = levelid;
                    getLevelDetails();
                }
                objCommon.menu("OrgSettings", "6");
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex);
        }
    }
    protected void getLevelDetails()
    {
        org_levelsEventData selectLevel = new org_levelsEventData();
        DataSet dsLev = new DataSet();
        dsLev = selectLevel.selectChildLevel(Convert.ToInt16(Session["orgChildId"]));
        if (dsLev.Tables[0].Rows.Count > 0)
        {
            //dsLev = selectLevel.selectLevelDetails(Convert.ToInt16(Session["orgChildId"]));
            //if ((Convert.ToString(dsLev.Tables[0].Rows[0]["childId"]) != ""))
            if ((Convert.ToString(dsLev.Tables[0].Rows[0]["Id"]) != ""))
            {
                DataSet dsLevHed = new DataSet();
                dsLevHed = selectLevel.selectParentLevel(Convert.ToInt16(dsLev.Tables[0].Rows[0]["Id"]));
                if (dsLevHed.Tables[0].Rows.Count > 0)
                {
                    Session["orgChildId"] = Convert.ToInt16(dsLev.Tables[0].Rows[0]["Id"]);
                    if ((Convert.ToString(dsLevHed.Tables[0].Rows[0]["levelName"]) != ""))
                    {
                        this.lblHead.Text = Convert.ToString(dsLevHed.Tables[0].Rows[0]["levelName"]) + " Details";
                    }
                }
            }
        }
    }
    protected void btn_cancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("TA_UI_Master_OrganisationLevels.aspx");
    }
    //protected void btn_Modify_Click(object sender, EventArgs e)
    //{
    //    Response.Redirect("TA_UI_Master_LevelModify.aspx");
    //}
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        Response.Redirect("TA_UI_Master_LevelChildAdd.aspx?tid=" + Session["orgChildId"] + "&sid=" + Session.SessionID);
    }
    //Getting Information from resource file and display it in label
    private void LoadStrings(CultureInfo ci)
    {
        //  add treeview's source text here 
    }
}
