public iTextSharp.text.Table GenerateCoreReport(String RptDate)
    {
        iTextSharp.text.Table datatable = new iTextSharp.text.Table(10);
        datatable.Padding = 4.0F;
        datatable.Spacing = 0.0F;
        //datatable.setBorder(Rectangle.NO_BORDER);
        int[] headerwidths = { 10, 24, 12, 12, 7, 7, 7, 7, 1, 1 };

        datatable.SetWidths(headerwidths);
        datatable.Width = 100;

        // the first cell spans 10 columns
        Cell cell = new Cell(new Phrase("Daily Production Report For " + RptDate, FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD)));
        cell.HorizontalAlignment = 1;
        cell.Leading = 30;
        cell.Colspan = 10;
        cell.Border =   iTextSharp.text.Rectangle.NO_BORDER;
        cell.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;
        datatable.AddCell(cell);

        // These cells span 2 rows
        datatable.DefaultCellBorderWidth = 2;
        datatable.DefaultHorizontalAlignment = 1;
        datatable.DefaultRowspan = 2;
        datatable.AddCell("User Id");
        datatable.AddCell(new Phrase("Name", FontFactory.GetFont(FontFactory.HELVETICA, 14, iTextSharp.text.Font.BOLD)));
        datatable.AddCell("Work order");
        datatable.AddCell("Comments");

        // This cell spans the remaining 6 columns in 1 row
        datatable.DefaultRowspan = 1;
        datatable.DefaultColspan = 6;
        datatable.AddCell("Hours");

        // These cells span 1 row and 1 column
        datatable.DefaultColspan = 1;
        datatable.AddCell("Fab.");
        datatable.AddCell("Finish");
        datatable.AddCell("Eng.");
        datatable.AddCell("Misc.");
        datatable.AddCell("");
        datatable.AddCell("");

        //Here goes the Outer Loop to get the Project Information for the Day.Get the Project Name and display Here.
        whitfield_prod_reports _wproj = new whitfield_prod_reports();
        DataSet _mOuter = _wproj.GetProjectReportOuter(RptDate);
        DataTable dtProject = _mOuter.Tables[0];
        foreach (DataRow dProjRow in dtProject.Rows)
        {
            String _projNumber = dProjRow["TWC_Proj_Number"] == DBNull.Value ? "" : dProjRow["TWC_Proj_Number"].ToString();
            String _projName = dProjRow["ProjName"] == DBNull.Value ? "" : dProjRow["ProjName"].ToString();
            String _rptNumber = dProjRow["twc_report_number"] == DBNull.Value ? "" : dProjRow["twc_report_number"].ToString();

            Cell cell1 = new Cell(new Phrase(_projName + '(' + _projNumber + ')' , FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD)));
            cell1.HorizontalAlignment = 1;
            cell1.Leading = 30;
            cell1.Colspan = 10;
            cell1.Border = iTextSharp.text.Rectangle.TOP_BORDER;
            cell1.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;
            datatable.AddCell(cell1);

            datatable.DefaultCellBorderWidth = 1;
            datatable.DefaultRowspan = 1;

            //Here Goes the Inner Loop for the Employees worked on the Project.
            DataSet _mInner = _wproj.GetProjectReportInner(Convert.ToInt32(_rptNumber), Convert.ToInt32(_projNumber));
            DataTable dtActivity = _mInner.Tables[0];
            foreach (DataRow drActivity in dtActivity.Rows)
            {
                datatable.DefaultHorizontalAlignment = 1;
                datatable.AddCell(drActivity["loginid"] == DBNull.Value ? "" : drActivity["loginid"].ToString());
                datatable.AddCell(drActivity["UName"] == DBNull.Value ? "" : drActivity["UName"].ToString());
                datatable.AddCell(drActivity["Description"] == DBNull.Value ? "" : drActivity["Description"].ToString());
                datatable.AddCell(drActivity["empl_comments"] == DBNull.Value ? "" : drActivity["empl_comments"].ToString());
                datatable.DefaultHorizontalAlignment = 0;
                datatable.AddCell(drActivity["fab_hours"] == DBNull.Value ? "0" : drActivity["fab_hours"].ToString());
                datatable.AddCell(drActivity["fin_hours"] == DBNull.Value ? "0" : drActivity["fin_hours"].ToString());
                datatable.AddCell(drActivity["eng_hours"] == DBNull.Value ? "0" : drActivity["eng_hours"].ToString());
                datatable.AddCell(drActivity["misc_hours"] == DBNull.Value ? "0" : drActivity["misc_hours"].ToString());
                _totFabHours += Convert.ToInt32(drActivity["fab_hours"] == DBNull.Value ? "0" : drActivity["fab_hours"].ToString());
                _totFinHours += Convert.ToInt32(drActivity["fin_hours"] == DBNull.Value ? "0" : drActivity["fin_hours"].ToString());
                _totEngHours += Convert.ToInt32(drActivity["eng_hours"] == DBNull.Value ? "0" : drActivity["eng_hours"].ToString());
                _totMiscHours += Convert.ToInt32(drActivity["misc_hours"] == DBNull.Value ? "0" : drActivity["misc_hours"].ToString());
                datatable.AddCell("");
                datatable.AddCell("");
            }
                    //Here goes the SubTotal Per project.. Dont Forget.
                    datatable.DefaultCellBorderWidth = 1;
                    datatable.DefaultRowspan = 1;
                    datatable.DefaultHorizontalAlignment = 1;
                    datatable.AddCell("");
                    datatable.AddCell("Subtotal:");
                    datatable.AddCell("");
                    datatable.AddCell("");
                    datatable.DefaultHorizontalAlignment = 0;
                    datatable.AddCell(_totFabHours.ToString());
                    datatable.AddCell(_totFinHours.ToString());
                    datatable.AddCell(_totEngHours.ToString());
                    datatable.AddCell(_totMiscHours.ToString());
                    datatable.AddCell("");
                    datatable.AddCell("");
                    //Subtotal calculation ends here.
            _totFabHours = 0;
            _totFinHours = 0;
            _totEngHours = 0;
            _totMiscHours = 0;
        }
        return datatable;
    }
 private void DisplayReportGrid()
 {
     whitfield_prod_reports _wRep = new whitfield_prod_reports();
     DataSet _dsRep = new DataSet();
     _dsRep = _wRep.GetReportActivityForProject(_wRep.GetReportNumber(txtReportDate.Text.Trim()));
     this.PopulateRepDataGrid(_dsRep,grdActivity);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        NameValueCollection n = Request.QueryString;
        // See if any query string exists
        if (n.HasKeys())
        {
            //Get value
            actionKey = n.GetKey(0);
            _reportdt = n.Get(0);
        }

        whitfield_prod_reports _wpr = new whitfield_prod_reports();
        DataSet _ms = _wpr.GetReportForProject(_reportdt);
        GeneratePDF(_ms);
    }
 private void DisplayHistoryGrid()
 {
     whitfield_prod_reports _wRep = new whitfield_prod_reports();
     DataSet _dsRep = new DataSet();
     _dsRep = _wRep.GetProductionDailyReports();
     this.PopulateRepDataGrid(_dsRep,grdHistoryRpt);
 }
    private void DisplayProductionSchedule()
    {
        plSchedule.Controls.Clear();
        try
        {
            whitfield_prod_reports wSchedule = new whitfield_prod_reports();
            Whitfieldcore wWeek = new Whitfieldcore();

            //Fetch the General week Number for the outer loop
            //Fetch the Production schedule Dataset by passing the YEAR, MONTH and Week and bind the DataGrid. Continue for other Weeks.

            DataSet dsWeek = wWeek.GetWeeks();
            if (dsWeek.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dRow in dsWeek.Tables[0].Rows)
                {
                    String _weekName = dRow["week_name"].ToString();
                    DataSet dsProdSchedule = wSchedule.GetProductionScheduleForDates(ddlMonth.SelectedItem.Value, ddlYear.SelectedItem.Value, _weekName);
                    Int32 resultCountProd = 0;
                    if (dsProdSchedule.Tables.Count > 0)
                        resultCountProd = dsProdSchedule.Tables[0].Rows.Count;

                    if (resultCountProd > 0)
                    {
                       // Label lblTxt = new Label();
                       // lblTxt.CssClass = "header1";
                       // lblTxt.Text = _weekName;
                        DataGrid dGrid = new DataGrid();
                        dGrid.ID = "grd" + ddlMonth.SelectedItem.Value + ddlYear.SelectedItem.Value + _weekName;
                        dGrid.HorizontalAlign = HorizontalAlign.Left;
                        dGrid.CssClass="data";
                        dGrid.HeaderStyle.Font.Bold=true;
                        dGrid.HeaderStyle.HorizontalAlign= HorizontalAlign.Center;
                        dGrid.HeaderStyle.BackColor = System.Drawing.Color.LightBlue;
                        dGrid.HeaderStyle.CssClass="subnav";
                        //dGrid.Width=Unit.Pixel(500);
                        //dGrid.AllowPaging=false;
                        //dGrid.AutoGenerateColumns=false;
                        //dGrid.SelectedItemStyle.BackColor=System.Drawing.Color.LightGray;
                        //dGrid.ShowFooter=true;
                        dGrid.Caption = _weekName;
                        dGrid.CaptionAlign = TableCaptionAlign.Left;
                        dGrid.ItemStyle.Wrap = true;
                        dGrid.DataSource = dsProdSchedule.Tables[0];
                        dGrid.DataBind();
                        //plSchedule.Controls.Add(lblTxt);
                        plSchedule.Controls.Add(dGrid);
                    }
                }
            }

        }
        catch (Exception exp)
        {
            Response.Write(exp.Message.ToString());
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Whitfield_Project _wc = new Whitfield_Project();
        whitfield_prod_reports _wr = new whitfield_prod_reports();
        NameValueCollection n = Request.QueryString;

        if (!Page.IsPostBack)
        {
            //Logic Here for the Project Daily Field Report
            if (n.HasKeys())
            {
                // 3
                // Get first key and value
                string k = n.GetKey(0);
                string v = n.Get(0);
                txtReportDate.Text = v;
            }
            else
            {
                txtReportDate.Text = _wr.GetCurrentDate().Trim();
            }
            bindcontrols();
            if (_wr.IsReportExists(txtReportDate.Text.Trim()))
            {
                DataSet _dsDailyRpt = _wr.GetReportForProject(txtReportDate.Text.Trim());
                //txtReportDate.Text = _wr.GetCurrentDate();
                DataTable dtUsr = _dsDailyRpt.Tables[0];
                String _chkStatus = "";
                foreach (DataRow dRow in dtUsr.Rows)
                {
                    //txtRptNotes.Text = dRow["Daily_notes"] == DBNull.Value ? "" : dRow["Daily_notes"].ToString();
                    txtRptIssues.Text = dRow["Daily_comments"] == DBNull.Value ? "" : dRow["Daily_comments"].ToString();
                    //txtRptChangeOrderNotes.Text = dRow["Change_order_notes"] == DBNull.Value ? "" : dRow["Change_order_notes"].ToString();
                    _chkStatus = dRow["is_locked"] == DBNull.Value ? "" : dRow["is_locked"].ToString();
                    if (_chkStatus.Trim() == "Y")
                    {
                        chkActive.SelectedIndex = chkActive.Items.IndexOf(chkActive.Items.FindByValue(_chkStatus));
                      //  btnWO.Visible = false;
                    }
                }

            }
            //Logic for Project Daily Field Report Ends.
        }
    }
 private void DisplayEmployeeHoursGrid()
 {
     whitfield_prod_reports _wRep = new whitfield_prod_reports();
     DataSet _dsRep = new DataSet();
     _dsRep = _wRep.GetEmployeeDailyHours(txtReportDate.Text.Trim());
     this.PopulateRepDataGrid(_dsRep,grdEmployeeHours);
 }
    protected void ddlworkorders_SelectedIndexChanged(object sender, EventArgs e)
    {
        whitfield_prod_reports _wr = new whitfield_prod_reports();
        DataSet dsNormal = new DataSet();
        DataSet dsBudget = new DataSet();

        DataSet dsCummTD = new DataSet();
        DataSet dsCummBudget = new DataSet();
        DataSet dsCummDaily = new DataSet();

        dsNormal = _wr.GetBudgetHoursForWO(ddlProject.SelectedItem.Value, ddlworkorders.SelectedItem.Value);
        dsBudget = _wr.GetHoursTDForWO(ddlProject.SelectedItem.Value,ddlworkorders.SelectedItem.Value);

         dsCummBudget = _wr.GetCummulativeBudgetHoursForWO(txtReportDate.Text.Trim());
         dsCummDaily  = _wr.GetCummulativeHoursForToday(txtReportDate.Text.Trim());
         dsCummTD = _wr.GetCummulativeHoursTDForWO(txtReportDate.Text.Trim());

        //Instantiate the labels
        //cumulative labels instantiation
            lblcumEngHours.Text = "0";
            lblcumFabHours.Text = "0";
            lblcumfinHours.Text = "0";
            lblcummiscHours.Text = "0";
            lblcumtotHours.Text = "0";
            lblcumEngTD.Text = "0";
            lblcumfabTD.Text = "0";
            lblcumfinTD.Text = "0";
            lblcummiscTD.Text = "0";
            lblcumtotTD.Text = "0";
            lblcumDailyEng.Text = "0";
            lblcumDailyfab.Text = "0";
            lblcumDailyfin.Text = "0";
            lblcumDailymisc.Text = "0";
            lblcumDailytot.Text = "0";
            lblcumdiffEng.Text = "0";
            lblcumdifffab.Text = "0";
            lblcumdifffin.Text = "0";
            lblcumdiffmisc.Text = "0";
            lblcumdifftot.Text = "0";

            //cummulative hours
            DataTable dtCummBudget = dsCummBudget.Tables[0];
            foreach (DataRow dRow in dtCummBudget.Rows)
            {
                lblcumEngHours.Text = dRow["eng_hours"] == DBNull.Value ? "0" : dRow["eng_hours"].ToString();
                lblcumFabHours.Text = dRow["fab_hours"] == DBNull.Value ? "0" : dRow["fab_hours"].ToString();
                lblcumfinHours.Text = dRow["fin_hours"] == DBNull.Value ? "0" : dRow["fin_hours"].ToString();
                lblcummiscHours.Text = dRow["misc_hours"] == DBNull.Value ? "0" : dRow["misc_hours"].ToString();
                lblcumtotHours.Text = dRow["TotHours"] == DBNull.Value ? "0" : dRow["TotHours"].ToString();
            }
            //dumulative Daily Hours
            DataTable dtCummDaily = dsCummDaily.Tables[0];
            foreach (DataRow dRow1 in dtCummDaily.Rows)
            {
                lblcumDailyEng.Text = dRow1["eng_hours"] == DBNull.Value ? "0" : dRow1["eng_hours"].ToString();
                lblcumDailyfab.Text = dRow1["fab_hours"] == DBNull.Value ? "0" : dRow1["fab_hours"].ToString();
                lblcumDailyfin.Text = dRow1["fin_hours"] == DBNull.Value ? "0" : dRow1["fin_hours"].ToString();
                lblcumDailymisc.Text = dRow1["misc_hours"] == DBNull.Value ? "0" : dRow1["misc_hours"].ToString();
                lblcumDailytot.Text = dRow1["TotHours"] == DBNull.Value ? "0" : dRow1["TotHours"].ToString();
            }
            //dumulative Daily Hours
            DataTable dtCummTD = dsCummTD.Tables[0];
            foreach (DataRow dRow2 in dtCummTD.Rows)
            {
                lblcumEngTD.Text = dRow2["eng_hours"] == DBNull.Value ? "0" : dRow2["eng_hours"].ToString();
                lblcumfabTD.Text = dRow2["fab_hours"] == DBNull.Value ? "0" : dRow2["fab_hours"].ToString();
                lblcumfinTD.Text = dRow2["fin_hours"] == DBNull.Value ? "0" : dRow2["fin_hours"].ToString();
                lblcummiscTD.Text = dRow2["misc_hours"] == DBNull.Value ? "0" : dRow2["misc_hours"].ToString();
                lblcumtotTD.Text = dRow2["TotHours"] == DBNull.Value ? "0" : dRow2["TotHours"].ToString();
            }

        //Cumulative Difference Calculation

            lblcumdiffEng.Text = (Decimal.Parse(lblcumEngHours.Text) - (Convert.ToDecimal(lblcumEngTD.Text))).ToString();
            lblcumdifffab.Text = (Decimal.Parse(lblcumFabHours.Text) - (Convert.ToDecimal(lblcumfabTD.Text))).ToString();
            lblcumdifffin.Text = (Decimal.Parse(lblcumfinHours.Text) - (Convert.ToDecimal(lblcumfinTD.Text))).ToString();
            lblcumdiffmisc.Text = (Decimal.Parse(lblcummiscHours.Text) - (Convert.ToDecimal(lblcumtotTD.Text))).ToString();
            lblcumdifftot.Text = (Convert.ToDecimal(lblcumdiffEng.Text) + Convert.ToDecimal(lblcumdifffab.Text) + Convert.ToDecimal(lblcumdifffin.Text) + Convert.ToDecimal(lblcumdiffmisc.Text)).ToString();
        //*******************
                //Normal Hours Labels Instantiation.

                lblbudeng.Text = "0";
                lblbudfab.Text = "0";
                lblbudfin.Text = "0";
                lblbudmisc.Text = "0";
                lblbudtot.Text = "0";

                lblEngTD.Text = "0";
                lblfabTD.Text = "0";
                lblfinTD.Text = "0";
                lblmiscTD.Text = "0";
                lbltotTD.Text = "0";

                lbldiffEng.Text = "0";
                lbldifffab.Text = "0";
                lbldifffin.Text = "0";
                lbldiffmisc.Text = "0";
                lbldifftot.Text = "0";

                DataTable dtNormal = dsNormal.Tables[0];
                foreach (DataRow dRow in dtNormal.Rows)
                {
                    lblbudeng.Text = dRow["eng_hours"] == DBNull.Value ? "0" : dRow["eng_hours"].ToString();
                    lblbudfab.Text = dRow["fab_hours"] == DBNull.Value ? "0" : dRow["fab_hours"].ToString();
                    lblbudfin.Text = dRow["fin_hours"] == DBNull.Value ? "0" : dRow["fin_hours"].ToString();
                    lblbudmisc.Text = dRow["misc_hours"] == DBNull.Value ? "0" : dRow["misc_hours"].ToString();
                    lblbudtot.Text = dRow["TotHours"] == DBNull.Value ? "0" : dRow["TotHours"].ToString();
                }

                DataTable dtTD = dsBudget.Tables[0];
                foreach (DataRow dRow1 in dtTD.Rows)
                {
                    lblEngTD.Text = dRow1["eng_hours"] == DBNull.Value ? "0" : dRow1["eng_hours"].ToString();
                    lblfabTD.Text = dRow1["fab_hours"] == DBNull.Value ? "0" : dRow1["fab_hours"].ToString();
                    lblfinTD.Text = dRow1["fin_hours"] == DBNull.Value ? "0" : dRow1["fin_hours"].ToString();
                    lblmiscTD.Text = dRow1["misc_hours"] == DBNull.Value ? "0" : dRow1["misc_hours"].ToString();
                    lbltotTD.Text = dRow1["TotHours"] == DBNull.Value ? "0" : dRow1["TotHours"].ToString();
                }

                txtenghours.Text = txtenghours.Text.Trim() == "" ? "0" : txtenghours.Text.Trim().ToString();
                txtfabhours.Text = txtfabhours.Text.Trim() == "" ? "0" : txtfabhours.Text.Trim().ToString();
                txtmischours.Text = txtmischours.Text.Trim() == "" ? "0" : txtmischours.Text.Trim().ToString();
                txtfinhours.Text = txtfinhours.Text.Trim() == "" ? "0" : txtfinhours.Text.Trim().ToString();

                lbldiffEng.Text = (Decimal.Parse(lblbudeng.Text) - (Convert.ToDecimal(lblEngTD.Text) + Convert.ToDecimal(txtenghours.Text))).ToString();
                lbldifffab.Text = (Decimal.Parse(lblbudfab.Text) - (Convert.ToDecimal(lblfabTD.Text) + Convert.ToDecimal(txtfabhours.Text))).ToString();
                lbldifffin.Text = (Decimal.Parse(lblbudfin.Text) - (Convert.ToDecimal(lblfinTD.Text) + Convert.ToDecimal(txtfinhours.Text))).ToString();
                lbldiffmisc.Text = (Decimal.Parse(lblbudmisc.Text) - (Convert.ToDecimal(lblmiscTD.Text) + Convert.ToDecimal(txtmischours.Text))).ToString();
                lbldifftot.Text = (Convert.ToDecimal(lbldiffEng.Text) + Convert.ToDecimal(lbldifffab.Text) + Convert.ToDecimal(lbldifffin.Text) + Convert.ToDecimal(lbldiffmisc.Text)).ToString();

        //Instantiate the labels
    }
    protected void btnWO_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            whitfield_prod_reports _wRep = new whitfield_prod_reports();
            Boolean IsInsertSuccess = false;
            IsInsertSuccess = _wRep.ManageReportMain(txtReportDate.Text.Trim(),
                                           "",
                                           txtRptIssues.Text.Trim(),
                                           "",
                                           chkActive.SelectedItem.Value.Trim());

            if (IsInsertSuccess)
            {
                IsInsertSuccess = _wRep.ManageReportActivityMain(_wRep.GetReportNumber(txtReportDate.Text.Trim()),
                                                                           ddlEmpl.SelectedItem.Value,
                                                                           ddlProject.SelectedItem.Value,
                                                                           ddlworkorders.SelectedItem.Value,
                                                                           Convert.ToString(txtfabhours.Text.Trim()),
                                                                           Convert.ToString(txtfinhours.Text.Trim()),
                                                                           Convert.ToString(txtenghours.Text.Trim()),
                                                                           Convert.ToString(txtmischours.Text.Trim()),
                                                                           txtActComments.Text.Trim());
            }

           DisplayReportGrid();
           DisplayHistoryGrid();
           DisplayEmployeeHoursGrid();

        }
    }
    public void sendEmail()
    {
        whitfield_prod_reports _wRep = new whitfield_prod_reports();
        MailMessage message = new MailMessage();

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

        //using (IDataReader reader = u.GetMSIRAdminRecords())  //HHS Uncomment this portion when there is an email list.
        //{
        //    while (reader.Read())
        //    {
        //        message.To.Add(reader["EMAIL_ADDRESS"].ToString());
        //    }
        //}

        message.To.Add(System.Configuration.ConfigurationManager.AppSettings["AdminEmail"].ToString());
        //message.To.Add(System.Configuration.ConfigurationManager.AppSettings["PMEmail"].ToString());
        message.From = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["DPR_fromEmail"]);
        message.Subject = "Daily Production report for " + txtReportDate.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 Company, Inc.<br>");
        sb.Append("8836 Washington Blvd., Ste 101<br>");
        sb.Append("Jessup, MD 20794<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>");

        sb.Append("<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'><TR>");
        sb.Append("<TD>");
        //sb.Append("<br><b>Following is the Daily Production report for " + txtReportDate.Text.Trim() + "</b>");
        //Significant Issues/Impediments Notes/Comments
        sb.Append("<br><b>Significant Issues/Impediments Notes/Comments:</b>" + txtRptIssues.Text.Trim() + "<br>");
        sb.Append("</TD>");
        sb.Append("</TR></TABLE>");

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

        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.ItemStyle.Font.Bold = true;
        dg.FooterStyle.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#D9D9D9");

        dg.DataSource = _wRep.GetReportActivityForProjectForEmail(_wRep.GetReportNumber(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
        StringBuilder SBEmployeeHours = new StringBuilder();
        StringWriter SWEmployeeHours = new StringWriter(SBEmployeeHours);
        HtmlTextWriter htmlTWEmployeeHours = new HtmlTextWriter(SWEmployeeHours);
        grdEmployeeHours.RenderControl(htmlTWEmployeeHours);
        string EmployeeHoursString = SBEmployeeHours.ToString();
        sb.Append("<br><b>Employee Hours:</b><br>" + EmployeeHoursString + "<br><b>Employee Activity:</b><br>" + ActivityString);
        sb.Append("</body></html>");
        message.Body = sb.ToString();
        SmtpClient smtp = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["smtp"]);
        smtp.Send(message);
    }
 public void grdActivity_UpdateCommand(object sender, DataGridCommandEventArgs e)
 {
     String activity_id = "";
     activity_id = grdActivity.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     whitfield_prod_reports _wRep = new whitfield_prod_reports();
     _wRep.UpdateReportActivity(Convert.ToInt32(activity_id), Convert.ToString(((TextBox)(e.Item.FindControl("txtfabhours"))).Text), Convert.ToString(((TextBox)(e.Item.FindControl("txtfinhours"))).Text), Convert.ToString(((TextBox)(e.Item.FindControl("txtenghours"))).Text), Convert.ToString(((TextBox)(e.Item.FindControl("txtmischours"))).Text), (((TextBox)(e.Item.FindControl("txtNotes"))).Text).ToString());
     grdActivity.EditItemIndex = -1;
     grdActivity.ShowFooter = true;
     this.DisplayReportGrid();
     DisplayHistoryGrid();
     DisplayEmployeeHoursGrid();
 }
 public void grdActivity_DeleteCommand(object sender, DataGridCommandEventArgs e)
 {
     String activity_id = "";
     activity_id = grdActivity.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     whitfield_prod_reports _wRep = new whitfield_prod_reports();
     _wRep.DeleteProjectActivity(activity_id);
     this.DisplayReportGrid();
     DisplayHistoryGrid();
     DisplayEmployeeHoursGrid();
 }