using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
public partial class UserControls_TA_uc_Levels : System.Web.UI.UserControl
{
    cls_Common objCommon = new cls_Common();
    ResourceManager rm;
    CultureInfo ci;
    protected void Page_Load(object sender, EventArgs e)
    {
        //get the culture info to set the language               
        string strSourceLanguage;
        strSourceLanguage = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(strSourceLanguage, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        getLev();
    }
    protected void getTotLevel()
    {
        cls_master_levels totLev = new cls_master_levels();
        int tot;
        tot = totLev.getNoLevel();
        this.Page.RegisterStartupScript("AjaxCalllMethod", "<script>var totLevels =" + tot + ";chckLevel1(0,0); </script>");
    }
    private void getLev123()
    {
        string IDs = "";
        string IDsName = "";
        string IDsName1 = "";
        int intialVal = 0;
        DataSet ds_ParentLevels = new DataSet();
        int LevelID = Convert.ToInt16(Session["orgLevelid"]);
        objCommon.GetParentLevels_FromLevelID(LevelID);
        ds_ParentLevels = objCommon.GetParentLevels();
        foreach (DataRow dr in ds_ParentLevels.Tables[0].Rows)
        {
            if (IDs == "")
            {
                IDs = dr[0].ToString();
                IDsName = "'123" + dr[1].ToString().Replace("'", "\\'") + "<font color=red>*</font>'";
                IDsName1 = dr[1].ToString();
                intialVal = Convert.ToInt16(IDs);
            }
            else
            {
                IDs = IDs + "," + dr[0].ToString();
                IDsName = IDsName + "," + "'" + dr[1].ToString().Replace("'", "\\'") + "'";
            }
        }
        if (Convert.ToInt16(ds_ParentLevels.Tables[0].Rows.Count) > 1)
        {
        }
        else
        {
        }
        if (Convert.ToInt16(ds_ParentLevels.Tables[0].Rows.Count) > 1)
        {
            this.Page.RegisterStartupScript("AjaxCalllMethod", "<script>var totLevels =" + (Convert.ToInt16(ds_ParentLevels.Tables[0].Rows.Count) - 1) + ";var levelArray=new Array(" + IDs + "); var levelNameArray = new Array(" + IDsName + "); chckLevel1_getOrg(0,0,'" + rm.GetString("Select", ci) + "');</script>");
        }
    }
    private void getLev()
    {
        string IDs = "";
        string IDsName = "";
        string IDsName1 = "";
        int intialVal = 0;
        DataSet ds_ParentLevels = new DataSet();
        int LevelID = Convert.ToInt16(Session["orgLevelid"]);
        objCommon.GetParentLevels_FromLevelID(LevelID);
        ds_ParentLevels = objCommon.GetParentLevels();
        foreach (DataRow dr in ds_ParentLevels.Tables[0].Rows)
        {
            if (IDs == "")
            {
                IDs = dr[0].ToString();
                IDsName = "'" + dr[1].ToString().Replace("'", "\\'") + "'";
                IDsName1 = dr[1].ToString();
                intialVal = Convert.ToInt16(IDs);
            }
            else
            {
                IDs = IDs + "," + dr[0].ToString();
                IDsName = IDsName + "," + "'" + dr[1].ToString().Replace("'", "\\'") + "'";
            }
        }
        if (Convert.ToInt16(ds_ParentLevels.Tables[0].Rows.Count) > 1)
        {
        }
        else
        {
        }
        this.Page.RegisterStartupScript("AjaxCalllMethod", "<script>var totLevels =" + (Convert.ToInt16(ds_ParentLevels.Tables[0].Rows.Count) - 1) + ";var levelArray=new Array(" + IDs + "); var levelNameArray = new Array(" + IDsName + "); chckLevel1_getOrg(0,0,'" + rm.GetString("Select", ci) + "');</script>");
    }
}
