using System;
using System.Globalization;
using System.Resources;
using System.Threading;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                        Created On  : 12-Aug-2007
* Module          : Leave Policy                                     Modified On : 08-Aug-2007
* Created By      : Arun Vinoth.T
* Modified By     : 
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Masters_LeavePolicy_Remote : Base.BasePage
{
    int PolicyID;
    string Policy;
    int controlID;
    ResourceManager rm;
    CultureInfo ci;
    EmployeeEventData objEmployee = new EmployeeEventData();
    protected override void Page_Load(object sender, EventArgs e)
    {
        GC.Collect();
        // session checking
        base.Page_Load(sender, e);
        //get the culture info to set the language
        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;
        if (Request.QueryString["controlID"] != null && Request.QueryString["controlID"] != "" && Request.QueryString["Id"] != null && Request.QueryString["Id"] != "" && Request.QueryString["Policy"] != null && Request.QueryString["Policy"] != "")
        {
            controlID = Convert.ToInt32(Request.QueryString["controlID"].ToString());
            PolicyID = Convert.ToInt32(Request.QueryString["Id"].ToString());
            Policy = Request.QueryString["Policy"].ToString();
            string strGender = Request.QueryString["Gender"].ToString();
            int Religion = Convert.ToInt32(Request.QueryString["Religion"].ToString());
            int EmpCategory = Convert.ToInt32(Request.QueryString["EmployeeCategory"].ToString());
            int EmpType = Convert.ToInt32(Request.QueryString["EmployeeType"].ToString());
            int LeavePolicyCount;
            LeavePolicyCount = objEmployee.ValidateLeavePolicyByFilters(EmpCategory, EmpType, strGender, Religion, PolicyID);
            if (LeavePolicyCount == 0)
            {
                Response.Write("LeavePolicyNotExists");
                Response.End();
            }
            else
            {
                GenerateControls();
            }
        }
        //else
        //{
        //    Response.Clear();
        //    //Response.Write("Fail");
        //    Response.End();
        //}
    }
    private void GenerateControls()
    {
        Response.Clear();
        string str_tblpolicy = "";
        #region Unused
        //str_tblpolicy += "<table id='tbl_LeavePolicy' width='100%'>";
        //str_tblpolicy += "<tr align='left'><td class='td' width='20%' align='left'>" + Policy + "</td>";
        //str_tblpolicy += "<td class='td' width='35%' align='left'><table><tr><td>";
        //str_tblpolicy += "<input type='text' ID='txt_From" + controlID + "' Class='textbox_4' onpaste='return false' ondrop='return false' oncut='return false' onkeypress='return key_press_nokey(event)' onkeydown='return key_press_nokey(event)' EnableViewState='true' runat='server' MaxLength='10' onchange=\"javascript:return assign_hidden_policy(this);\"/>&nbsp;</td><td class='datepicker'>";
        //str_tblpolicy += "<a href='javascript:;' id=\"buttxt_From" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_From" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_From" + controlID + "',  singleClick    :    true,   step           :    1 });return false;\"/><img src='../Images/dateicon.gif' border=0></a></td></tr></table>";
        ////str_tblpolicy += "<input type=\"image\" src=\"../Images/dateicon.gif\" name=\"buttxt_From" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_From" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_From" + controlID + "',  singleClick    :    true,   step           :    1 });return false\"/>";
        //str_tblpolicy += "</td><td class='td' width='35%' align='left'><table><tr><td>";
        //str_tblpolicy += "<input type='text' ID='txt_To" + controlID + "' Class='textbox_4' onpaste='return false' ondrop='return false' oncut='return false' onkeypress='return key_press_nokey(event)' onkeydown='return key_press_nokey(event)' EnableViewState='true' runat='server' MaxLength='10' onchange=\"javascript:return assign_hidden_policy(this);\"/>&nbsp;</td><td class='datepicker'>";
        //str_tblpolicy += "<a href='javascript:;' id=\"buttxt_To" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_To" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_To" + controlID + "',  singleClick    :    true,   step           :    1 });return false;\"/><img src='../Images/dateicon.gif' border=0></a></td></tr></table>";
        ////str_tblpolicy += "<input type=\"image\" src=\"../Images/dateicon.gif\" name=\"buttxt_To" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_To" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_To" + controlID + "',  singleClick    :    true,   step           :    1 });return false\"/>";
        //str_tblpolicy += "</td><td class='td' align='left' width='10%'><input Class=\"but\" id=\"Del_Button" + controlID + "\" type=\"button\" value=\"" + rm.GetString("btn_Delete", ci) + "\" runat=\"server\" OnClick=\"javascript:return removeRowAdd(" + PolicyID + ",this);\"/><div runat='server' id='div_" + controlID + "' style='display:none'>" + PolicyID + "</div></td><tr>";
        //str_tblpolicy += "</table >";
        //str_tblpolicy += "<table id='tbl_LeavePolicy' style='width:100%;'>";
        //str_tblpolicy += "<tr class='form-group row'><td class='col-md-3' align='left' >" + Policy + "</td>";
        //str_tblpolicy += "<td class='col-md-3'>";
        ////onkeypress='return key_press_nokey(event)' onkeydown='return key_press_nokey(event)' 
        ////str_tblpolicy += "<script type='text/javascript'>var rangeDemoFormat = '" + Convert.ToString(Session["IDateFormat"]) + "'; var rangeDemoConv = new AnyTime.Converter({format:rangeDemoFormat});if(rangeDemoFormat =='DD-MMM-YYYY'){var Earlier="01-Jan-1900";var Final="31-Dec-9999";}else{var Earlier="01/01/1900";var Final="12/31/9999";}   $('#ctl00_BodyContentPH_txt_From" + controlID + "').AnyTime_picker({earliest:Earlier,format:rangeDemoFormat,latest:Final});</script>";
        ////str_tblpolicy += "<td class='datepicker'><a href='javascript:;' id=\"buttxt_From" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_From" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_From" + controlID + "',  singleClick    :    true,   step           :    1 });return false;\"/><img src='../Images/dateicon.gif' border=0></a></td>";
        ////str_tblpolicy += "<input type=\"image\" src=\"../Images/dateicon.gif\" name=\"buttxt_From" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_From" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_From" + controlID + "',  singleClick    :    true,   step           :    1 });return false\"/>";
        //str_tblpolicy += "</td><td class='col-md-3'>";
        ////str_tblpolicy += "<a href='javascript:;' id=\"buttxt_To" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_To" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_To" + controlID + "',  singleClick    :    true,   step           :    1 });return false;\"/><img src='../Images/dateicon.gif' border=0></a></td></tr></table>";
        ////str_tblpolicy += "<input type=\"image\" src=\"../Images/dateicon.gif\" name=\"buttxt_To" + controlID + "\" onclick=\"Calendar.setup({inputField     :    'txt_To" + controlID + "',ifFormat       :    '" + Convert.ToString(Session["IDateFormat"]) + "',showsTime      :    false, button         :    'buttxt_To" + controlID + "',  singleClick    :    true,   step           :    1 });return false\"/>";
        //str_tblpolicy += "</td><td class='col-md-3'></td><tr>";
        //str_tblpolicy += "</table >";
        #endregion
        str_tblpolicy += "<div id='tbl_LeavePolicy" + controlID + "'>";
        str_tblpolicy += "<div class='row'>";
        str_tblpolicy += "<div class='col-md-2'>" + Policy;
        str_tblpolicy += "</div>";
        str_tblpolicy += "<div class='col-md-3'>";
        str_tblpolicy += "<input type='text' ID='txt_From" + controlID + "' style='margin-bottom:15px' Class='form-control' placeholder='From Date' onpaste='return false' ondrop='return false' oncut='return false' EnableViewState='true' runat='server' MaxLength='10' onselect=\"javascript:return DynamicDatePicker('" + Convert.ToString(Session["IDateFormat"]) + "','txt_From" + controlID + "');\" onmouseover=\"javascript:return DynamicDatePicker('" + Convert.ToString(Session["IDateFormat"]) + "','txt_From" + controlID + "');\" onblur=\"javascript:return assign_hidden_policy(this);\"/>";
        str_tblpolicy += "</div>";
        str_tblpolicy += "<div class='col-md-3'>";
        str_tblpolicy += "<input type='text' ID='txt_To" + controlID + "' Class='form-control' style='margin-bottom:15px' placeholder='To Date' onpaste='return false' ondrop='return false' oncut='return false' EnableViewState='true' runat='server' MaxLength='10' onselect=\"javascript:return DynamicDatePicker('" + Convert.ToString(Session["IDateFormat"]) + "','txt_To" + controlID + "');\" onmouseover=\"javascript:return DynamicDatePicker('" + Convert.ToString(Session["IDateFormat"]) + "','txt_To" + controlID + "');\" onblur=\"javascript:return assign_hidden_policy(this);\"/>";
        str_tblpolicy += "</div>";
        str_tblpolicy += "<div class='col-md-4'>";
        //str_tblpolicy += "<asp:LinkButton ID='' runat=\"server\" OnClick=\"javascript:return removeRowAdd(" + controlID + ",this);\" CssClass=\"btn btn-primary fa fa-trash\" Text=\"" + rm.GetString("btn_Delete", ci) + "\" ></asp:LinkButton>"
        str_tblpolicy += "<input style='margin-bottom: 15px;' Class=\"btn save-btn fa-trash\" id=\"Del_Button" + controlID + "\" type=\"submit\" value=\"" + rm.GetString("btn_Delete", ci) + "\" runat=\"server\" OnClick=\"javascript:return removeRowAdd(" + controlID + ",this);\"/><div runat='server' id='div_" + controlID + "' style='display:none'>" + PolicyID + "</div>";
        str_tblpolicy += "</div>";
        str_tblpolicy += "</div>";
        str_tblpolicy += "</div>";
       
        Response.Write(str_tblpolicy);
        Response.End();
    }
}
