Example #1
0
        //在线打卡
        public ActionResult CardOnline()
        {
            EmpBasicInfo ebi = Session["ebi"] as EmpBasicInfo;
            var rdto = new ResultMessages();
            EmpDepPosition empDepPosition = ebi.EmpDepPos.First();
            Depts depts = empDepPosition.Depts;
            if (",18,19,22,25,".IndexOf("," + empDepPosition.DeptId + ",") >= 0 || depts.Pid == 24 || depts.Pid == 39 || depts.Pid ==27)
            {
                string jobNo = ctx.Employees.Single(r => r.Id == ebi.Id).JobNo;
                var obj = new CardLog();
                obj.JobNo = jobNo;
                obj.CardTime = DateTime.Now;
                obj.SysDate = DateTime.Now;
                obj.OperateId = ebi.Id;
                obj.Ip = Request.ServerVariables["REMOTE_ADDR"];
                ctx.CardLogs.InsertOnSubmit(obj);

                try
                {
                    ctx.SubmitChanges();
                    rdto.Result = true;
                    rdto.Message =DateTime.Now.ToString("HH:mm:ss");
                }
                catch (Exception ex)
                {
                    rdto.Result = false;
                    rdto.Message =ex.Message;
                }
            }
            else
            {
                rdto.Result = false;
                rdto.Message = "您没有权限在线打卡,请联系'行政部'或'技术部'确认!";
            }
            return Json(rdto);
        }
		private void detach_CardLogs(CardLog entity)
		{
			this.SendPropertyChanging();
			entity.Employee = null;
		}
		private void attach_CardLogs(CardLog entity)
		{
			this.SendPropertyChanging();
			entity.Employee = this;
		}
 partial void DeleteCardLog(CardLog instance);
 partial void UpdateCardLog(CardLog instance);
 partial void InsertCardLog(CardLog instance);