Esempio n. 1
0
        /// <summary>
        /// 根据员工编号查询其所有的打卡记录
        /// </summary>
        /// <param name="wid"></param>
        /// <returns></returns>
        public static List <WorkerCheck> SelectCheckInfoByWorkerNo(string wid)
        {
            List <WorkerCheck> workerChecks = new List <WorkerCheck>();
            string             sql          = "select * from WorkerCheck where WorkerNo = '" + wid + "'";

            DBHelper.Opencon();
            MySqlDataReader dr = DBHelper.ExecuteReader(sql);

            while (dr.Read())
            {
                WorkerCheck workerCheck = new WorkerCheck();
                workerCheck.WorkerNo  = dr["WorkerNo"].ToString();
                workerCheck.CheckTime = (DateTime)dr["CheckTime"];
                workerCheck.CheckWay  = dr["CheckWay"].ToString();
                if (Convert.ToInt32(dr["CheckState"]) == 0)
                {
                    workerCheck.CheckState = "打卡成功";
                }
                else
                {
                    workerCheck.CheckState = "打卡失败";
                }
                workerChecks.Add(workerCheck);
            }
            dr.Close();
            DBHelper.Closecon();
            return(workerChecks);
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            int n = Convert.ToInt32(new WorkerCheckService().SelectToDayCheckInfoByWorkerNo(LoginInfo.WorkerNo));

            if (n > 0)
            {
                linkLabel1.Text      = "已打卡";
                linkLabel1.ForeColor = Color.Green;
                linkLabel1.LinkColor = Color.Green;
                pnlCheckInfo.Visible = true;
                lblCheckDay.Text     = Convert.ToString(new WorkerCheckService().SelectWorkerCheckDaySumByWorkerNo(LoginInfo.WorkerNo));
            }
            else
            {
                linkLabel1.Text      = "未打卡";
                linkLabel1.ForeColor = Color.Red;
                linkLabel1.LinkColor = Color.Red;
                DialogResult dr = MessageBox.Show("你今天还未打卡哦,请先打卡吧!", "打卡提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (dr == DialogResult.OK)
                {
                    WorkerCheck workerCheck = new WorkerCheck
                    {
                        WorkerNo  = LoginInfo.WorkerNo,
                        CheckWay  = "系统界面",
                        CheckTime = DateTime.Parse(GetNetDateTime())
                    };
                    bool j = new WorkerCheckService().AddCheckInfo(workerCheck);
                    if (j == true)
                    {
                        lblCheckDay.Text = Convert.ToString(new WorkerCheckService().SelectWorkerCheckDaySumByWorkerNo(LoginInfo.WorkerNo));
                        MessageBox.Show("打卡成功!你已累计打卡" + lblCheckDay.Text + "天,再接再厉吧!", "打卡提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        linkLabel1.Text      = "已打卡";
                        linkLabel1.ForeColor = Color.Green;
                        linkLabel1.LinkColor = Color.Green;
                        pnlCheckInfo.Visible = true;
                    }
                    else
                    {
                        MessageBox.Show("服务器错误,请稍后再试!");
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 添加员工打卡数据
 /// </summary>
 /// <param name="workerCheck"></param>
 /// <returns></returns>
 public static int AddCheckInfo(WorkerCheck workerCheck)
 {
     return(WorkerCheckService.AddCheckInfo(workerCheck));
 }
Esempio n. 4
0
        /// <summary>
        /// 添加员工打卡数据
        /// </summary>
        /// <param name="workerCheck"></param>
        /// <returns></returns>
        public static int AddCheckInfo(WorkerCheck workerCheck)
        {
            string sql = "insert into WORKERCHECK values('" + workerCheck.WorkerNo + "','" + workerCheck.CheckTime + "','" + workerCheck.CheckWay + "','0')";

            return(DBHelper.ExecuteNonQuery(sql));
        }
 public bool AddCheckInfo([FromBody] WorkerCheck workerCheck)
 {
     return(new WorkerCheckService().AddCheckInfo(workerCheck));
 }