Exemplo n.º 1
0
        private void setGrd2()
        {
            Font      font = new Font("Microsoft Sans Serif", 12, FontStyle.Bold);
            Font      fontStrike = new Font("Microsoft Sans Serif", 12, FontStyle.Strikeout);
            double    up = 0, tod = 0, down = 0, amt = 0;
            DataTable dt = new DataTable();
            Thoo      t  = new Thoo();

            dt = lc.lotdb.selectApprovedByPeriod(cboYear.Text, cboMonth.SelectedValue.ToString(), cboPeriod.SelectedValue.ToString());
            if (dt.Rows.Count > 0)
            {
                dgv1.RowCount = dt.Rows.Count;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    try
                    {
                        setDataGrid1(dgv1, i, dt.Rows[i][lc.lotdb.lot.number].ToString(), Double.Parse(dt.Rows[i][lc.lotdb.lot.up].ToString()),
                                     Double.Parse(dt.Rows[i][lc.lotdb.lot.tod].ToString()), Double.Parse(dt.Rows[i][lc.lotdb.lot.down].ToString()),
                                     dt.Rows[i][lc.lotdb.lot.rowId].ToString(), dt.Rows[i][lc.lotdb.lot.lottoId].ToString(), dt.Rows[i][lc.lotdb.lot.use1].ToString(),
                                     dt.Rows[i][lc.lotdb.lot.statusOverLimit].ToString(), dt.Rows[i][lc.lotdb.lot.OLUp].ToString(), dt.Rows[i][lc.lotdb.lot.OLTod].ToString(), dt.Rows[i][lc.lotdb.lot.OLDown].ToString(),
                                     dt.Rows[i][lc.lotdb.lot.thooTranferId].ToString());
                        up   += Double.Parse(lc.cf.NumberNull(dt.Rows[i][lc.lotdb.lot.up]));
                        tod  += Double.Parse(lc.cf.NumberNull(dt.Rows[i][lc.lotdb.lot.tod]));
                        down += Double.Parse(lc.cf.NumberNull(dt.Rows[i][lc.lotdb.lot.down]));
                        //amt += up + tod + down;
                        t = lc.getThoo(dt.Rows[i][lc.lotdb.lot.thooTranferId].ToString());
                        if (dgv1[colThooTranferId, i].Value.ToString().Length > 0)
                        {
                            dgv1.Rows[i].DefaultCellStyle.Font = fontStrike;
                        }
                        if (dgv1[colStatusOL, i].Value.ToString().Equals("1"))
                        {
                            dgv1[colOLUp, i].Style.Font        = font;
                            dgv1[colOLUp, i].Style.ForeColor   = Color.Red;
                            dgv1[colOLTod, i].Style.Font       = font;
                            dgv1[colOLTod, i].Style.ForeColor  = Color.Red;
                            dgv1[colOLDown, i].Style.Font      = font;
                            dgv1[colOLDown, i].Style.ForeColor = Color.Red;
                        }
                        if (dgv1[colNumber, i].Value.ToString().Length == 1)
                        {
                            dgv1.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#174e75");
                        }
                        else if (dgv1[colNumber, i].Value.ToString().Length == 2)
                        {
                            dgv1.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#789640");
                        }
                        else if (dgv1[colNumber, i].Value.ToString().Length == 3)
                        {
                            dgv1.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#788540");
                        }
                        //c = ColorTranslator.FromHtml(t.Color);
                        //dgv1.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml(lc.getThooBackColor(t.Color));
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            txtUp.Text   = String.Format("{0:#,###,###.00}", up);
            txtTod.Text  = String.Format("{0:#,###,###.00}", tod);
            txtDown.Text = String.Format("{0:#,###,###.00}", down);
            txtAmt.Text  = String.Format("{0:#,###,###.00}", (up + tod + down));
            setThooAmount();
            setRateAmount();
        }