Example #1
0
    //签退
    protected void SignOut_Click(object sender, EventArgs e)
    {
        int count = ManualSignManager.GetManualSignState(false, (Session["Login"] as User).UserId);

        if (count < 1)
        {
            ManualSign ms = Save(1);
            if (ms != null)
            {
                divExit.Visible = true;
                //直接进行相应的按钮显隐藏就行了;  不用再调用判断的InitInterface方法了;
                this.btnSignOut.Enabled = false;
                this.btnSignIn.Enabled  = true;
            }
        }
    }
Example #2
0
    //签到
    protected void SignIn_Click(object sender, EventArgs e)
    {
        int count = ManualSignManager.GetManualSignState(true, (Session["Login"] as User).UserId);

        if (count < 1)
        {
            ManualSign ms = Save(0);
            if (ms != null)
            {
                divExit.Visible = true;
                //直接进行相应的按钮显隐藏就行了;  不用再调用判断的InitInterface方法了;
                this.btnSignIn.Enabled  = false;
                this.btnSignOut.Enabled = true;
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "key", "alert('您今天已经签过到了!签到信息如下:')", true);
            //调用判断的InitInterface方法了;
            InitInterface();
        }
    }
Example #3
0
    protected void InitInterface()
    {
        txtSignTime.Text = DateTime.Now.ToShortDateString();
        // txtSignDesc.Text = "";
        User u = Session["Login"] as User;

        //是否已经当天签退
        if (ManualSignManager.GetManualSignState(false, u.UserId) == 1)
        {
            btnSignIn.Enabled  = true;
            btnSignOut.Enabled = false;
        }//是否已签到
        else if (ManualSignManager.GetManualSignState(true, u.UserId) == 1)
        {
            btnSignIn.Enabled  = false;
            btnSignOut.Enabled = true;
        }
        else
        {
            btnSignIn.Enabled  = true;
            btnSignOut.Enabled = false;
        }

        if (Session["Login"] != null)
        {
            IList <ManualSign> msList =
                ManualSignManager.
                SearchManualSignByCondition
                    (string.Format("{0:yyyy-MM-dd 0:00:00}", DateTime.Now), string.Format("{0:yyyy-MM-dd 23:59:59}",
                                                                                          DateTime.Now), null, u.DepartId.ToString(), u.UserId, null);
            if (msList.Count > 0)
            {
                FillManual(0, msList[0]);
                divExit.Visible = true;
            }
        }
    }