コード例 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            signState signstate = new signState();
            MSignState objsignstate = new MSignState();
            bool blS;
            bool blX;
            DataTable dt = signstate.SelectAllSignState();
            if (dt.Rows.Count > 0)
            {
                objsignstate.ID = 1;
                objsignstate.Time = Convert.ToDateTime(TextBox1.Text.Trim());
                blS = signstate.UpdateSignStateByID(objsignstate);
                objsignstate.ID = 2;
                objsignstate.Time = Convert.ToDateTime(TextBox2.Text.Trim());
                blX = signstate.UpdateSignStateByID(objsignstate);

                if (blS && blX)
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置成功!');</script>");
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置失败!');</script>");
                }
            }
            else
            {
                objsignstate.Signstate_describe = "上班";
                objsignstate.Time = Convert.ToDateTime(TextBox1.Text.Trim());
                blS = signstate.InsertIntoSignState(objsignstate);
                objsignstate.Signstate_describe = "下班";
                objsignstate.Time = Convert.ToDateTime(TextBox2.Text.Trim());
                blX = signstate.InsertIntoSignState(objsignstate);

                if (blS && blX)
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置成功!');</script>");
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置失败!');</script>");
                }
            }
        }
コード例 #2
0
ファイル: SignIn.aspx.cs プロジェクト: wangchuncheng211/OAS
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginName"] == null)
            {
                //Response.Write("<script>this.parent.location.href='../Default.aspx'</script>");
                Response.Redirect("~/Default.aspx");
                return;
            }
            lblSTime.Text = DateTime.Now.ToString("HH:mm:ss");   //注意大小写
            lblXTime.Text = DateTime.Now.ToString("HH:mm:ss");

            signState signstate = new signState();

            DataTable dt = signstate.SelectAllSignState();
            DataRow[] row = dt.Select("SignStateID=1");
            foreach (DataRow rs in row)
            {
                Label1.Text = "上班时间:" + Convert.ToDateTime(rs["time"]).ToString("HH:mm:ss");
                up = Convert.ToDateTime(rs["time"]).ToString("HH:mm:ss");
            }
            DataRow[] rw = dt.Select("SignStateID=2");
            foreach (DataRow rs1 in rw)
            {
                Label2.Text = "下班时间:" + Convert.ToDateTime(rs1["time"]).ToString("HH:mm:ss");
                down = Convert.ToDateTime(rs1["time"]).ToString("HH:mm:ss");
            }
            if (Request.QueryString["id"].ToString() == "1")
                btnSignOut.Enabled = false;
            else
                btnSignIn.Enabled = false;
        }