Exemple #1
0
 public LoadCheck(List <Dept> depts, attContent dc, GetDeptNameDelgate _GetDeptName)
 {
     InitializeComponent();
     Depts       = depts;
     Dc          = dc;
     GetDeptName = _GetDeptName;
 }
Exemple #2
0
        /// <summary>
        /// 写入数据库
        /// </summary>
        public void FastWriteToDate(attContent dc)
        {
            List <CHECKINOUT> newlist = new List <CHECKINOUT>();

            ///删除考勤
            if (Checks.Count > 0)
            {
                var df1 = GetEmpChecks.Where(p => p.FirstCheck != null).OrderBy(p => p.CheckDate).FirstOrDefault();
                var dl2 = GetEmpChecks.Where(p => p.FirstCheck != null).OrderBy(p => p.CheckDate).LastOrDefault();
                if (df1 != null & dl2 != null)
                {
                    var d1 = df1.FirstCheck.Value;
                    if (df1.PreCheckDay != null && df1.PreCheckDay.ShiftName != df1.ShiftName)
                    {
                        d1 = (df1.PreCheckDay.CheckDate + df1.PreCheckDay.EmpShift.EndTime).AddMinutes(10);
                    }
                    var d2  = dl2.LastCheck.Value;
                    var cd1 = Checks.OrderBy(p => p.CHECKTIME).First();
                    if (d1 != cd1.CHECKTIME)
                    {
                        if (cd1.Memoinfo == null)
                        {
                            d1 = cd1.CHECKTIME;
                        }
                    }
                    ;
                    string delstr = string.Format("delete checkinout where userid={0} and checktime>='{1}' and checktime<='{2}';", Emp.USERID, d1.AddMinutes(-1), d2.AddMinutes(1));
                    if (delstr != "")
                    {
                        dc.Database.ExecuteSqlCommand(delstr);
                    }
                }
            }

            //添加考勤
            EmpChecks.ForEach(p =>
            {
                if (p.NewChecks.Count > 0)
                {
                    if (p.NewChecks.Count > 0)
                    {
                        newlist.AddRange(p.NewChecks);
                    }
                }
            });


            //去重
            newlist.ForEach(p =>
            {
                if (newlist.Count(n => n.CHECKTIME == p.CHECKTIME) > 0)
                {
                    p.CHECKTIME.AddSeconds(3);
                }
            });
            var l = new HashSet <CHECKINOUT>(newlist);

            EFBatchOperation.For(dc, dc.CHECKINOUT).InsertAll(l);
        }
Exemple #3
0
 public DeptOper(attContent sd)
 {
     Sd = sd;
     sd.DEPARTMENTS.ToList().ForEach(p =>
     {
         Dept d = new Dept
         {
             DeptId   = p.DEPTID,
             DeptName = p.DEPTNAME,
             UpDptId  = p.SUPDEPTID
         };
         Depts.Add(d);
     });
 }
Exemple #4
0
 /// <summary>
 /// 写入数据库
 /// </summary>
 public void WriteToDate(attContent dc, bool IsAllWriteMode)
 {
     EmpChecks.ForEach(p =>
     {
         if (p.NewChecks.Count > 0)
         {
             dc.CHECKINOUT.RemoveRange(p.Checks);
             if (p.NewChecks.Count > 0)
             {
                 dc.CHECKINOUT.AddRange(p.NewChecks);
             }
         }
     });
     dc.SaveChanges();
 }
Exemple #5
0
 private void ToolStripButton1_Click(object sender, EventArgs e)
 {
     if (!IsConnect)
     {
         string dbcon = tool_con.Text;
         if (dbcon != "")
         {
             dc         = new attContent(dbcon);
             dc.ConName = dbcon;
             Doper      = new DeptOper(dc);
             ReadShift();
             toolStripButton1.Text = "关闭连接";
             IsConnect             = true;
         }
         else
         {
             MessageBox.Show("请选择数据库连接!");
         }
     }
     else
     {
         dc.Dispose();
         textBox2.Text         = "";
         lc                    = null;
         Doper                 = null;
         toolStripButton1.Text = "连接数据库";
         IsConnect             = false;
         empCheckMonthBindingSource.DataSource = null;
         empCheckDayBindingSource.DataSource   = null;
         shiftBindingSource.DataSource         = null;
     }
     tool_con.Enabled      = !IsConnect;
     tabControl1.Enabled   = IsConnect;
     btn_LoadData.Enabled  = IsConnect;
     btn_SyncCheck.Enabled = IsConnect;
     modeselect.Enabled    = IsConnect;
     BtnWriteToDb.Enabled  = IsConnect;
 }
Exemple #6
0
 public AttControlClass(attContent con)
 {
     holidays = con.HOLIDAYS.ToList();
     Con      = con;
 }
Exemple #7
0
 public CheckAutoDelete(attContent _ac, List <Shift> shifts)
 {
     ac          = _ac;
     this.shifts = shifts;
 }
Exemple #8
0
 public CheckDelete(attContent _ac)
 {
     ac = _ac;
 }
Exemple #9
0
 public CheckSync(attContent _cdb, DateTime _begindate, DateTime _enddate)
 {
     this.begindate = _begindate;
     this.enddate   = _enddate;
     cdb            = _cdb;
 }