public ActivityLog(employee e, hrEntities dbContext) : this()
        {
            this.dbContext = dbContext;
            var query =
                from l in dbContext.logs
                where l.employee_id == e.id
                select new { l.time, l.change_type, l.field_name, l.old_value, l.new_value };

            EmployeeActivityDataGrid.ItemsSource = query.ToList();
        }
        public UpdateEmployee(employee currEmployee, hrEntities dbContext) : this()
        {
            this.currentEmployee = currEmployee;
            this.dbContext       = dbContext;

            var positionNames = from pos in dbContext.positions
                                select pos.name;

            positionComboBox.ItemsSource = positionNames.ToList();

            var departmentNames = from dept in dbContext.departments
                                  select dept.name;

            departmentComboBox.ItemsSource = departmentNames.ToList();

            var managerNames = from em in dbContext.employees
                               where em.position_id == 2 && em.position.name == "Manager"
                               select em.name + " - " + em.id;

            managerComboBox.ItemsSource = managerNames.ToList();

            nameTextBox.Text              = currEmployee.name;
            addressTextBox.Text           = currEmployee.address;
            emailTextBox.Text             = currEmployee.email;
            phoneTextBox.Text             = currEmployee.phone;
            employmentStatusComboBox.Text = currEmployee.employment_status;
            positionComboBox.Text         = currEmployee.position.name;
            departmentComboBox.Text       = currEmployee.department.name;
            shiftComboBox.Text            = currEmployee.shift;
            startDatePicker.SelectedDate  = currEmployee.start_date;
            endDatePicker.SelectedDate    = currEmployee.end_date;
            favoriteColorTextBox.Text     = currEmployee.favorite_color;
            if (currEmployee.manager_id.HasValue)
            {
                oldManagerName = (from em in dbContext.employees
                                  where em.id == currEmployee.manager_id
                                  select em.name).First();
                managerComboBox.Text = managerEntryFormat(oldManagerName, currEmployee.manager_id.Value);
            }
        }
Example #3
0
File: Form1.cs Project: jjg0519/OA
        public void GetAttendRecord()
        {
            try {
                if (clientAtt == null)
                {
                    clientAtt = new AttendRecordImportHelper.AttendanceWS.AttendanceServiceClient();
                }

                DateTime From = new DateTime();
                DateTime To   = new DateTime();
                DateTime.TryParse(dtFrom.Text, out From);
                DateTime.TryParse(dtTo.Text, out To);

                entTempList.Clear();

                using (hrEntities db = new hrEntities())
                {
                    var data = from ent in db.kqjl
                               where ent.checktime >= From &&
                               ent.checktime <= To
                               select ent;
                    foreach (var item in data)
                    {
                        T_HR_EMPLOYEECLOCKINRECORD entTemp = new T_HR_EMPLOYEECLOCKINRECORD();
                        entTemp.CLOCKINRECORDID = System.Guid.NewGuid().ToString().ToUpper();
                        entTemp.FINGERPRINTID   = item.badgenumber;
                        entTemp.CLOCKID         = item.machine_sn.ToString();
                        entTemp.PUNCHDATE       = item.checktime;
                        entTemp.PUNCHTIME       = item.checktime.Value.Hour.ToString() + ":" + item.checktime.Value.Minute.ToString();
                        entTempList.Add(entTemp);
                    }
                }
            }catch (Exception ex)
            {
                Tracer.Debug("导入打卡记录失败,失败原因为:" + ex.ToString());
            }
        }
Example #4
0
        public void ImportRdHuNanHangXing()
        {
            DateTime dtCur = DateTime.Now;

            if (dtCur.Hour != Convert.ToInt32(ConfigurationManager.AppSettings["ElapsedHour"]))
            {
                Tracer.Debug(DateTime.Now.ToString() + ",导入打卡记录未在指定时间内");
                return;
            }
            Tracer.Debug(DateTime.Now.ToString() + ",开始导入打卡记录,设置的导入时间点为每天:" + strElapsedHour + " 点,导入的端口为:"
                         + iPort);
            if (clientAtt == null)
            {
                clientAtt = new AttendanceServiceClient();
            }
            List <T_HR_EMPLOYEECLOCKINRECORD> entTempList = new List <T_HR_EMPLOYEECLOCKINRECORD>();

            DateTime dtFrom = new DateTime();
            DateTime dtTo   = new DateTime();

            DateTime.TryParse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), out dtFrom);
            dtTo = dtFrom.AddDays(1).AddSeconds(-1);
            entTempList.Clear();
            using (hrEntities db = new hrEntities())
            {
                var data = from ent in db.kqjl
                           where ent.checktime >= dtFrom &&
                           ent.checktime < dtTo
                           select ent;
                foreach (var item in data)
                {
                    T_HR_EMPLOYEECLOCKINRECORD entTemp = new T_HR_EMPLOYEECLOCKINRECORD();
                    entTemp.CLOCKINRECORDID = System.Guid.NewGuid().ToString().ToUpper();
                    entTemp.FINGERPRINTID   = item.badgenumber;
                    entTemp.CLOCKID         = item.machine_sn.ToString();
                    entTemp.PUNCHDATE       = item.checktime;
                    entTemp.PUNCHTIME       = item.checktime.Value.Hour.ToString() + ":" + item.checktime.Value.Minute.ToString();
                    entTempList.Add(entTemp);
                }
            }
            try
            {
                Tracer.Debug("航信获取打卡记录成功,下载记录数:" + entTempList.Count());
                string   strMsg     = string.Empty;
                string[] companyIds = ConfigurationManager.AppSettings["HangXingcompanyID"].Split(',');
                foreach (var strCompanyId in companyIds)
                {
                    if (TestMode == "true")
                    {
                        foreach (var ent in entTempList)
                        {
                            Tracer.Debug("员工指纹编码:" + ent.FINGERPRINTID + " 打卡时间:" + ent.PUNCHDATE + ":" + ent.PUNCHTIME);
                        }
                    }
                    else
                    {
                        string strCurIP = "数据库读取";

                        clientAtt.ImportClockInRdListByWSRealTime(strCompanyId, entTempList.ToArray(), dtFrom, dtTo, strCurIP, ref strMsg);
                    }
                    Tracer.Debug("导入打卡记录成功,导入的公司ID为:" + strCompanyId);
                }
            }
            catch (Exception ex)
            {
                Tracer.Debug("航信导入打卡记录失败,失败原因为:" + ex.ToString());
            }
        }