Example #1
0
        protected void grvContests_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
        {
            //if (e.DataColumn.FieldName == "Description")
            if (e.CellValue != null)
            {
                string toolTip = Environment.NewLine +
                                 "Mô tả: " + grvContests.GetRowValues(e.VisibleIndex, "Description").ToString() + Environment.NewLine + Environment.NewLine +
                                 "Mật khẩu: " + grvContests.GetRowValues(e.VisibleIndex, "ContestPassword").ToString() + Environment.NewLine + Environment.NewLine +
                                 "Sửa gần nhất: " + DateTime.Parse(grvContests.GetRowValues(e.VisibleIndex, "ModifiedOn").ToString()).ToString("dd/MM/yyyy") + Environment.NewLine + Environment.NewLine +
                                 "Tạo bởi: " + grvContests.GetRowValues(e.VisibleIndex, "FullName").ToString() + Environment.NewLine;
                //+ e.CellValue.ToString();


                if (grvContests.GetRowValues(e.VisibleIndex, "StartTime") != null)
                {
                    try
                    {
                        toolTip += "Bắt đầu: " + DateTime.Parse(grvContests.GetRowValues(e.VisibleIndex, "StartTime").ToString()).ToString("HH:mm, dd/MM/yyyy") + Environment.NewLine + Environment.NewLine;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (grvContests.GetRowValues(e.VisibleIndex, "EndTime") != null)
                {
                    try
                    {
                        toolTip += "Kết thúc: " + DateTime.Parse(grvContests.GetRowValues(e.VisibleIndex, "EndTime").ToString()).ToString("HH:mm, dd/MM/yyyy") + Environment.NewLine + Environment.NewLine;
                    }
                    catch (Exception)
                    {
                    }
                }


                if (e.DataColumn.FieldName == "StartTime" || e.DataColumn.FieldName == "EndTime")
                {
                    try
                    {
                        DateTime dt = DateTime.Parse(e.CellValue.ToString());
                        e.Cell.Text = CDateTime.getTimeNoti(dt);
                    }
                    catch
                    {
                    }
                }
                e.Cell.ToolTip = toolTip;
            }
        }
Example #2
0
 protected void grvData_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
 {
     // if (e.DataColumn.FieldName == "Date")
     if (e.CellValue != null)
     {
         string toolTip = Environment.NewLine +
                          "Người gửi: " + grvData.GetRowValues(e.VisibleIndex, "NameCreatedBy").ToString() + Environment.NewLine + Environment.NewLine +
                          "Nội dung: " + grvData.GetRowValues(e.VisibleIndex, "Content").ToString() + Environment.NewLine + Environment.NewLine +
                          "Ngày giờ: " + DateTime.Parse(grvData.GetRowValues(e.VisibleIndex, "Date").ToString()).ToString("HH:mm, dd/MM/yyyy") + Environment.NewLine + Environment.NewLine;
         e.Cell.ToolTip = toolTip;
     }
     if (e.DataColumn.FieldName == "Date")
     {
         if (e.CellValue != null)
         {
             e.Cell.Text = CDateTime.getTimeNoti(DateTime.Parse(e.CellValue.ToString()));
         }
     }
 }
Example #3
0
        protected void grvData_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
        {
            //if (e.DataColumn.FieldName == "Description")
            if (e.CellValue != null)
            {
                string toolTip = Environment.NewLine +
                                 "Mô tả: " + grvData.GetRowValues(e.VisibleIndex, "Description").ToString() + Environment.NewLine + Environment.NewLine +
                                 "Tạo bởi " + grvData.GetRowValues(e.VisibleIndex, "FullName").ToString() + Environment.NewLine + Environment.NewLine +
                                 "Sửa gần đây nhất: " + DateTime.Parse(grvData.GetRowValues(e.VisibleIndex, "ModifiedOn").ToString()).ToString("dd/MM/yyyy") + Environment.NewLine + Environment.NewLine;

                if (rblFilter.SelectedIndex != 2)
                { //chưa được duyệt không thể nhìn thấy password
                    toolTip += "Mật khẩu   : " + grvData.GetRowValues(e.VisibleIndex, "ContestPassword").ToString() + Environment.NewLine;
                }

                try
                {
                    if (grvData.GetRowValues(e.VisibleIndex, "StartTime") != null)
                    {
                        toolTip += "Bắt đầu: " + DateTime.Parse(grvData.GetRowValues(e.VisibleIndex, "StartTime").ToString()).ToString("HH:mm, dd/MM/yyyy") + Environment.NewLine + Environment.NewLine;
                    }
                    if (grvData.GetRowValues(e.VisibleIndex, "EndTime") != null)
                    {
                        toolTip += "Kết thúc: " + DateTime.Parse(grvData.GetRowValues(e.VisibleIndex, "EndTime").ToString()).ToString("HH:mm, dd/MM/yyyy") + Environment.NewLine + Environment.NewLine;
                    }
                }
                catch (Exception)
                {
                }
                if (e.DataColumn.FieldName == "StartTime" || e.DataColumn.FieldName == "EndTime")
                {
                    try
                    {
                        DateTime dt = DateTime.Parse(e.CellValue.ToString());
                        e.Cell.Text = CDateTime.getTimeNoti(dt);
                    }
                    catch
                    {
                    }
                }
                //+ e.CellValue.ToString();
                e.Cell.ToolTip = toolTip;
                // e.Cell.Visible = false;

                try
                {
                    if (e.DataColumn.FieldName == "ContestId")
                    {
                        if (rblFilter.SelectedIndex == 2) // chưa phê duyệt thì k được xem
                        {
                            e.Cell.Enabled = false;
                        }


                        else if (rblFilter.SelectedIndex == 1) // đã phê duyệt mà hết hạn cũng không được tham gia
                        {
                            DateTime startTime = DateTime.Parse(grvData.GetRowValues(e.VisibleIndex, "StartTime").ToString());
                            DateTime endTime   = DateTime.Parse(grvData.GetRowValues(e.VisibleIndex, "EndTime").ToString());
                            DateTime now       = DateTime.Now;
                            if (now > endTime || now < startTime)
                            {
                                e.Cell.Enabled = false;
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }