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;
/****************************************************************************************************************************
* Project Name    : TimeCheck                    Started Date  : 14-Aug-2007
* Module          : Shift Exchange               Last Modified : 15-Aug-2007
* Programmer      : Janakaraj.P
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Transactions_AjaxShiftExchange : Base.BasePage
{
    DateTime Edate;
    string Date, Year, Month, ShiftName, EmpId, gstrShiftDate, gstrDateFormat;
    int shiftId;
    ShiftExchangeEventData obj = new ShiftExchangeEventData();
    cls_Common objcls_Common = new cls_Common();
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking and reset date format
        base.Page_Load(sender, e);    
        if (Request.QueryString["EDate"] != null && Request.QueryString["EDate"] != "" && Request.QueryString["EmpId"] != null && Request.QueryString["EmpId"]!="")
        {
            gstrDateFormat=Convert.ToString(Session["MDateFormat"]);
            gstrShiftDate = objcls_Common.DateConvertion(gstrDateFormat, Request.QueryString["EDate"].ToString());
            Edate = Convert.ToDateTime(gstrShiftDate);
            EmpId = Convert.ToString(Request.QueryString["EmpId"]);
            GetShiftName();
        }
        else
        {
            Response.Clear();
            Response.Write("Fail");
            Response.End();
        }
    }
    private void GetShiftName()
    {
        Date = Edate.Day.ToString();
        Month = Edate.Month.ToString();
        Year = Edate.Year.ToString();
        shiftId = obj.SelectShiftId(EmpId, Year, Month, Date);
        if (shiftId == 0)
        {
            ShiftName = "NotAllocated";
        }
        else
        {
            ShiftName = obj.SelectShiftName(shiftId);
        }
        Response.Clear();
        Response.Write(ShiftName);
        Response.End();
    }
}
