using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
using System.Web.UI;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                   Started Date  : 12-Aug-2007
* Module          : Level Settings                              Last Modified : 14-Aug-2007
* Programmer      : Senthil Kumar NP
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Organization_Settings_delLevels : Base.BasePage
{
    ResourceManager rm;
    CultureInfo ci;
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking and reset date format
        base.Page_Load(sender, e);
        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;
        levelsEventData del = new levelsEventData();
        string gid;
        gid = Request.QueryString["nid"];
        DataSet ds = new DataSet();
        ds = del.CheckForDelLev(gid, "C");
        if (ds.Tables[0].Rows.Count > 0)
        {
            if (ds.Tables[0].Rows[0]["checkFlag"] != DBNull.Value)
            {
                if (Convert.ToInt16(ds.Tables[0].Rows[0]["checkFlag"]) > 0)
                {
                    string strScript = "";
                    strScript = strScript + "<script language='javascript'>";
                    strScript = strScript + "alert('" + rm.GetString("Alert_Cannot_Delete_this_Record_It_is_Already_mapped", ci) + "');history.go(-1)";
                    strScript = strScript + "</script>";
                    Page.RegisterStartupScript("DelAlert2", strScript);
                }
                else
                {
                    del.DelLev(gid, "D");
                    string strScript = "";
                    strScript = strScript + "<script language='javascript'>";
                    strScript = strScript + "alert('" + rm.GetString("Alert_RecordDeletedSuccessfully", ci) + "');";
                    strScript = strScript + "location.replace('Organization_levels.aspx');";
                    strScript = strScript + "</script>";
                    Page.RegisterStartupScript("DelAlert2", strScript);
                }
            }
        }
    }
}
