using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Transactions_AjaxLeaveCompOff : Base.BasePage
{
    LeaveApplicationEventData objLeaveApplicationEventData = new LeaveApplicationEventData();
    cls_Common objClassCommon = new cls_Common();
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking and reset date format
        base.Page_Load(sender, e);  
        if (!IsPostBack)
        {
            Session["sessionLeaveTypes"] = null;
            string leaveSource = Request.QueryString["leaveSource"];
            int EmployeeId = Convert.ToInt32(Request.QueryString["EmpId"]);
            int YearSettingID = Convert.ToInt32(Request.QueryString["ApplicationYearsetting"]);
            string gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            string strToDate = objClassCommon.DateConvertion(gstrDateFormat, Convert.ToString(Request.QueryString["ToDate"]));
            if (strToDate != string.Empty)
            strToDate = DateTime.Parse(strToDate).ToShortDateString();
            DataSet dsCompOffDays=new DataSet();
            if(leaveSource!="" && EmployeeId!=0)
            {
                dsCompOffDays = objLeaveApplicationEventData.GetCompOffDays(EmployeeId, YearSettingID, strToDate); 
                dsCompOffDays.Tables[0].TableName = "Details";
                if (dsCompOffDays.Tables["Details"].Rows.Count > 0)
                {
                    Response.Clear();
                    Response.ContentType = "text/xml";
                    Response.Write(dsCompOffDays.GetXml());
                    dsCompOffDays.Dispose();
                }
                else
                {
                    Response.Clear();
                    Response.ContentType = "text/xml";
                    Response.Write("Fail");
                }
            }
            Response.End();
        }
    }
}
