Exemple #1
0
        private async void DateControl2()
        {
            ScheduleEntity se = new ScheduleEntity()
            {
                id   = cf.userID,
                date = CDateTime.GetDateTimeFormat(DateTime.Now, "yyyymmdd")
            };

            var result3 = Task.Run(() => new CallWebApi().CallPostApiSchedules("scheduleFind", se));

            Schedule scheduleList = JsonConvert.DeserializeObject <Schedule>(await result3);

            cf.scheduleList = new List <AppointmentBusinessObject>();

            foreach (ScheduleEntity _item in scheduleList.scheduleList)
            {
                AppointmentBusinessObject newObject = new AppointmentBusinessObject();
                newObject.Subject = _item.subject;
                newObject.Start   = CDateTime.GetDateFrom_yyyyMMddHHmmss(_item.start);
                newObject.End     = CDateTime.GetDateFrom_yyyyMMddHHmmss(_item.end);
                newObject.Body    = _item.body;

                cf.scheduleList.Add(newObject);
            }
        }
Exemple #2
0
        private void PART_DialogSaveButton_Click(object sender, RoutedEventArgs e)
        {
            SetAppointment();

            var _app = _appointment;

            ScheduleEntity se = new ScheduleEntity()
            {
                id      = cf.userID,
                subject = _app.Subject,
                date    = CDateTime.GetDateTimeFormat(_app.Start, "yyyymmdd"),
                start   = CDateTime.GetDateTimeFormat(_app.Start, "yyyymmddhhnnss"),
                end     = CDateTime.GetDateTimeFormat(_app.End, "yyyymmddhhnnss"),
                body    = _app.Body,
                _id     = _hidid.Text
            };

            //데이터 재 취득 (반환처리로 하지 않으면 비동기식으로 처리되어 리스트를 먼저 가져올 수 있다.)
            var rtn = DateControl(se);

            //데이터 재 취득
            if (rtn != null)
            {
                DateControl2();
            }

            if (_parentWindow is Window)
            {
                _parentWindow.Tag = "true";

                ((Window)_parentWindow).Close();
            }
            else
            {
                ((C1Window)_parentWindow).DialogResult = MessageBoxResult.OK;
            }
        }
Exemple #3
0
        //타이머 처리
        private void DispatcherTimer_Tick(object sender, EventArgs e)
        {
            ClientConfig cf = InitSetting.CConf;

            if (cf.workStatus == null)
            {
                cf.workStatus = "0";
            }

            string format   = "yyyy년 MM월 dd일";
            string _strDate = DateTime.Now.ToString(format);

            format = " HH시 mm분 ss초";
            string _strTime = DateTime.Now.ToString(format);

            labDate.Content = _strDate;
            labTime.Content = _strTime;
            var sb = new StringBuilder();

            //일정알림처리 (근무시일경우만)
            if (cf.autoAlarm.Equals("0") && cf.workStatus.Equals("1"))
            {
                if (cf.scheduleList != null)
                {
                    foreach (var _item in cf.scheduleList)
                    {
                        TimeSpan ts = _item.Start - DateTime.Now.AddMinutes(5);

                        if (ts.TotalSeconds < 0 && ts.TotalSeconds > -1)
                        {
                            sb.Append(CDateTime.GetDateTimeFormat(_item.Start, "yyyy-mm-dd hh:nn:ss"))
                            .Append(" ")
                            .Append(_item.Subject)
                            .Append("[")
                            .Append(_item.Body)
                            .Append("] ")
                            .Append(" 5분전입니다");


                            _vm2.ShowWarning(sb.ToString());
                        }
                    }
                }
            }

            //09시가 되었는데 근무가 처리 안되었을 경우 (월~금)
            //60초동안 클릭을 안할 경우 출근안함으로 처리
            //cf.status => 1: 근무 , 0:퇴근
            if (!(DateTime.Now.DayOfWeek.Equals(DayOfWeek.Saturday) && DateTime.Now.DayOfWeek.Equals(DayOfWeek.Sunday)))
            {
                if (DateTime.Now.ToString("HHmmss").Equals("090000") &&
                    cf.workStatus.Equals("0"))
                {
                    var result = System.Windows.Forms.AutoClosingMessageBox.Show(
                        text: "9시입니다. 근무를 시작하시겠습니까?",
                        caption: "근무설정",
                        timeout: 60000,
                        buttons: System.Windows.Forms.MessageBoxButtons.YesNo,
                        defaultResult: System.Windows.Forms.DialogResult.No);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        //기본파일 등록처리
                        string[] param = new string[2];
                        param[0]             = DateTime.Now.ToString("yyyyMMdd") + "090000";
                        param[1]             = string.Empty;
                        cf.workStartLastTime = param[0];
                        cf.workEndLastTime   = "";

                        cf.workStatus = "1";

                        InitSetting.ConfigWriteProfile(param, 1);

                        _uc_dashboard = new uc_DashBoard();
                        uc_Class.Uc_Link(Contents_Border, _uc_dashboard);
                        btn_DashBoard.Focus();
                    }
                }
                //18시가 되었을 때 퇴근알림 처리
                else if (DateTime.Now.ToString("HHmmss").Equals("180000") &&
                         cf.workStatus.Equals("1"))
                {
                    var result = System.Windows.Forms.AutoClosingMessageBox.Show(
                        text: "18시입니다. 퇴근 하시겠습니까?",
                        caption: "근무설정",
                        timeout: 60000,
                        buttons: System.Windows.Forms.MessageBoxButtons.YesNo,
                        defaultResult: System.Windows.Forms.DialogResult.No);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        string[] param = new string[1];
                        param[0] = DateTime.Now.ToString("yyyyMMdd") + "180000";

                        cf.workEndLastTime = param[0];
                        InitSetting.ConfigWriteProfile(param, 2);

                        //데이터베이스 등록처리
                        DateTime sdt = CDateTime.GetDateFrom_yyyyMMddHHmmss(cf.workStartLastTime);
                        DateTime edt = CDateTime.GetDateFrom_yyyyMMddHHmmss(cf.workEndLastTime);

                        String workDate = CDateTime.GetDateFrom_yyyyMMddHHmmss(cf.workStartLastTime).ToString("yyyyMMdd");

                        String _sDateTime = sdt.ToString("yyyyMMdd") + sdt.TimeOfDay.ToString().Replace(":", "");
                        String _eDateTime = edt.ToString("yyyyMMdd") + edt.TimeOfDay.ToString().Replace(":", "");

                        int sTime = Int32.Parse(sdt.TimeOfDay.ToString().Replace(":", "").Substring(0, 4) + "00");
                        int eTime = Int32.Parse(edt.TimeOfDay.ToString().Replace(":", "").Substring(0, 4) + "00");

                        //데이터베이스 등록처리
                        regWorkData(workDate, _sDateTime, _eDateTime, sTime, eTime);
                    }
                }
                else if (DateTime.Now.ToString("HHmmss").Equals("093000") || DateTime.Now.ToString("HHmmss").Equals("133000") &&
                         cf.workStatus.Equals("1"))
                {
                    _vm.ShowInformation("오전 9시30분에서 11시30분 / 오후 13시30분 ~ 오후 17시30분은 업무 집중시간입니다.");
                }

                //if(cf.workStatus.Equals("1") && Int32.Parse(DateTime.Now.ToString("HHmmss")) > 183000)
                //{
                //    if(DateTime.Now.ToString("mmss").Equals("0000")) {
                //        _vm.ShowInformation("현재 연장근무중입니다. 업무 빨리 하시고 퇴근하세요.");
                //    }
                //}
            }
        }
Exemple #4
0
        private async void showDashBoard()
        {
            try
            {
                WorkEntity we = new WorkEntity()
                {
                    id = cf.userID
                };

                String result   = await new CallWebApi().CallPostApiWorks("workInfoFind", we);
                Works  workList = JsonConvert.DeserializeObject <Works>(result);

                IEnumerable <WorkEntity> totalOverTimeSum = workList.workList
                                                            .Where(w => w.status.Equals("1"))
                                                            .GroupBy(g => g.id)
                                                            .Select(s => new WorkEntity
                {
                    workOver = s.Sum(x => x.workOver)
                });

                if (totalOverTimeSum != null)
                {
                    foreach (WorkEntity _sums in totalOverTimeSum)
                    {
                        lb_totalOverTime.Content = (_sums.workOver / 60).ToString() + "시간 " + (_sums.workOver % 60) + "분";
                    }
                }

                var _targerWorkList = workList.workList
                                      .Where(w => Int32.Parse(w.workDate) >= Int32.Parse(sDate.Content.ToString())
                                             &&
                                             Int32.Parse(w.workDate) <= Int32.Parse(eDate.Content.ToString())
                                             &&
                                             w.status.Equals("1")
                                             ).ToList <WorkEntity>();


                int _totalWorkTime = 0;
                int _totlaOverTime = 0;
                for (int i = 0; i < _targerWorkList.Count; i++)
                {
                    WorkEntity item = _targerWorkList[i];

                    _totalWorkTime += item.workHour;
                    _totlaOverTime += item.workOver;
                }

                _totlaOverTime       = 720 - _totlaOverTime;
                leftOverTime.Content = (_totlaOverTime / 60).ToString() + "시간 " + (_totlaOverTime % 60) + "분";

                lb_workTime.Content = "누적근무시간 : " + (_totalWorkTime / 60).ToString() + "시간 " + (_totalWorkTime % 60) + "분";

                workChart.Value = Math.Round(((double)_totalWorkTime / (52 * 60)) * 100);

                ScheduleEntity se = new ScheduleEntity()
                {
                    id   = cf.userID,
                    date = CDateTime.GetDateTimeFormat(DateTime.Now, "yyyymmdd")
                };

                var result3 = Task.Run(() => new CallWebApi().CallPostApiSchedules("scheduleFind", se));

                Schedule scheduleList = JsonConvert.DeserializeObject <Schedule>(await result3);
                cf.scheduleList = new List <AppointmentBusinessObject>();

                foreach (ScheduleEntity _item in scheduleList.scheduleList)
                {
                    AppointmentBusinessObject newObject = new AppointmentBusinessObject();
                    newObject.Subject = _item.subject;
                    newObject.Start   = CDateTime.GetDateFrom_yyyyMMddHHmmss(_item.start);
                    newObject.End     = CDateTime.GetDateFrom_yyyyMMddHHmmss(_item.end);
                    newObject.Body    = _item.body;

                    cf.scheduleList.Add(newObject);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("관리자에게 문의 부탁드립니다.");
                _vm.ShowError("관리자에게 문의 부탁드립니다.");
            }
        }