protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Aproving")
{
GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
HiddenField hf = (HiddenField)row.FindControl ("hdcontentid");
Label lblid = (Label)row.FindControl("lblid");
string theValue = hf.Value;
objDUT.getdashboardapprove(Convert.ToInt32( Session["userid"].ToString()),1,Convert.ToInt32(lblid.Text.Trim()));
lblmsg.Text = "Leave request approved successfully";
row.Visible = false;
}
else if (e.CommandName == "Disapprove")
{
GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
HiddenField hf = (HiddenField)row.FindControl ("hdcontentid");
Label lblid = (Label)row.FindControl("lblid");
string theValue = hf.Value;
// row contains current Clicked Gridview Row
string status = row.Cells[1].Text;
objDUT.getdashboardapprove(Convert.ToInt32(Session["userid"].ToString()), 2, Convert.ToInt32(lblid.Text.Trim()));
lblmsg.Text = "Leave request disapproved successfully";
row.Visible = false;
}
and this is the sql server
CREATE Procedure dashbord
@userid int
AS
Begin
declare @reportmanager int
declare @admintype int
set @reportmanager = (select count(managerid) from reportingperson where employeeid=@userid)
set @admintype = (select max(admintype) from employee where content_id=@userid)
from Employee a join leaves b on a.content_id=b.employeeid where a.content_id=@userid
if exists (select 1 where @reportmanager > 0 and @admintype=0)
begin
select b.contentid,x.content_id,x.employeename,x.imagetype,
convert(varchar(10),b.Fromdate,126) as fromdate,convert(varchar(10),b.Todate,126) as Todate,b.leaveapp,b.leavesubject,
b.Reason,(case when (b.status=0) then 'Pending' else 'Approved' end) AS status,convert(varchar(10),b.createddate,126) as Createddate from
leaves b
left outer join employee x on b.employeeid=x.content_id
where (b.employeeid=@userid
) and b.status=0
select admintype from employee
where content_id = @userid
end
else
begin
select b.contentid,x.content_id,x.employeename,x.imagetype,
convert(varchar(10),b.Fromdate,126) as fromdate,convert(varchar(10),b.Todate,126) as Todate,b.leaveapp,b.leavesubject,
b.Reason,(case when (b.status=0) then 'Pending' else 'Approved' end) AS status,convert(varchar(10),b.createddate,126) as Createddate from
leaves b
left outer join employee x on b.employeeid=x.content_id
where b.employeeid in (select employeeid from reportingperson where managerid=@userid) and b.status=0
select admintype from employee
where content_id = @userid
end
End
how should i send the notification to one reporting person and after approving the notification should go to lower reporting person then he can approve the leave
what should i do now and where