Exemplo n.º 1
0
        /// <summary>
        /// Bind cac hinh anh tuong ung voi tung trang thai cua tai khoan nguoi dung
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grvStoreUser_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                vUserAccount user = (vUserAccount)e.Row.DataItem;
                if (user != null)
                {
                    ImageButton imbBlock = (ImageButton)e.Row.FindControl("imbBlock");

                    if (user.IsDisabled.HasValue && user.IsDisabled.Value)
                    {
                        Literal ltrBlockInfo = (Literal)e.Row.FindControl("ltrBlockInfo");
                        ltrBlockInfo.Text = "Khoá từ: " + user.DisabledTime.Value.ToString("dd/MM/yyyy");
                        e.Row.BackColor   = System.Drawing.Color.Yellow;
                        e.Row.ToolTip     = "Tài khoản đang tạm khoá";
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Bind cac hinh anh tuong ung voi tung trang thai cua tai khoan nguoi dung
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grvManageUsers_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton imbActivated       = (ImageButton)e.Row.FindControl("imbActivated");
                ImageButton imbPermanentDelete = (ImageButton)e.Row.FindControl("imbPermanentDelete");
                ImageButton imbDelete          = (ImageButton)e.Row.FindControl("imbDelete");
                ImageButton imbRecover         = (ImageButton)e.Row.FindControl("imbRecover");

                Image imgEdit      = (Image)e.Row.FindControl("imgEdit");
                Image imgResetPass = (Image)e.Row.FindControl("imgResetPass");

                vUserAccount user = (vUserAccount)e.Row.DataItem;
                if (user != null)
                {
                    if (e.Row.RowIndex != grvManageUsers.EditIndex)
                    {
                        ImageButton imbBlock = (ImageButton)e.Row.FindControl("imbBlock");

                        if (user.IsDisabled.HasValue && user.IsDisabled.Value)
                        {
                            imbBlock.ImageUrl = "~/images/lock.png";
                            Literal ltrBlockInfo = (Literal)e.Row.FindControl("ltrBlockInfo");
                            //ltrBlockInfo.Text = "Khoá từ: " + user.BlockedTime.Value.ToString("dd/MM/yyyy");
                            ltrBlockInfo.Text = "Đang tạm khóa";
                            e.Row.BackColor   = System.Drawing.Color.Yellow;
                            e.Row.ToolTip     = "Tài khoản đang tạm khoá";
                        }
                        else
                        {
                            imbBlock.ImageUrl = "~/images/tip.png";
                        }
                    }
                }
            }
        }