根据存储过程返回值启用/禁用按钮

时间:2015-03-03 06:36:49

标签: asp.net

.aspx页面中有2个按钮; Time In&超时。在页面加载中,基于用户执行的最后一个操作,我想启用/禁用该按钮。我在表中检查用户是否已经进入或超时进入。如果定时,则过程返回0,如果超时,则返回1。如果他/她有一段时间,那么应该禁用该特定用户的第二天。只有超时应该处于启用模式。如何实现这一目标?

在页面加载中,我有以下代码,用于显示用户的相应按钮。

        string userId = string.Empty;
        if (Session["UserId"] != null)
            userId = Session["UserId"].ToString();

        byte status = GetLatestCheckInOutStatusByUser(userId);

        if (status == 0)
        {
            OutButton.ImageUrl = @"~/Styles/Images/ClockOut.PNG";
            InButton.ImageUrl = @"~/Styles/Images/ClockInFade.PNG";
            //InButton.Enabled = false;
            //OutButton.Enabled = true;


        }
        else if (status == 1)
        {
            InButton.ImageUrl = @"~/Styles/Images/ClockIn.JPG";            
            OutButton.ImageUrl = @"~/Styles/Images/ClockOutFade.PNG";
            //InButton.Enabled = true;
            //OutButton.Enabled = false;
        }

0 个答案:

没有答案
相关问题