19-03-2020----------Developer/DeveloperLeaveStatus.aspx
Developer/DeveloperLeaveStatus.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Developer/DeveloperMaster.master" AutoEventWireup="true" CodeFile="DeveloperLeaveStatus.aspx.cs" Inherits="Developer_DeveloperLeaveStatus" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="text-align: center;" id="blink"><%=WorkDoneorNot%></div>
<%--You have not started any work till now. You are sitting ideal since last 1 hours.--%>
<script type="text/javascript">
var blink = document.getElementById('blink');
setInterval(function () {
blink.style.opacity = (blink.style.opacity == 0 ? 1 : 0);
}, 1000);
</script>
<table width="70%" border="1" align="center" cellpadding="3" cellspacing="1" class="tdrow4">
<tr>
<td width="882" align="center" bgcolor="#E6E6E6">
<table width="100%" height="15" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="Tab3" align="left"><a href="attendance.aspx"><font color="#0000FF"><b>Attendance</b></font></a></td>
<td class="Tab3" align="left"><a href="OutsideInside.aspx"><font color="#0000FF"><b>Outside Inside</b></font></a></td>
<td class="Tab3" align="left"><a href="add_reminder.aspx" target="_blank"><font color="#0000FF"><b>Add New Reminder</b></font></a></td>
<td class="Tab3" align="left">
<%if (leaveApplyFormStatus > 0)
{%>
<a href="DeveloperLeave.aspx" target="_blank" class="notification"><font color="#0000FF"><b>Leave Apply Form</b></font>
<span class="badge">
<%=leaveApplyFormStatus%></span>
</a>
<%} %>
<%else
{ %>
<a href="DeveloperLeave.aspx" target="_blank"><font color="#0000FF"><b>Leave Apply Form</b></font></a>
<%} %>
</td>
<td class="Tab3" align="left">
<%if (numberOfSeenStatus > 0)
{%>
<a href="DeveloperLeaveStatus.aspx" target="_blank" class="notification"><font color="#0000FF"><b>Applied Leave Status</b></font><span class="badge">
<%=numberOfSeenStatus%></span></a>
<%} %>
<%else
{ %>
<a href="DeveloperLeaveStatus.aspx" target="_blank"><font color="#0000FF"><b>Applied Leave Status</b></font></a>
<%} %>
</td>
<td class="Tab3" align="left">
<%if (numberOfPendingApprovalLeave > 0)
{%>
<a href="developerGrantLeave.aspx" target="_blank" class="notification"><font color="#0000FF"><b>Leave Grant</b></font><span class="badge">
<%=numberOfPendingApprovalLeave%></span></a>
<%} %>
<%else
{ %>
<a href="developerGrantLeave.aspx" target="_blank" ><font color="#0000FF"><b>Leave Grant</b></font></a>
<%} %>
</td>
<td class="Tab3" align="right"><a href="view_reminder.aspx" target="_blank"><font color="#0000FF"><b>View Done Reminder</b></font></a></td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<%=ReminderPanel%>
</table>
<h6>Applied Leave Status</h6>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" valign="middle" class="Tab2" bgcolor="#CCCCCC" width="100%" border="1" cellpadding="0" cellspacing="0" OnRowCommand="GridView1_RowCommand" onrowdatabound="GridData_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Sr.No." HeaderStyle-Width="59px">
<ItemTemplate > <%#Container.DataItemIndex +1 %>
<asp:Label ID="lblID" runat="server" Text='<%# Eval("id")%>' Visible="false"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DateFrom">
<ItemTemplate > <%# Convert.ToDateTime(Eval("dateFrom")).ToString("dd MMMM yyy")%> </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DateTo">
<ItemTemplate > <%# Convert.ToDateTime(Eval("dateTo")).ToString("dd MMMM yyy")%> </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="lastworkingday">
<ItemTemplate >
<%# Eval("lastworkingday")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="reportingday">
<ItemTemplate >
<%# Eval("reportingday")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="address">
<ItemTemplate >
<%# Eval("address")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="mobilenumber">
<ItemTemplate >
<%# Eval("mobilenumber")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="JobsTODoBeforeLeave">
<ItemTemplate >
<%# Eval("JobsTODoBeforeLeave")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ReasonforLeave">
<ItemTemplate >
<%# Eval("ReasonforLeave")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="approvedBy">
<ItemTemplate >
<%# Eval("approvedPerson")%>
</ItemTemplate>
<%--<asp:LinkButton ID='BtnStatus' Text='Forward to hr' runat='server'"+ " CommandName='Select' CommandArgument="+Container.DataItemIndex+" />--%>
</asp:TemplateField>
<asp:TemplateField HeaderText="approvedStatus">
<ItemTemplate >
<asp:Label ID="lblStatus" runat="server" Text='<%# (Convert.ToInt32(Eval("approvedStatus"))==0)?"Pending":(Convert.ToInt32(Eval("approvedStatus"))==1)?"Waiting For Hr Approval":(Convert.ToInt32(Eval("approvedStatus"))==2 && Convert.ToInt32(Eval("reinitiate"))!=1)?"Partially approved, reinitiation date "+Convert.ToDateTime(Eval("reenitiateDate")).ToString("dd MMMM yyyy"):(Convert.ToInt32(Eval("approvedStatus"))==2 && Convert.ToInt32(Eval("reinitiate"))==1)?"Reinitiate Now":(Convert.ToInt32(Eval("approvedStatus"))==3)?"Final approval pending":"Leave approved"+(Convert.ToString(Eval("totalLeave"))!="0"?" Your total granted leave "+Convert.ToString(Eval("totalLeave")):"")+(Convert.ToString(Eval("totalAbsent"))!="0"?", absent "+Convert.ToString(Eval("totalAbsent")):"")%>'></asp:Label>
<asp:LinkButton ID="BtnStatus" Text="Reinitiate Now" runat="server" CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>"
OnClientClick="return confirm('Are you sure to reinitiate?')" visible="false"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Content>
Developer/DeveloperLeaveStatus.aspx.cs
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Developer_DeveloperLeaveStatus : System.Web.UI.Page
{
MainClass dut = new MainClass();
DataAccessLayer dal = new DataAccessLayer();
public string dv_name, PendingTask, ReminderPanel, WorkDoneorNot = string.Empty;
public int numberOfPendingApprovalLeave = 0;
public int numberOfSeenStatus = 0, leaveApplyFormStatus=0;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["developer_srno"] != null)
{
var value = Request.Cookies["developer_srno"].Value;
if (value == "")
{
Response.Redirect("~/Pr-Admin-Log");
}
Session["developer_srno"] = value;
}
else
{
Response.Redirect("~/Pr-Admin-Log");
}
if (!IsPostBack)
{
BindGrid();
changeSeenStatus();
checkSeenStatus();
checkLeaveGrant();
checkApplyFormStatus();
checkAnyWorkDoneorNot();
}
}
private void checkAnyWorkDoneorNot()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]) };
DataSet ds4 = dal.getDataSet("USPcheckAnyWorkDoneorNot", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
WorkDoneorNot = Convert.ToString(ds4.Tables[0].Rows[0]["msg"]);
}
}
}
catch (Exception ex)
{
}
}
private void checkApplyFormStatus()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "checkinstanceleave" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
leaveApplyFormStatus = ds4.Tables[0].Rows.Count;
}
}
}
catch (Exception ex)
{
}
}
private void checkSeenStatus()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "checkseenstatusbyemployee" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
numberOfSeenStatus = ds4.Tables[0].Rows.Count;
}
}
}
catch (Exception ex)
{
}
}
private void checkLeaveGrant()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "showpendingleavestatus" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
numberOfPendingApprovalLeave = ds4.Tables[0].Rows.Count;
}
}
}
catch (Exception ex)
{
}
}
private void changeSeenStatus()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "changeseenstatusbyemployee" };
int i = dal.execute("ManageLeave", col4, val4);
if (i == 1)
{
}
}
}
catch (Exception ex)
{
}
}
private void BindGrid()
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "showleavestatus" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
GridView1.DataSource = ds4.Tables[0];
GridView1.DataBind();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
//Determine the RowIndex of the Row whose Button was clicked.
int rowIndex = Convert.ToInt32(e.CommandArgument);
//Reference the GridView Row.
GridViewRow row = GridView1.Rows[rowIndex];
//Fetch value of Name.
string id = (row.FindControl("lblID") as Label).Text;
string[] col4 = { "@id", "@approvedStatus", "@Actiontype" };
object[] val4 = { Convert.ToInt32(id), 3, "changestatusforfinalapproval" };
int i = dal.execute("ManageLeave", col4, val4);
if (i == 1)
{
Response.Redirect("~/Developer/DeveloperLeaveStatus.aspx");
}
}
}
protected void GridData_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton BtnStatus = (LinkButton)e.Row.FindControl("BtnStatus");
Label lblStatus = (Label)e.Row.FindControl("lblStatus");
if (lblStatus.Text.Trim() == "Reinitiate Now")
{
lblStatus.Visible = false;
BtnStatus.Visible = true;
}
else if (lblStatus.Text.Trim() == "Pending")
{
lblStatus.Style.Add("color", "red");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim() == "Waiting For Hr Approval")
{
lblStatus.Style.Add("color", "mediumvioletred");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim().Contains("Partially approved"))
{
lblStatus.Style.Add("color", "darkmagenta");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim() == "Final approval pending")
{
lblStatus.Style.Add("color", "mediumvioletred");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim().Contains("Leave approved"))
{
lblStatus.Style.Add("color", "green");
lblStatus.Style.Add("font-weight", "bold");
}
}
}
catch (Exception ex)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "KeyMsg", "alert('" + ex.Message.ToString() + "');", true);
}
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Developer/DeveloperMaster.master" AutoEventWireup="true" CodeFile="DeveloperLeaveStatus.aspx.cs" Inherits="Developer_DeveloperLeaveStatus" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="text-align: center;" id="blink"><%=WorkDoneorNot%></div>
<%--You have not started any work till now. You are sitting ideal since last 1 hours.--%>
<script type="text/javascript">
var blink = document.getElementById('blink');
setInterval(function () {
blink.style.opacity = (blink.style.opacity == 0 ? 1 : 0);
}, 1000);
</script>
<table width="70%" border="1" align="center" cellpadding="3" cellspacing="1" class="tdrow4">
<tr>
<td width="882" align="center" bgcolor="#E6E6E6">
<table width="100%" height="15" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="Tab3" align="left"><a href="attendance.aspx"><font color="#0000FF"><b>Attendance</b></font></a></td>
<td class="Tab3" align="left"><a href="OutsideInside.aspx"><font color="#0000FF"><b>Outside Inside</b></font></a></td>
<td class="Tab3" align="left"><a href="add_reminder.aspx" target="_blank"><font color="#0000FF"><b>Add New Reminder</b></font></a></td>
<td class="Tab3" align="left">
<%if (leaveApplyFormStatus > 0)
{%>
<a href="DeveloperLeave.aspx" target="_blank" class="notification"><font color="#0000FF"><b>Leave Apply Form</b></font>
<span class="badge">
<%=leaveApplyFormStatus%></span>
</a>
<%} %>
<%else
{ %>
<a href="DeveloperLeave.aspx" target="_blank"><font color="#0000FF"><b>Leave Apply Form</b></font></a>
<%} %>
</td>
<td class="Tab3" align="left">
<%if (numberOfSeenStatus > 0)
{%>
<a href="DeveloperLeaveStatus.aspx" target="_blank" class="notification"><font color="#0000FF"><b>Applied Leave Status</b></font><span class="badge">
<%=numberOfSeenStatus%></span></a>
<%} %>
<%else
{ %>
<a href="DeveloperLeaveStatus.aspx" target="_blank"><font color="#0000FF"><b>Applied Leave Status</b></font></a>
<%} %>
</td>
<td class="Tab3" align="left">
<%if (numberOfPendingApprovalLeave > 0)
{%>
<a href="developerGrantLeave.aspx" target="_blank" class="notification"><font color="#0000FF"><b>Leave Grant</b></font><span class="badge">
<%=numberOfPendingApprovalLeave%></span></a>
<%} %>
<%else
{ %>
<a href="developerGrantLeave.aspx" target="_blank" ><font color="#0000FF"><b>Leave Grant</b></font></a>
<%} %>
</td>
<td class="Tab3" align="right"><a href="view_reminder.aspx" target="_blank"><font color="#0000FF"><b>View Done Reminder</b></font></a></td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<%=ReminderPanel%>
</table>
<h6>Applied Leave Status</h6>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" valign="middle" class="Tab2" bgcolor="#CCCCCC" width="100%" border="1" cellpadding="0" cellspacing="0" OnRowCommand="GridView1_RowCommand" onrowdatabound="GridData_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Sr.No." HeaderStyle-Width="59px">
<ItemTemplate > <%#Container.DataItemIndex +1 %>
<asp:Label ID="lblID" runat="server" Text='<%# Eval("id")%>' Visible="false"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DateFrom">
<ItemTemplate > <%# Convert.ToDateTime(Eval("dateFrom")).ToString("dd MMMM yyy")%> </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DateTo">
<ItemTemplate > <%# Convert.ToDateTime(Eval("dateTo")).ToString("dd MMMM yyy")%> </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="lastworkingday">
<ItemTemplate >
<%# Eval("lastworkingday")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="reportingday">
<ItemTemplate >
<%# Eval("reportingday")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="address">
<ItemTemplate >
<%# Eval("address")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="mobilenumber">
<ItemTemplate >
<%# Eval("mobilenumber")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="JobsTODoBeforeLeave">
<ItemTemplate >
<%# Eval("JobsTODoBeforeLeave")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ReasonforLeave">
<ItemTemplate >
<%# Eval("ReasonforLeave")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="approvedBy">
<ItemTemplate >
<%# Eval("approvedPerson")%>
</ItemTemplate>
<%--<asp:LinkButton ID='BtnStatus' Text='Forward to hr' runat='server'"+ " CommandName='Select' CommandArgument="+Container.DataItemIndex+" />--%>
</asp:TemplateField>
<asp:TemplateField HeaderText="approvedStatus">
<ItemTemplate >
<asp:Label ID="lblStatus" runat="server" Text='<%# (Convert.ToInt32(Eval("approvedStatus"))==0)?"Pending":(Convert.ToInt32(Eval("approvedStatus"))==1)?"Waiting For Hr Approval":(Convert.ToInt32(Eval("approvedStatus"))==2 && Convert.ToInt32(Eval("reinitiate"))!=1)?"Partially approved, reinitiation date "+Convert.ToDateTime(Eval("reenitiateDate")).ToString("dd MMMM yyyy"):(Convert.ToInt32(Eval("approvedStatus"))==2 && Convert.ToInt32(Eval("reinitiate"))==1)?"Reinitiate Now":(Convert.ToInt32(Eval("approvedStatus"))==3)?"Final approval pending":"Leave approved"+(Convert.ToString(Eval("totalLeave"))!="0"?" Your total granted leave "+Convert.ToString(Eval("totalLeave")):"")+(Convert.ToString(Eval("totalAbsent"))!="0"?", absent "+Convert.ToString(Eval("totalAbsent")):"")%>'></asp:Label>
<asp:LinkButton ID="BtnStatus" Text="Reinitiate Now" runat="server" CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>"
OnClientClick="return confirm('Are you sure to reinitiate?')" visible="false"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Content>
Developer/DeveloperLeaveStatus.aspx.cs
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Developer_DeveloperLeaveStatus : System.Web.UI.Page
{
MainClass dut = new MainClass();
DataAccessLayer dal = new DataAccessLayer();
public string dv_name, PendingTask, ReminderPanel, WorkDoneorNot = string.Empty;
public int numberOfPendingApprovalLeave = 0;
public int numberOfSeenStatus = 0, leaveApplyFormStatus=0;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["developer_srno"] != null)
{
var value = Request.Cookies["developer_srno"].Value;
if (value == "")
{
Response.Redirect("~/Pr-Admin-Log");
}
Session["developer_srno"] = value;
}
else
{
Response.Redirect("~/Pr-Admin-Log");
}
if (!IsPostBack)
{
BindGrid();
changeSeenStatus();
checkSeenStatus();
checkLeaveGrant();
checkApplyFormStatus();
checkAnyWorkDoneorNot();
}
}
private void checkAnyWorkDoneorNot()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]) };
DataSet ds4 = dal.getDataSet("USPcheckAnyWorkDoneorNot", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
WorkDoneorNot = Convert.ToString(ds4.Tables[0].Rows[0]["msg"]);
}
}
}
catch (Exception ex)
{
}
}
private void checkApplyFormStatus()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "checkinstanceleave" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
leaveApplyFormStatus = ds4.Tables[0].Rows.Count;
}
}
}
catch (Exception ex)
{
}
}
private void checkSeenStatus()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "checkseenstatusbyemployee" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
numberOfSeenStatus = ds4.Tables[0].Rows.Count;
}
}
}
catch (Exception ex)
{
}
}
private void checkLeaveGrant()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "showpendingleavestatus" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
numberOfPendingApprovalLeave = ds4.Tables[0].Rows.Count;
}
}
}
catch (Exception ex)
{
}
}
private void changeSeenStatus()
{
try
{
if (Session["developer_srno"] != null)
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "changeseenstatusbyemployee" };
int i = dal.execute("ManageLeave", col4, val4);
if (i == 1)
{
}
}
}
catch (Exception ex)
{
}
}
private void BindGrid()
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "showleavestatus" };
DataSet ds4 = dal.getDataSet("ManageLeave", col4, val4);
if (ds4.Tables[0].Rows.Count > 0)
{
GridView1.DataSource = ds4.Tables[0];
GridView1.DataBind();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
//Determine the RowIndex of the Row whose Button was clicked.
int rowIndex = Convert.ToInt32(e.CommandArgument);
//Reference the GridView Row.
GridViewRow row = GridView1.Rows[rowIndex];
//Fetch value of Name.
string id = (row.FindControl("lblID") as Label).Text;
string[] col4 = { "@id", "@approvedStatus", "@Actiontype" };
object[] val4 = { Convert.ToInt32(id), 3, "changestatusforfinalapproval" };
int i = dal.execute("ManageLeave", col4, val4);
if (i == 1)
{
Response.Redirect("~/Developer/DeveloperLeaveStatus.aspx");
}
}
}
protected void GridData_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton BtnStatus = (LinkButton)e.Row.FindControl("BtnStatus");
Label lblStatus = (Label)e.Row.FindControl("lblStatus");
if (lblStatus.Text.Trim() == "Reinitiate Now")
{
lblStatus.Visible = false;
BtnStatus.Visible = true;
}
else if (lblStatus.Text.Trim() == "Pending")
{
lblStatus.Style.Add("color", "red");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim() == "Waiting For Hr Approval")
{
lblStatus.Style.Add("color", "mediumvioletred");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim().Contains("Partially approved"))
{
lblStatus.Style.Add("color", "darkmagenta");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim() == "Final approval pending")
{
lblStatus.Style.Add("color", "mediumvioletred");
lblStatus.Style.Add("font-weight", "bold");
}
else if (lblStatus.Text.Trim().Contains("Leave approved"))
{
lblStatus.Style.Add("color", "green");
lblStatus.Style.Add("font-weight", "bold");
}
}
}
catch (Exception ex)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "KeyMsg", "alert('" + ex.Message.ToString() + "');", true);
}
}
}
Comments
Post a Comment