private bool ValidateLogin()
{
Response.Write("ValidateLogin()<br>");
bool returnValue = false;
if (((CUser)Session["user"]) != null)
{
returnValue = true;
}
return returnValue;
}
// ------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------
private bool fillDdlEmployee()
{
Response.Write("fillDdlEmployee()<br>");
DataTable dt;
//DataTable
CDataRet dataRet = new CDataRet();
if (Session["user"] != null && ((CUser)Session["user"]).Employeeid > -1){
dt = dataRet.getData((CUser)Session["user"],"employees");
if (dt != null)
{
ddlEmployee.DataSource = dt;
ddlEmployee.DataValueField = "id";
ddlEmployee.DataTextField = "Name";
if (!Page.IsPostBack){
ddlEmployee.DataBind();
}
return true;
}
else
{
return false;
}
} else {
return false;
}
}
// ------------------------------------------------------------------------------------------------------------------
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
Response.Write("OnInit()");
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
//this.ddlEmployee.SelectedIndexChanged += new System.EventHandler(this.ddlEmployee_SelectedIndexChanged);
//this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
//this.Load += new System.EventHandler(this.Page_Load);
private void InitializeComponent()
{
this.ddlEmployee.SelectedIndexChanged += new System.EventHandler(this.ddlEmployee_SelectedIndexChanged);
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
this.btnPersonalOverview.ServerClick += new System.EventHandler(this.btnPersonalOverview_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
// ------------------------------------------------------------------------------------------------------------------
private void btnRequestHolliday_ServerClick(object sender, System.EventArgs e)
{
}
// ------------------------------------------------------------------------------------------------------------------
private DropDownList cloneDropDownList(DropDownList ddl)
{
Response.Write("cloneDropDownList()<br>");
DropDownList retDdl = new DropDownList();
IEnumerator i = ddl.Items.GetEnumerator();
while (i.MoveNext())
{
if (i.Current != null)
{
retDdl.Items.Add((ListItem)i.Current);
}
}
return retDdl;
}
// ------------------------------------------------------------------------------------------------------------------
private void requestManMutation(Object sender, CommandEventArgs e)
{
// --------------------------------------------------------------------------
// ----------------- Function for commandevent handling ---------------------
// --------------------------------------------------------------------------
CDataRet dataRet = new CDataRet();
Response.Write("requestManMutation()<br>");
if ((e.CommandName).Equals("delete"))
{
dataRet.deleteRow(Convert.ToInt32(e.CommandArgument));
}
if ((e.CommandName).Equals("purge"))
{
dataRet.purgeRow(Convert.ToInt32(e.CommandArgument));
}
if ((e.CommandName).Equals("approve"))
{
dataRet.approveRow(Convert.ToInt32(e.CommandArgument));
}
Response.Write("<br><br><br>___________________"+e.CommandName + "_" + e.CommandArgument +"<BR>");
// --------------------------------------------------------------------------
// --- If i enable this, Event is not responding to buttons -----------------
// --------------------------------------------------------------------------
/*if (Session["user"] != null){
if (ddlEmployee.SelectedItem != null && ((CUser)Session["user"]).Employeeid != Convert.ToInt32(ddlEmployee.SelectedItem.Value))
ShowHolliday(Convert.ToInt32(ddlEmployee.SelectedItem.Value));
else
ShowHolliday(((CUser)Session["user"]).Employeeid);
}*/
}
// ------------------------------------------------------------------------------------------------------------------
private void btnPersonalOverview_ServerClick(object sender, System.EventArgs e)
{
Response.Write("btnPersonalOverview_ServerClick()<br>");
if (Session["user"] != null)
{
if (ddlEmployee.Items.FindByValue(Convert.ToString(((CUser)Session["user"]).Employeeid)) != null)
{
ddlEmployee.SelectedIndex = ddlEmployee.Items.IndexOf(ddlEmployee.Items.FindByValue(Convert.ToString(((CUser)Session["user"]).Employeeid)));
ShowHolliday(((CUser)Session["user"]).Employeeid);
}
}
}
private void ddlEmployee_SelectedIndexChanged(object sender, System.EventArgs e)
{
/*
if (Session["user"] != null){
if (ddlEmployee.SelectedItem != null && ((CUser)Session["user"]).Employeeid != Convert.ToInt32(ddlEmployee.SelectedItem.Value))
ShowHolliday(Convert.ToInt32(ddlEmployee.SelectedItem.Value));
else
ShowHolliday(((CUser)Session["user"]).Employeeid);
}
*/
}
private void btnLogout_Click(object sender, System.EventArgs e)
{
Response.Write("btnLogout_Click()<br>");
Session.Remove("user");
Page.Server.Transfer("login.aspx");
}
// ------------------------------------------------------------------------------------------------------------------
}
}