Ejemplo n.º 1
0
 protected void grid_driver_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     try
     {
         if (e.DataColumn.FieldName == "Statuscode")  // start, pending, complete, cancel
         {
             string _status = string.Format("{0}", e.CellValue);
             if (_status == "Start" || _status == "S")
             {
                 e.Cell.BackColor = System.Drawing.Color.LightBlue;
             }
             else if (_status == "Doing" || _status == "D")
             {
                 e.Cell.BackColor = System.Drawing.Color.BurlyWood;
             }
             else if (_status == "Pending" || _status == "P")
             {
                 e.Cell.BackColor = System.Drawing.Color.Yellow;
             }
             else if (_status == "Completed" || _status == "C")
             {
                 e.Cell.BackColor = System.Drawing.Color.LightGreen;
             }
             else if (_status == "Cancel" || _status == "X")
             {
                 e.Cell.BackColor = System.Drawing.Color.Red;
             }
             else if (_status == "Waiting" || _status == "W")
             {
                 e.Cell.BackColor = System.Drawing.Color.Orange;
             }
         }
     }
     catch { }
 }
Ejemplo n.º 2
0
 protected void gridThanhVien_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.DataColumn.FieldName == "id")
     {
         ASPxLabel lbl_STT = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_STT") as ASPxLabel;
         lbl_STT.Text = nSTT++.ToString();
     }
     if (e.DataColumn.FieldName == "unitid")
     {
         ASPxLabel lbl_DonVi = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_DonVi") as ASPxLabel;
         if (objUnit.GetUnit(Convert.ToInt32(e.CellValue)).parentid == 14)
         {
             lbl_DonVi.Text = objUnit.GetUnit(Convert.ToInt32(e.CellValue)).name;
         }
         else
         {
             lbl_DonVi.Text = objUnit.GetUnit(objUnit.GetUnit(Convert.ToInt32(e.CellValue)).parentid).name + " - " + objUnit.GetUnit(Convert.ToInt32(e.CellValue)).name;
         }
     }
     if (e.DataColumn.FieldName == "idLoaiHopDong")
     {
         ASPxLabel lbl_LoaiHopDong = gridThanhVien.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lbl_LoaiHopDong") as ASPxLabel;
         lbl_LoaiHopDong.Text = objHopDong.GetLaborContractType(Convert.ToInt32(e.CellValue)).name.ToString();
     }
 }
Ejemplo n.º 3
0
 protected void grid_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     //if (e.VisibleIndex < 0) return;
     //if (e.DataColumn.FieldName == "WarningQty")
     //{
     //    DataRow row = this.grid.GetDataRow(e.VisibleIndex);
     //    int cnt = SafeValue.SafeInt(row["Cnt"], 0);
     //    if (SafeValue.SafeInt(e.CellValue, 0) < cnt)
     //        e.Cell.BackColor = System.Drawing.Color.LightPink;
     //}
     //if (e.DataColumn.FieldName == "WarningAmt")
     //{
     //    DataRow row = this.grid.GetDataRow(e.VisibleIndex);
     //    decimal cnt = SafeValue.SafeDecimal(row["Amt"], 0);
     //    if (SafeValue.SafeDecimal(e.CellValue, 0) < cnt)
     //        e.Cell.BackColor = System.Drawing.Color.LightPink;
     //}
     //if (e.DataColumn.FieldName == "BlockQty")
     //{
     //    DataRow row = this.grid.GetDataRow(e.VisibleIndex);
     //    int cnt = SafeValue.SafeInt(row["Cnt"], 0);
     //    if (SafeValue.SafeInt(e.CellValue, 0) < cnt)
     //        e.Cell.BackColor = System.Drawing.Color.LightPink;
     //}
     //if (e.DataColumn.FieldName == "BlockAmt")
     //{
     //    DataRow row = this.grid.GetDataRow(e.VisibleIndex);
     //    decimal cnt = SafeValue.SafeDecimal(row["Amt"], 0);
     //    if (SafeValue.SafeDecimal(e.CellValue, 0) < cnt)
     //        e.Cell.BackColor = System.Drawing.Color.LightPink;
     //}
 }
Ejemplo n.º 4
0
        protected void gvPengembalianKelebihan_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
        {
            try
            {
                if (e.VisibleIndex >= 0)
                {
                    if (e.DataColumn.FieldName == "nilaiAdv")
                    {
                        int adv = Convert.ToInt32(e.GetValue("nilaiAdv"));

                        if (adv != 0)
                        {
                            e.Cell.ForeColor = System.Drawing.Color.Red;
                            e.Cell.Text      = String.Format("({0:#,##})", adv);
                        }
                        else
                        {
                            e.Cell.ForeColor = System.Drawing.Color.Black;
                        }
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 5
0
    protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
    {
        string htmlId           = string.Format("cell_{0}_{1}", e.VisibleIndex, e.DataColumn.FieldName);
        string cellClickHandler = string.Format(@"onCellClick(""{0}"", ""{1}"", ""{2}"")", e.DataColumn.FieldName, e.GetValue(e.DataColumn.FieldName), htmlId);

        e.Cell.Attributes.Add("onclick", cellClickHandler);
        e.Cell.Attributes.Add("id", htmlId);
    }
 protected void grv_SalePrinciple_HtmlDataCellPrepared(object sender,
                                                       DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.VisibleIndex == 0)
     {
         e.Cell.BackColor = System.Drawing.Color.Yellow;
     }
 }
Ejemplo n.º 7
0
    protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
    {
        String colIdx = "col_idx_" + e.DataColumn.Index.ToString();
        String rowIdx = "row_idx_" + e.VisibleIndex.ToString();

        e.Cell.Attributes.Add("onmouseover", "OnCellOver(this, '" + colIdx + "', '" + rowIdx + "');");
        e.Cell.Attributes.Add("onmouseout", "OnCellOut(this, '" + colIdx + "', '" + rowIdx + "');");
        e.Cell.CssClass += " " + colIdx + " " + rowIdx;
    }
 protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.DataColumn.FieldName == "Value")
     {
         object isVisible = ASPxGridView1.GetRowValues(e.VisibleIndex, "IsVisible");
         if (!true.Equals(isVisible))
         {
             e.Cell.Text = "&nbsp;"; // non-breaking space symbol
         }
     }
 }
    protected void grid_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
    {
        if (e.DataColumn == null || e.DataColumn.FieldName != "Total")
        {
            return;
        }
        decimal value = (decimal)e.GetValue("Total");

        if (value > 500)
        {
            e.Cell.Font.Bold = true;
        }
    }
Ejemplo n.º 10
0
 protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.DataColumn.Caption == "状态")
     {
         if (e.CellValue.ToString().Trim() == "通用")
         {
             e.Cell.ForeColor = System.Drawing.Color.Red;
         }
         if (e.CellValue.ToString().Trim() == "引用")
         {
             e.Cell.ForeColor = System.Drawing.Color.DarkOrange;
         }
     }
 }
Ejemplo n.º 11
0
 protected void agvDATA_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.DataColumn.Caption.Trim() == "状态")
     {
         if (e.CellValue.ToString().Trim() == "已发布")
         {
             e.Cell.ForeColor = System.Drawing.Color.Red;
         }
         else
         {
             e.Cell.ForeColor = System.Drawing.Color.Green;
         }
     }
 }
Ejemplo n.º 12
0
        protected void gvAngsuran_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
        {
            //cek < 0 || (string)
            int cek = DateTime.Compare(DateTime.Today, DateTime.Parse(gvAngsuran.GetRowValues(e.VisibleIndex, "TglJatuhTempo").ToString()));

            if (gvAngsuran.GetRowValues(e.VisibleIndex, "IsLunas").ToString() == "Ya" || cek < 0)
            {
                e.Cell.ForeColor = System.Drawing.Color.Black;
            }
            else
            {
                e.Cell.ForeColor = System.Drawing.Color.Red;
            }
        }
 protected void gvDetailKartuPiutang_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.VisibleIndex > 0)
     {
         if (e.DataColumn.FieldName == "NilaiAdv")
         {
             int adv = Convert.ToInt32(e.GetValue("NilaiAdv"));
             if (adv != 0)
             {
                 e.Cell.Text      = String.Format("({0:#,#.00})", adv);
                 e.Cell.ForeColor = System.Drawing.Color.Red;
             }
         }
     }
 }
Ejemplo n.º 14
0
 protected void gvMitraBermasala_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.VisibleIndex >= 0)
     {
         try
         {
             if (e.DataColumn.FieldName == "TglBermasalah")
             {
                 e.Cell.ForeColor = System.Drawing.Color.Red;
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Ejemplo n.º 15
0
 protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.VisibleIndex < 0)
     {
         return;
     }
     if (e.DataColumn.FieldName == "ToLoc")
     {
         ASPxButtonEdit toLoc = this.ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "txt_ToLoc") as ASPxButtonEdit;
         if (toLoc != null)
         {
             toLoc.ClientInstanceName           = toLoc.ClientInstanceName + e.VisibleIndex;
             toLoc.ClientSideEvents.ButtonClick = "function(s,e){" + string.Format("PopupLocation({0},null);", toLoc.ClientInstanceName) + "}";
         }
     }
 }
Ejemplo n.º 16
0
 protected void grid_Transport_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     //if (e.DataColumn.Caption == "Job Status")
     //{
     //    string status = SafeValue.SafeString(this.grid_Transport.GetRowValues(e.VisibleIndex, "JobStatus"));
     //    if (status == "USE")
     //    {
     //        e.Cell.BackColor = System.Drawing.Color.LightGreen;
     //    }
     //    if (status == "CLS")
     //    {
     //        e.Cell.BackColor = System.Drawing.Color.Orange;
     //    }
     //    if (status == "CNL")
     //    {
     //        e.Cell.BackColor = System.Drawing.Color.Red;
     //    }
     //}
 }
Ejemplo n.º 17
0
 protected void gvReport_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.VisibleIndex >= 0)
     {
         if (e.DataColumn == gvReport.Columns["BayarPokok"] || e.DataColumn == gvReport.Columns["BayarBunga"] || e.DataColumn == gvReport.Columns["NilaiAdv"] || e.DataColumn == gvReport.Columns["Totalbayar"])
         {
             var value = 0m;
             try
             {
                 value = Convert.ToDecimal(e.CellValue.ToString());
             }
             catch (Exception ex)
             {
             }
             if (value < 0)
             {
                 e.Cell.ForeColor = System.Drawing.Color.Red;
             }
         }
     }
 }
Ejemplo n.º 18
0
 protected void grdExpried_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.DataColumn.FieldName == "hoten")
     {
         LinkButton ltNhanVien = grdExpried.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "ltNhanVien") as LinkButton;
         //ltNhanVien.PostBackUrl =String.Format(DotNetNuke.Common.Globals.ApplicationPath + "/nhanvien/kyhopdong/tabid/908/Default.aspx?Id={0}&ac=1", e.GetValue("empid"));
         ltNhanVien.OnClientClick = " KyHopDong(" + e.GetValue("empid") + "); return false; ";
         ltNhanVien.Text          = e.CellValue.ToString();
     }
     if (e.DataColumn.FieldName == "ketthuc")
     {
         DateTime ngaykt = DateTime.Parse(e.CellValue.ToString());
         if (ngaykt.Month < DateTime.Now.Month)
         {
             e.Cell.ForeColor = Color.Red;
         }
         else
         {
             e.Cell.ForeColor = Color.Green;
         }
     }
 }
Ejemplo n.º 19
0
 protected void grid_packingLot_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
 }
Ejemplo n.º 20
0
 protected void gvPembayaran_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
 {
     if (e.VisibleIndex >= 0)
     {
     }
 }