public void DisplayListBoxValues()
    {
        try
        {
            try
            {
                Whitfieldcore wCore = new Whitfieldcore();
                DataSet dsRight = new DataSet();
                DataSet dsLeft = new DataSet();

                dsLeft = wCore.GetLeftDistributionList(Convert.ToInt32(ViewState["EstNum"].ToString()), Convert.ToInt32(ViewState["twcProjNumber"].ToString()));
                BindUsers(leftlist, dsLeft);
                dsRight = wCore.GetRightDistributionList(Convert.ToInt32(ViewState["twcProjNumber"].ToString()));
                BindUsers(rightlist, dsRight);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
    public void sendEmail()
    {
        Whitfieldcore wCore = new Whitfieldcore();
        whitfield_reports _wRep = new whitfield_reports();
        MailMessage message = new MailMessage();

        message.To.Add(System.Configuration.ConfigurationManager.AppSettings["devEmail"]);

        //Here is where we add the receipients.
        using (DataSet ds = wCore.GetRightDistributionList(Convert.ToInt32(ViewState["twc_project_number"].ToString())) )  //HHS Uncomment this portion when there is an email list.
        {
            DataTable dtUsr = ds.Tables[0];
            if (dtUsr.Rows.Count > 0)
            {
                foreach (DataRow dRow in dtUsr.Rows)
                {
                    string _email = dRow["Email"] == DBNull.Value ? "" : dRow["Email"].ToString();
                    message.To.Add(_email);
                }
            }
        }

        message.To.Add(System.Configuration.ConfigurationManager.AppSettings["AdminEmail"].ToString());
        //This is commented by Harish on Friday, January 27th with the request of Jammie.
        //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["PMEmail"].ToString());

        message.From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["DFR_fromEmail"]);
        message.Subject = txtReportDate.Text.Trim() + "  Daily Field Report:" + lblPrjHeader.Text.Trim();
        message.IsBodyHtml = true;

        StringBuilder sb = new StringBuilder();
        sb.Append("<html><head></head>");
        sb.Append("<body>");
        //Header
        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD><IMG height='80' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/TWC%20Primary%20Logo1.JPG' border='0'></TD>");
        sb.Append("<TD class='form1' vAlign='bottom' align='right' width='100%'><b>The Whitfield Corporation, Inc.,<br>");
        sb.Append("P.O. Box 0385<br>");
        sb.Append("Fulton, MD 20759<br>");
        sb.Append("(301)-483-0791<br>");
        sb.Append("(301)-483-0792</b><br>");
        sb.Append("<IMG height='9' alt='' src='http://www.whitfield-co.com/whitfield-co/assets/img/images.gif' width='1'>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

        //EmployeeHours
        System.Drawing.ColorConverter colConvert = new ColorConverter();
        DataGrid dgWorkOrders = new DataGrid();
        dgWorkOrders.Font.Size = 9;
        dgWorkOrders.CssClass = "data";

        dgWorkOrders.HeaderStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#60829F");
        dgWorkOrders.HeaderStyle.CssClass = "subnav";
        dgWorkOrders.HeaderStyle.Font.Bold = true;
        dgWorkOrders.ItemStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#EAEFF3");
        dgWorkOrders.FooterStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#D9D9D9");

        dgWorkOrders.DataSource = _wRep.GetReportActivityForProjectMail(_wRep.GetReportNumber(Convert.ToInt32(ViewState["twc_project_number"].ToString()), txtReportDate.Text.Trim()), Convert.ToInt32(ViewState["twc_project_number"].ToString()));
        dgWorkOrders.DataBind();

        StringBuilder SBEmployeeHours = new StringBuilder();
        StringWriter SWEmployeeHours = new StringWriter(SBEmployeeHours);
        HtmlTextWriter htmlTWEmployeeHours = new HtmlTextWriter(SWEmployeeHours);
        dgWorkOrders.RenderControl(htmlTWEmployeeHours);
        string EmployeeHoursString = SBEmployeeHours.ToString();
        sb.Append("<br><B>Work Executed for Today:</b><br>" + EmployeeHoursString);

        //Daily Work Performed Notes/Comments
        String StrRptNotes = "";

        if (txtRptNotes.Text == "")
        {
            StrRptNotes = "None.";
        }
        else
        {
            StrRptNotes = txtRptNotes.Text.Trim();
        }
        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD>");
        sb.Append("<br><b>Daily Work Performed Notes/Comments:</b>" + StrRptNotes + "<br>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

        //Significant Issues/Impediments Notes/Comments:
        String StrRptIssues = "";

        if (txtRptIssues.Text == "")
        {
            StrRptIssues = "None.";
        }
        else
        {
            StrRptIssues = txtRptIssues.Text.Trim();
        }

        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD>");
        sb.Append("<br><b>Significant Issues/Impediments Notes/Comments:</b>" + StrRptIssues + "<br>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

        //Change Order Work Notes/Comments

        String StrRptChangeOrderNotes = "";
        if (txtRptChangeOrderNotes.Text == "")
        {
            StrRptChangeOrderNotes = "None.";
        }
        else
        {
            StrRptChangeOrderNotes = txtRptChangeOrderNotes.Text.Trim();
        }

        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD>");
        sb.Append("<br><b>Change Order Work Notes/Comments:</b>" + StrRptChangeOrderNotes + "<br>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

        //Man Power Detail
        DataGrid dg = new DataGrid();
        dg.Font.Size = 9;
        dg.CssClass = "data";

        dg.HeaderStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#60829F");
        dg.HeaderStyle.CssClass = "subnav";
        dg.HeaderStyle.Font.Bold = true;
        dg.ItemStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#EAEFF3");
        dg.FooterStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#D9D9D9");

        dg.DataSource = _wRep.GetManPowerEntriesMail(_wRep.GetReportNumber(Convert.ToInt32(ViewState["twc_project_number"].ToString()), txtReportDate.Text.Trim()));
        dg.DataBind();
        StringBuilder SBActivity = new StringBuilder();
        StringWriter SWActivity = new StringWriter(SBActivity);
        HtmlTextWriter htmlTWActivity = new HtmlTextWriter(SWActivity);
        dg.RenderControl(htmlTWActivity);
        string ActivityString = SBActivity.ToString();

        ////EmployeeHours
        //DataGrid dgWorkOrders = new DataGrid();
        //dgWorkOrders.Font.Size = 9;
        //dgWorkOrders.CssClass = "data";

        //dgWorkOrders.HeaderStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#60829F");
        //dgWorkOrders.HeaderStyle.CssClass = "subnav";
        //dgWorkOrders.HeaderStyle.Font.Bold = true;
        //dgWorkOrders.ItemStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#EAEFF3");
        //dgWorkOrders.FooterStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#D9D9D9");

        //dgWorkOrders.DataSource = _wRep.GetReportActivityForProjectMail(_wRep.GetReportNumber(Convert.ToInt32(ViewState["twc_project_number"].ToString()), txtReportDate.Text.Trim()), Convert.ToInt32(ViewState["twc_project_number"].ToString()));
        //dgWorkOrders.DataBind();

        //StringBuilder SBEmployeeHours = new StringBuilder();
        //StringWriter SWEmployeeHours = new StringWriter(SBEmployeeHours);
        //HtmlTextWriter htmlTWEmployeeHours = new HtmlTextWriter(SWEmployeeHours);
        //dgWorkOrders.RenderControl(htmlTWEmployeeHours);
        //string EmployeeHoursString = SBEmployeeHours.ToString();

        sb.Append("<br><b>Man Power Detail:</b><br>" + ActivityString);
        sb.Append("</body></html>");
        message.Body = sb.ToString();
        SmtpClient smtp = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["smtp"]);
        smtp.Send(message);
    }