protected void lnkLeaveReq_Click(object sender, EventArgs e)
        {
            try
            {
                EmployeeBL obj = new EmployeeBL();

                if (ddlReportType.SelectedValue.ToString() == "0")
                {
                    DateTime startDate = Convert.ToDateTime(Session["TodayDate"]);
                    DateTime endDate = startDate.AddDays(7);
                    DataTable ds = obj.GetLeaveRequestDetByUserID(Convert.ToInt32(Session["UserID"]), startDate, endDate);
                    grdSingleLeaveReq.DataSource = ds;
                    grdSingleLeaveReq.DataBind();
                }
                else
                {
                    DateTime startDate = Convert.ToDateTime(ViewState["MonthSatrt"]);
                    DateTime endDate = startDate.AddMonths(1).AddSeconds(-1);
                    DataTable ds = obj.GetLeaveRequestDetByUserID(Convert.ToInt32(Session["UserID"]), startDate, endDate);
                    grdSingleLeaveReq.DataSource = ds;
                    grdSingleLeaveReq.DataBind();
                }

            }
            catch (Exception ex)
            {
            }
        }
        protected void btnLeaveReqSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Business obj = new Business();
                int userid = Convert.ToInt32(Session["UserID"]);
                DateTime FromDate = Convert.ToDateTime(txtLeaveFrom.Text);
                DateTime ToDate = Convert.ToDateTime(txtLeaveTo.Text);
                string Reason = txtReason.Text == "" ? "" : GeneralFunction.ToProperNotes(txtReason.Text);

                string timezone = "";
                if (Convert.ToInt32(Session["TimeZoneID"]) == 2)
                {
                    timezone = "Eastern Standard Time";
                }
                else
                {
                    timezone = "India Standard Time";

                }
                DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone));
                DataSet ds = obj.SaveLeaveRequestDetails(userid, "", FromDate, ToDate, ISTTime, Reason, "");
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["LeaveID"].ToString() == "Applied")
                        {
                            lblLeaveError.Text = "You have already applied leave for these days";
                            lblLeaveError.Visible = true;
                            txtReason.Text = "";
                            txtLeaveFrom.Text = "";
                            txtLeaveTo.Text = "";
                        }
                        else
                        {
                            System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Leave request updated successfully');", true);
                            mdlNewLeaveRequest.Hide();

                            DateTime startDate = Convert.ToDateTime(Session["TodayDate"]);
                            DateTime endDate = startDate.AddDays(7);

                            EmployeeBL objLeave = new EmployeeBL();
                            DataTable datas = objLeave.GetLeaveRequestDetByUserID(Convert.ToInt32(Session["UserID"]), startDate, endDate);
                            grdSingleLeaveReq.DataSource = datas;
                            grdSingleLeaveReq.DataBind();
                            objLeave = null;
                        }
                    }
                }

            }
            catch (Exception ex)
            {
            }
        }