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  : 12-Aug-2007
* Module          : Shift Allocation             Last Modified : 14-Aug-2007
* Programmer      : Arun Vinoth .T
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          :
****************************************************************************************************************************/
public partial class Transactions_AjaxShiftAllocation : Base.BasePage
{
    string EmpCode = "", EmpName = "", Mode = "";
    int Empid = 0, loginEmployeeId = 0;
    ShiftAllocationEvendata obj = new ShiftAllocationEvendata();
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking and reset date format
        base.Page_Load(sender, e);    
        if (!Page.IsPostBack)
        {
            if (Session["EmpAutoID"] != null)
            {
                loginEmployeeId = Int32.Parse(Session["EmpAutoID"].ToString());
            }
            else
            {
                //
            }
            Empid = Convert.ToInt32(Request.QueryString["EmpId"].ToString());
            //EmpName = Request.QueryString["EmpName"].ToString();
            Mode = Request.QueryString["Mode"].ToString();
        }
        if (Mode == "Insert")
        {
            InsertEmpDetails();
        }
        if (Mode == "Delete")
        {
            DeleteEmpDetails();
        }
    }
    public void InsertEmpDetails()
    {
        DataSet ds_Emp = new DataSet();
        try
        {
            ds_Emp = obj.GetEmployee(Empid);
            EmpCode = ds_Emp.Tables[0].Rows[0]["Employee_Code_Id"].ToString();
            EmpName = ds_Emp.Tables[0].Rows[0]["Employee Name"].ToString();
            obj.InsertEmpDetails(Empid, EmpCode, EmpName.Replace("'","''"), loginEmployeeId);
        }
        catch
        {
            //
        }
    }
    public void DeleteEmpDetails()
    {
        try
        {
            obj.DeleteEmpDetails(Empid, loginEmployeeId);
        }
        catch
        {
            //
        }
    }
}
