using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                        Created On  : 12-Aug-2007
* Module          : Leave Policy                                     Modified On : 31-July-2007
* Created By      : Arun Vinoth.T
* Modified By     : 
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Masters_LeavePolicy_RemoteView : Base.BasePage
{
    EmployeeEventData objEmployee = new EmployeeEventData();
    CultureInfo ci;
    ResourceManager rm;
    string source_Language;
    int EmpID;
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking and reset date format
        base.Page_Load(sender, e);
        //Session.LCID = 1033;
        if (Request.QueryString["EmpID"] != null && Request.QueryString["EmpID"] != "")
        {
            EmpID = Convert.ToInt32(Request.QueryString["EmpID"].ToString());
            //get the culture info to set the language
            source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
            rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
            ci = Thread.CurrentThread.CurrentCulture;
            GenerateControls();
        }
    }
    private void GenerateControls()
    {
        Response.Clear();
        DataSet ds_LP = new DataSet();
        ds_LP = objEmployee.select_EmpLeavepolicyDetails(EmpID);
        string str_tblpolicy = "";
        str_tblpolicy += "<div id='tbl_LeavePolicy'>";
        foreach (DataRow dr in ds_LP.Tables[0].Rows)
        {
            string From = (Convert.ToDateTime(dr["FromDate"].ToString())).ToString(Session["MDateFormat"].ToString());
            string To = (Convert.ToDateTime(dr["ToDate"].ToString())).ToString(Session["MDateFormat"].ToString());
            str_tblpolicy += "<div class='row form-group'><div class='col-md-2'>" + Convert.ToString(dr["PolicyName"]) + "</div>";
            str_tblpolicy += "<div class='col-md-3'><label class='form-control'>" + From + "</label></div>";
            str_tblpolicy += "<div class='col-md-3'><label class='form-control'>" + To + "</label></div></div>";
        }
        str_tblpolicy += "</div>";
        ds_LP.Dispose();
        DataSet ds_LPL = new DataSet();
        ds_LPL = objEmployee.select_EmpLeavepolicyLeaveDetails(EmpID);
        str_tblpolicy += "<div id='div_LeavePolicydetails'><table id='tbl_LeavePolicydetails'class='table das-table1 TableWidth1'>";
        int policyID = 0;
        int introw;
        introw = ds_LPL.Tables[0].Rows.Count;
        foreach (DataRow dr1 in ds_LPL.Tables[0].Rows)
        {
            if (policyID == 0)
                str_tblpolicy += "<tr><th class='empheader pull-left-button' colspan=" + introw + " style='padding:5px 10px 0px 10px'><label>" + rm.GetString("Caption_Policy", ci) + "</label> : <b>" + Convert.ToString(dr1["PolicyName"]) + "</b></th></tr><tr>";
            if (policyID != 0 && policyID != Convert.ToInt32(dr1["Emp_LeavePolicyId"]))
                str_tblpolicy += "</tr></table><br/><table id='tbl_LeavePolicydetails" + policyID + "' class='table das-table1 TableWidth1'><tr><th class='empheader pull-left-button' colspan=" + introw + " style='padding:5px 10px 0px 10px'><label>" + rm.GetString("Caption_Policy", ci) + "</label> : <b>" + Convert.ToString(dr1["PolicyName"]) + "</b></th></tr><tr>";
            if (policyID == 0 || policyID != Convert.ToInt32(dr1["Emp_LeavePolicyId"]))
                policyID = Convert.ToInt32(dr1["Emp_LeavePolicyId"]);
            str_tblpolicy += "<td><b>" + Convert.ToString(dr1["LeaveType"]) + "</b><br>";
            str_tblpolicy += "<br>" + Convert.ToString(dr1["No_Of_Days"]) + "</td>";
        }
        str_tblpolicy += "</tr></table></div><br>";
        Response.Write(str_tblpolicy);
        Response.End();
    }
}
