19-03-2020----------Developer/developerGrantLeave.aspx
Developer/developerGrantLeave.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Developer/DeveloperMaster.master" AutoEventWireup="true" CodeFile="developerGrantLeave.aspx.cs" Inherits="Developer_developerGrantLeave" %>
<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="lblmsg" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<%=ReminderPanel%>
</table>
<h6>Grant Leave </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="EmployeeName">
<ItemTemplate >
<%# Eval("employeeName")%>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="ApprovedBy">
<ItemTemplate >
<%# Eval("approvedPerson")%>
</ItemTemplate>
</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)?"Forwaded to hr":"Confirmed from my side"%>' Visible="false"></asp:Label>
<asp:LinkButton ID="BtnStatus" Text="Forward to hr" runat="server" CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" onclientclick="return confirm('Are You sure to forward to HR?')"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Content>
Developer/developerGrantLeave.aspx.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Developer_developerGrantLeave : 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();
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 BindGrid()
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "showgrantleave" };
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), 1, "changestatusbyapprovedby" };
int i = dal.execute("ManageLeave", col4, val4);
if (i == 1)
{
Response.Redirect("~/Developer/developerGrantLeave.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 == "Pending")
{
BtnStatus.Visible = true;
}
else if (lblStatus.Text == "Forwaded to hr")
{
BtnStatus.Visible = false;
lblStatus.Visible = true;
lblStatus.Style.Add("color", "mediumvioletred");
lblStatus.Style.Add("font-weight", "bolder");
}
else
{
BtnStatus.Visible = false;
lblStatus.Visible = true;
lblStatus.Style.Add("color", "Green");
lblStatus.Style.Add("font-weight", "bolder");
}
}
}
catch (Exception ex)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "KeyMsg", "alert('" + ex.Message.ToString() + "');", true);
}
}
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)
{
}
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Developer/DeveloperMaster.master" AutoEventWireup="true" CodeFile="developerGrantLeave.aspx.cs" Inherits="Developer_developerGrantLeave" %>
<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="lblmsg" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<%=ReminderPanel%>
</table>
<h6>Grant Leave </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="EmployeeName">
<ItemTemplate >
<%# Eval("employeeName")%>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="ApprovedBy">
<ItemTemplate >
<%# Eval("approvedPerson")%>
</ItemTemplate>
</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)?"Forwaded to hr":"Confirmed from my side"%>' Visible="false"></asp:Label>
<asp:LinkButton ID="BtnStatus" Text="Forward to hr" runat="server" CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" onclientclick="return confirm('Are You sure to forward to HR?')"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Content>
Developer/developerGrantLeave.aspx.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Developer_developerGrantLeave : 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();
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 BindGrid()
{
string[] col4 = { "@srno", "@Actiontype" };
object[] val4 = { Convert.ToInt32(Session["developer_srno"]), "showgrantleave" };
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), 1, "changestatusbyapprovedby" };
int i = dal.execute("ManageLeave", col4, val4);
if (i == 1)
{
Response.Redirect("~/Developer/developerGrantLeave.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 == "Pending")
{
BtnStatus.Visible = true;
}
else if (lblStatus.Text == "Forwaded to hr")
{
BtnStatus.Visible = false;
lblStatus.Visible = true;
lblStatus.Style.Add("color", "mediumvioletred");
lblStatus.Style.Add("font-weight", "bolder");
}
else
{
BtnStatus.Visible = false;
lblStatus.Visible = true;
lblStatus.Style.Add("color", "Green");
lblStatus.Style.Add("font-weight", "bolder");
}
}
}
catch (Exception ex)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "KeyMsg", "alert('" + ex.Message.ToString() + "');", true);
}
}
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)
{
}
}
}
Comments
Post a Comment