Click here to Skip to main content
15,891,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

SQL
CREATE Procedure dashbord --1
@userid int
AS
Begin

declare @reportmanager int
declare @admintype int
-- normal employee admintype = 0 , managers admintype > 0
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 --or b.employeeid in (select managerid from reportingperson where 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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900