using System;
using System.Data;
/****************************************************************************************************************************
* Project Name    : TimeCheck                    Started Date  : 12-Aug-2007
* Module          : Manual Time Entry            Last Modified : 14-Aug-2007
* Programmer      : 
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Transactions_EmployeeName : Base.BasePage
{
    string EmpCode;
    string EmpName;
    string EmpDesignation = "", ReportingTo_Name = "", LeaveApproval_Name = "", DepartmentName = "";
    string LevelId;
    string level;
    Int32 employeeId;
    ManualEntryEventData obj = new ManualEntryEventData();
    int DaysForSuccessive = 0;
    int NewLevelId = 0;
    string isFrom = string.Empty;
    LeaveApplicationEventData objLeaveApplicationEventData = new LeaveApplicationEventData();
    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        if (Convert.ToString(Request.QueryString["EmpId"]) != "")
        {
            EmpCode = Convert.ToString(Request.QueryString["EmpId"]);
            LevelId = Convert.ToString(Request.QueryString["LevelId"]);
            if (Request.QueryString["isFrom"] != null)
            {
                isFrom = Request.QueryString["isFrom"].ToString();
            }
            Rpt_Common rptcommon = new Rpt_Common();
            level = rptcommon.getNodes(Convert.ToInt32(LevelId), Convert.ToString(Session["LevelRights"]));
            GetEmployeeName(EmpCode, level, isFrom);
        }
        else
        {
            Response.Clear();
            Response.End();
        }
    }
    private void GetEmployeeName(string EmpCode, string level, string isFrom)
    {
        DataSet ds_EmpName = new DataSet();
        ds_EmpName = obj.SelectEmpName(Convert.ToInt32(Session["EmpAutoId"]), EmpCode, Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["GradeLevel"]), level, 0, isFrom);
        if (ds_EmpName != null)
        {
            if (ds_EmpName.Tables[0].Rows.Count > 0)
            {
                EmpName = Convert.ToString(ds_EmpName.Tables[0].Rows[0]["Employee Name"]);
                employeeId = Convert.ToInt32(ds_EmpName.Tables[0].Rows[0]["Employee_Id"]);
                EmpDesignation = Convert.ToString(ds_EmpName.Tables[0].Rows[0]["TitleName"]); ;
                ReportingTo_Name = Convert.ToString(ds_EmpName.Tables[0].Rows[0]["ReportingTo_Name"]); ;
                LeaveApproval_Name = Convert.ToString(ds_EmpName.Tables[0].Rows[0]["LeaveApproval_Name"]);
                DepartmentName = Convert.ToString(ds_EmpName.Tables[0].Rows[0]["DepartmentName"]);
                //Added by Manikandan.R on 05-01-2016 01.33 PM
                //Successive year is not working while applying the leave.
                NewLevelId = obj.GettingParentLevelidUsingEmpAutoID(employeeId);
                DaysForSuccessive = objLeaveApplicationEventData.GetSuccessiveDaysCount(NewLevelId);
                Session["DaysForSuccessive"] = DaysForSuccessive;
                //***********************************************//
                Response.Clear();
                Response.Write(EmpName + "," + employeeId + "," + EmpDesignation + "," + ReportingTo_Name + "," + LeaveApproval_Name + "," + DepartmentName);
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.Write("Invalid Employee ID");
                Response.End();
            }
            ds_EmpName.Dispose();
        }
    }
}
