using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;
using System.Threading;
using System.Reflection;
using System.Resources;

public partial class Reports_TA_UI_Report_LeaveAnalysis : Base.BasePage
{
    Cls_CheckUser objCheckUser = new Cls_CheckUser();
    HeaderInformation hdrTable = new HeaderInformation();
    GetReports rptEmp = new GetReports();
    Rpt_Common rptcommon = new Rpt_Common();
    LeaveSettingsEventData_Angler objLeaveEventData = new LeaveSettingsEventData_Angler();
    cls_Common objCommon = new cls_Common();
    EmployeeEventData objEmployee = new EmployeeEventData();
    
    DataSet ds_Checkuser = new DataSet();
    DataSet ds_LeaveType = new DataSet();
    ResourceManager rm;
    CultureInfo ci;
    string strFromdate, gstrDateFormat, strTodate;
    int intIndividualUser = 0;

    protected override void Page_Load(object sender, EventArgs e)
    {
        // Checking session
        base.Page_Load(sender, e);

        // Get the culture info to set the language       

        string source_Language;
        source_Language = Session["Session_ActiveLanguage"].ToString();
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        site.SiteMapProvider = Convert.ToString(Session["SiteMapProvider"]);
        LoadStrings(ci);

        // Set UserRights
        UserRights();

        if (!IsPostBack)
        {
            objCommon.menu("LeaveReports", "82");
            Session["Remarks"] = "";
            // Bindings the employee category and type.
            BindingEmployeeCategoryandType();

            Hidden1.Value = Session["IDateFormat"].ToString();

            txtFromDate.Text = (Convert.ToDateTime(System.DateTime.Now.ToShortDateString())).ToString(Session["MDateFormat"].ToString());
            txtToDate.Text = (Convert.ToDateTime(System.DateTime.Now.ToShortDateString())).ToString(Session["MDateFormat"].ToString());

            AddMonthNames();
           AddEndYearsList();

           string strdate = ddlMonth.SelectedItem.Value + "/1/" + ddlYear.SelectedItem.Value;
           Session["Date"] = strdate;
           grdRemarks.DataBind();
           Session["Remarks"] = "";
           foreach (GridViewRow i in grdRemarks.Rows)
           {

               Label lblRemarks = (Label)i.FindControl("lblNotes");
               if (lblRemarks.Text != "")
               {
                   Session["Remarks"] = Session["Remarks"] + lblRemarks.Text;
               }
           }

           chkPlannedLeave.Checked = true;
           chkUnPlannedLeaveWI.Checked = true;
           chkUnPlannedLeaveWOI.Checked = true;
        }

        // Check whether the employee is Individual User

        intIndividualUser = objCheckUser.CheckIndividualUser(Session["UserGroupName"].ToString());

        if (intIndividualUser >= 1)
        {
            PlaceHolderLeaveApplication.Controls.Clear();
            divEmployeeDetails.Visible = false;
        }

        // Convert date time to MM/dd/YYYY format

        gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
        strFromdate = txtFromDate.Text;
        strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);
        strTodate = txtToDate.Text;
        strTodate = objCommon.DateConvertion(gstrDateFormat, strTodate);
    }

    /// <summary>
    /// Bindings the employee category and type.
    /// </summary>
    private void BindingEmployeeCategoryandType()
    {
        // Binding Employee Category
        DataSet dsCategory = new DataSet();
        dsCategory = objEmployee.SelectCategoryDetailsEmployee(string.Empty);

        if (dsCategory != null)
        {
            if (dsCategory.Tables[0].Rows.Count > 0)
            {
                ddlEmpCatagory.DataSource = dsCategory;
                ddlEmpCatagory.DataTextField = "CategoryName";
                ddlEmpCatagory.DataValueField = "CategoryId";
                ddlEmpCatagory.DataBind();
            }
            dsCategory.Dispose();
        }

        // Binding Employee Type

        DataSet dsType = new DataSet();
        dsType = objEmployee.SelectTypeDetailsEmployee(string.Empty);

        if (dsType != null)
        {
            if (dsType.Tables[0].Rows.Count > 0)
            {
                ddlEmpType.DataSource = dsType;
                ddlEmpType.DataTextField = "TypeName";
                ddlEmpType.DataValueField = "TypeId";
                ddlEmpType.DataBind();
            }
            dsType.Dispose();
        }
    }
  
    /// <summary>
    /// Validate the FromDate
    /// </summary>
    /// <param name="s"></param>
    /// <param name="e"></param>
    public void ValidateFromDate(object s, ServerValidateEventArgs e)
    {
        try
        {
            strFromdate = txtFromDate.Text;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);

            DateTime dtCurrentDate = Convert.ToDateTime(DateTime.Today.Date);
            DateTime dtFromDate = DateTime.Parse(strFromdate);
            TimeSpan diff = dtFromDate.Subtract(dtCurrentDate);

            int day = diff.Days;
            if (day <= 0)
                e.IsValid = true;
            else
                e.IsValid = false;
        }
        catch
        {
            //
        }
    }

    /// <summary>
    /// Validate the ToDate
    /// </summary>
    /// <param name="s"></param>
    /// <param name="e"></param>
    public void ValidateToDate(object s, ServerValidateEventArgs e)
    {
        try
        {
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strTodate = txtToDate.Text;
            strTodate = objCommon.DateConvertion(gstrDateFormat, strTodate);
            
            DateTime dtCurrentDate = Convert.ToDateTime(DateTime.Today.Date);
            DateTime dtFromDate = DateTime.Parse(strTodate);
            TimeSpan diff = dtFromDate.Subtract(dtCurrentDate);
            
            int day = diff.Days;
            if (day <= 0)
                e.IsValid = true;
            else
                e.IsValid = false;
        }
        catch
        {
            //
        }
    }

    /// <summary>
    /// Compare ToDate with FromDate
    /// </summary>
    /// <param name="s"></param>
    /// <param name="e"></param>
    public void CompareDate(object s, ServerValidateEventArgs e)
    {
        try
        {
            strFromdate = txtFromDate.Text;
            strTodate = txtToDate.Text;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strTodate = objCommon.DateConvertion(gstrDateFormat, strTodate);
            strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);

            DateTime dtToDate = DateTime.Parse(strTodate);
            DateTime dtFromDate = DateTime.Parse(strFromdate);
            TimeSpan diff = dtToDate.Subtract(dtFromDate);

            int day = diff.Days;
            if (day >= 0)
                e.IsValid = true;
            else
                e.IsValid = false;
        }
        catch
        {
            //
        }
    }

    /// <summary>
    /// Loads the Leave Analysis Report based on the Selection Criteria when clicking the View Button
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// 
    protected void btn_View_Click(object sender, EventArgs e)
    {
        txtEntryDate.Text = string.Empty;
        try
        {
            if (Page.IsValid == true)
            {
                string strScript = string.Empty; string strModule = string.Empty; string strStatus = string.Empty;
                strScript = "";

                strScript = strScript + "<script language='javascript'>";
                bool blnParentExists = true;

                strModule = "LeaveSanction";
                if (Session["parentLevelId"] == null)
                {
                    blnParentExists = false;

                }
                else if (Convert.ToInt32(Session["parentLevelId"]) == 0)
                {
                    blnParentExists = false;
                }
                if (blnParentExists == false)
                {
                    strStatus = "Select a company";
                    strScript = strScript + "alert('" + strStatus + "');";
                    strScript = strScript + "</script>";
                    Page.RegisterStartupScript("AlertManualApproval", strScript);
                    return;

                }

                // Create the datatable ,that holds the header information
                DataTable dtHdr = new DataTable();

                dtHdr = hdrTable.CreateHeader();
                dtHdr.TableName = "Header";

                // Add the Header information
                DataRow drHdr = dtHdr.NewRow();
                drHdr["Link"] = 1;
                drHdr["Hdr1"] = string.Empty;
                drHdr["Hdr2"] = string.Empty;
                drHdr["Address1"] = txtRemarks.Text.Trim();
                drHdr["Address2"] = string.Empty;
                drHdr["ReportName"] = "Leave Analysis Report";
                Session["Remarks"] = txtRemarks.Text.Trim();
                if (txtFromDate.Text != string.Empty)
                {
                    DateTime tmpFrom = DateTime.Parse(strFromdate);
                    drHdr["FromDate"] = tmpFrom.ToString("dd-MMM-yyyy");
                }
                else
                    drHdr["FromDate"] = string.Empty;

                if (txtToDate.Text != string.Empty)
                {
                    DateTime tmpTo = DateTime.Parse(strTodate);
                    drHdr["ToDate"] = tmpTo.ToString("dd-MMM-yyyy");
                }
                else
                    drHdr["ToDate"] = string.Empty;

                dtHdr.Rows.Add(drHdr);

                string dtFrom = string.Empty, dtTo = string.Empty;

                if (txtFromDate.Text != string.Empty)
                    dtFrom = strFromdate;

                if (txtToDate.Text != string.Empty)
                    dtTo = strTodate;

                string strEmpName = string.Empty, strEmpId = string.Empty;
                string strEmployeeName = string.Empty;
                string strLevel = string.Empty;

                if (intIndividualUser >= 1)
                {
                    strEmpName = string.Empty;
                    strLevel = string.Empty;
                    strEmpId = Convert.ToString(Session["EmployeeCodeId"]);
                }
                else
                {
                    strEmpName = txtEmployeeName.Text.ToString();
                    strEmpId = txtEmployeeId.Text.ToString().Trim();
                    strEmployeeName = this.txtEmployeeName.Text.Replace("'", "''");
                    strLevel = rptcommon.getNodes(Convert.ToInt16(Session["parentLevelId"]), Convert.ToString(Session["LevelRights"]));
                }

                string strLeavePlanned = string.Empty;
                string strLeaveWI = string.Empty;
                string strLeaveWOI = string.Empty;
                if (chkPlannedLeave.Checked == true)
                {
                    strLeavePlanned = "Planned";
                }

                if (chkUnPlannedLeaveWI.Checked == true)
                {
                    strLeaveWI = "WI";
                }
                if (chkUnPlannedLeaveWOI.Checked == true)
                {
                    strLeaveWOI = "WOI";
                }

                string strEmpAutoId = string.Empty;
                if (Session["ReportsBasedOn"] != null)
                {
                    if (Session["ReportsBasedOn"].ToString() == "False")
                    {
                        strEmpAutoId = "0";
                    }
                    else
                    {
                        strEmpAutoId = Session["EmpAutoID"].ToString();
                    }
                }
                //Get the Report source from the Server and load this into the report table
                //DataSet dsLeaveAnalysis = new DataSet();
                //dsLeaveAnalysis = rptEmp.SelectLeaveAnalysis(dtFrom, dtTo, strEmpId, strEmployeeName, strLevel, Session["UserGroupName"].ToString(), Convert.ToString(Session["GradeLevel"]), strLeavePlanned, strLeaveWI, strLeaveWOI, Convert.ToInt64(strEmpAutoId));

                //DataTable dtNew = new DataTable();
                //dtNew = dtHeaderLabel.Copy();
                //dtNew.WriteXmlSchema(@"E:\DtHeaderLabels.xml");

                //Session["HeaderLabels"] = dtHeaderLabel;

                //// Report Header
                //int orgID = Convert.ToInt16(Session["parentLevelId"]);
                //Session["parentLevelId"] = null;

                //if (orgID == 0)
                //{
                //    orgID = 1;
                //}

                //int lid = 0;
                //org_levelsEventData getOrg = new org_levelsEventData();
                //DataSet ds_getOrg = new DataSet();

                //getOrg.GetOrgParentLevels_FromID(orgID);
                //ds_getOrg = getOrg.GetOrgParentLevels();

                //if (ds_getOrg.Tables[0].Rows.Count > 0)
                //{
                //    lid = Convert.ToInt16(ds_getOrg.Tables[0].Rows[0]["levelID"]);
                //}

                //DataSet dsHeader = new DataSet();
                //dsHeader = rptEmp.getHeader(lid);

                //if (dsHeader.Tables[0].Rows.Count > 0)
                //{
                //    DataTable dtRptHeader = new DataTable();
                //    dtRptHeader = dsHeader.Tables[0].Copy();
                //    //dtRptHeader.WriteXmlSchema(@"E:\reportHeader.xml");
                //    Session["reportHeader"] = dtRptHeader;
                //}

                //// End of Report Header
                //Session["parentLevelId"] = null;

                //DataTable dtLeaveAnalysis = new DataTable();

                //// Check the Empty table
                //if (dsLeaveAnalysis.Tables["Table"] == null || dsLeaveAnalysis.Tables["Table"].Rows.Count == 0)
                //{
                //    string strMsg;
                //    strMsg = "<script language='javascript'>";
                //    strMsg = strMsg + "alert('There is no record ');";
                //    strMsg = strMsg + "</script>";

                //    Page.RegisterStartupScript("Display Message", strMsg);

                //    return;
                //}

                //dtLeaveAnalysis = dsLeaveAnalysis.Tables["Table"].Copy();

                //// Add the link column
                //DataColumn dcLink = new DataColumn("Link", Type.GetType("System.Int32"));

                //dtLeaveAnalysis.Columns.Add(dcLink);

                //for (int i = 0; i < dtLeaveAnalysis.Rows.Count; i++)
                //{
                //    dtLeaveAnalysis.Rows[i]["Link"] = 1;
                //}

                //WRITE XML SCHEMA TO DISK - THIS IS ONLY REQUIRED DURING DEVELOPMENT TO BUILD THE REPORT
                //dtLeaveAnalysis.WriteXmlSchema(@"E:\LeaveAnalysis.xml");
                //dtHdr.WriteXmlSchema(@"E:\LeaveAnalysisHdr.xml");
                //return;

                // Set the session variable that holds the report table and report header table
              //  Session["Hdr"] = dtHdr;
              //  Session["Source"] = dtLeaveAnalysis;                
              
                //Session["Path"] = Server.MapPath(rm.GetString("detailedAttendanceReport", ci));
                Session["Path"] = Server.MapPath("LeaveAnalysis.rpt");

//Get remarks
            //    Session["Date"] = txtFromDate.Text;
                Session["Date"] = dtFrom;
                grdRemarks.DataBind();
                Session["Remarks"] = "";
                string ChkBoxIDs = "";
                foreach (GridViewRow i in grdRemarks.Rows)
                {

                    Label lblRemarks = (Label)i.FindControl("lblNotes");
                    if (lblRemarks.Text != "")
                    {
                        Session["Remarks"] = Session["Remarks"] +  lblRemarks.Text;
                    }
                }

//end of remarks

                // Redirect the page to the report viewer
                //Redirect the page to the report viewer
                 strScript = "";
                //string strUrl = "TA_UI_Report_ReportViewer.aspx";
                string strReportName ="LeaveAnalysis";
                strScript = strScript + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
                strScript = strScript + "<meta http-equiv='X-UA-Compatible' content='IE=document.documentMode;' />";
                strScript = strScript + "<script language='javascript'>";
                //strScript = strScript + "window.open('TA_UI_Report_ReportViewer.aspx?ReportName=" + strReportName + "&dtFrom=" + Cryptographys.Cryptography.Encrypt(dtFrom, "AnglerReports") + "&dtTo=" + Cryptographys.Cryptography.Encrypt(dtTo, "AnglerReports") + "&empid=" + Cryptographys.Cryptography.Encrypt(strEmpId, "AnglerReports") + "&EmpName=" + Cryptographys.Cryptography.Encrypt(strEmployeeName, "AnglerReports") + "&Level=" + Cryptographys.Cryptography.Encrypt(strLevel, "AnglerReports") + "&ParentLevelId=" + Cryptographys.Cryptography.Encrypt(Convert.ToInt16(Session["parentLevelId"]).ToString(), "AnglerReports") + "&UserGroupName=" + Cryptographys.Cryptography.Encrypt(Session["UserGroupName"].ToString(), "AnglerReports") + "&GradeLevel=" + Cryptographys.Cryptography.Encrypt(Convert.ToString(Session["GradeLevel"]), "AnglerReports") + "&strLeavePlanned=" + Cryptographys.Cryptography.Encrypt(strLeavePlanned, "AnglerReports") + "&strLeaveWI=" + Cryptographys.Cryptography.Encrypt(strLeaveWI, "AnglerReports") + "&strLeaveWOI=" + Cryptographys.Cryptography.Encrypt(strLeaveWOI, "AnglerReports") + "','','left=10px, top=60px, width=1000px, height=600px,scrollbars=yes, status=no, resizable=yes');";
                strScript = strScript + "window.open('TA_UI_Report_ReportViewer.aspx?ReportName=" + strReportName + "&dtFrom=" + dtFrom + "&dtTo=" + dtTo + "&empid=" + strEmpId + "&EmpName=" + strEmployeeName + "&Level=" +strLevel+ "&ParentLevelId=" + Convert.ToInt16(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Session["UserGroupName"].ToString()+ "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&strLeavePlanned=" + strLeavePlanned + "&strLeaveWI=" + strLeaveWI + "&strLeaveWOI=" + strLeaveWOI + "','','left=10px, top=60px, width=1000px, height=600px,scrollbars=yes, status=no, resizable=yes');";
                strScript = strScript + "</script>";
                Response.Write(strScript);
                Session["Date"] = null;
                string strdate = ddlMonth.SelectedItem.Value + "/1/" + ddlYear.SelectedItem.Value;
                Session["Date"] = strdate;
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex);
        }
    }

    // Getting Information from resource file and display it in label

    private void LoadStrings(CultureInfo ci)
    {
        btn_View.Text = "&nbsp;&nbsp;" + rm.GetString("btn_View", ci);
        lblEmployeeName.Text = rm.GetString("email_EmployeeName", ci);
        lblEmployeeId.Text = rm.GetString("email_EmployeeId", ci);
        lblEmpCategory.Text = rm.GetString("Master_Category", ci);
        lblEmpType.Text = rm.GetString("Master_Type", ci);
        lblTimePeriod.Text = rm.GetString("Reports_TimePeriod", ci);
        lblFrom.Text = rm.GetString("email_FromDate", ci);
        lblTo.Text = rm.GetString("email_ToDate", ci);
        lblLeaveAnalysisReport.Text = rm.GetString("Report_LeaveAnalysis", ci);
        lblIntimationType.Text = rm.GetString("Leave_IntimationType", ci);
        lblIntimationType.Text = rm.GetString("Report_Intimation_Type", ci);
        chkPlannedLeave.Text = rm.GetString("Report_PlannedLeave", ci);
        chkUnPlannedLeaveWI.Text = rm.GetString("Leave_Planned", ci);
        chkUnPlannedLeaveWI.Text = rm.GetString("Report_UnplannedWI", ci);
        chkUnPlannedLeaveWOI.Text = rm.GetString("Leave_Unplanned", ci);
        chkUnPlannedLeaveWOI.Text = rm.GetString("Report_UnplannedWOI", ci);
    }

    private void UserRights()
    {
        ds_Checkuser = objCheckUser.checkRights(82, Convert.ToInt32(Session["userGroup_Id"]), "viewPrv");

        if (ds_Checkuser.Tables[0].Rows.Count > 0)
        {
            if (ds_Checkuser.Tables[0].Rows[0]["viewPrv"] == DBNull.Value || Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["viewPrv"]) == 1)
            {
                btn_View.Visible = true;
            }
            else
            {
                btn_View.Visible = false;
            }
        }
        else
        {
            Response.Redirect("ReportsLandingPage.aspx");
        }
    }

    protected void ObjectDataSource1_Updated(object sender, ObjectDataSourceStatusEventArgs e)
    {
        
        Page.RegisterStartupScript("Alert", "<script>alert('Notes Saved Successfully');</script>");

    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        string gstrDateFormat = string.Empty;
        gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
        string strEntryDate = txtEntryDate.Text;
        strEntryDate = objCommon.DateConvertion(gstrDateFormat, strEntryDate);

        string strNotes = txtRemarks.Text.Trim().Replace("'", "''");
        rptEmp.InsertLeaveAnalysisNotes_Angler(strNotes, strEntryDate, Convert.ToString(Session["EmpAutoID"]));
        Page.RegisterStartupScript("Alert", "<script>alert('Notes Saved Successfully');location.href='TA_UI_Report_LeaveAnalysis.aspx';</script>");
    }

    
    protected void grdRemarks_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Del")
        {          
            int iNoteID = Convert.ToInt32(e.CommandArgument);
            rptEmp.UpdateLeaveAnalysisNotes_Angler("D", iNoteID, "", Convert.ToString(Session["EmpAutoID"]), "");
            Page.RegisterStartupScript("Alert", "<script>alert('Notes Deleted Successfully');location.href='TA_UI_Report_LeaveAnalysis.aspx';</script>");
        }
    }

    protected void grdRemarks_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lblDate = (Label)e.Row.Cells[0].FindControl("lblDate");
            lblDate.Text = (Convert.ToDateTime(lblDate.Text)).ToString(Session["MDateFormat"].ToString());
        }
    }

    private void AddMonthNames()
    {
        int i;
        DateTime month = Convert.ToDateTime("1/1/2000");

        //ddlMonth.Items.Insert(0, "-Select-");

        for (i = 0; i <= 11; i++)
        {
            DateTime Months = month.AddMonths(i);
            ListItem list = new ListItem();
            list.Text = Months.ToString("MMMM");
            list.Value = Convert.ToString(i + 1);
            ddlMonth.Items.Add(list);
        }
        ddlMonth.Items.FindByValue(System.DateTime.Now.Month.ToString()).Selected = true;
    }

    private void AddEndYearsList()
    {
        int FromYear, ToYear;

        FromYear = DateTime.Now.Year - 10;
        ToYear = DateTime.Now.Year + 10;

        //ddlYear.Items.Insert(0, "-Select-");

        for (int YearsCount = FromYear; YearsCount <= ToYear; YearsCount++)
        {
            ddlYear.Items.Add(YearsCount.ToString());
        }
        ddlYear.Items.FindByText(System.DateTime.Now.Year.ToString()).Selected = true;
    }

    protected void ddlMonth_SelectedIndexChanged(object sender, EventArgs e)
    {
        Session["Date"] = null;
        string strdate = ddlMonth.SelectedValue + "/1/" + ddlYear.SelectedValue;
        Session["Date"] = strdate;
        grdRemarks.DataBind();
        Session["Remarks"] = "";
        foreach (GridViewRow i in grdRemarks.Rows)
        {

            Label lblRemarks = (Label)i.FindControl("lblNotes");
            if (lblRemarks.Text != "")
            {
                Session["Remarks"] = Session["Remarks"] + lblRemarks.Text;
            }
        }
    }

    protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
    {
        Session["Date"] = null;
        string strdate = ddlMonth.SelectedValue + "/1/" + ddlYear.SelectedValue;
        Session["Date"] = strdate;
        grdRemarks.DataBind();
        Session["Remarks"] = "";
        foreach (GridViewRow i in grdRemarks.Rows)
        {

            Label lblRemarks = (Label)i.FindControl("lblNotes");
            if (lblRemarks.Text != "")
            {
                Session["Remarks"] = Session["Remarks"] + lblRemarks.Text;
            }
        }
    }


    //private DateTime GetLastDayOfMonth(DateTime dtDate)
    //{
    //    DateTime dtTo = dtDate;
    //    dtTo = dtTo.AddMonths(1);
    //    dtTo = dtTo.AddDays(-(dtTo.Day));
    //    return dtTo;
    //}

    //To Find Date of the given year and month

    //private string setDate(int Month, int Year)
    //{
    //    string strdate = Month.ToString() + "/1/" + Year.ToString();
    //    return strdate;
    //}
}
