示例#1
0
        private void timeEditBoSungVao_Properties_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            /* 1. xác định CIO nào đang chọn để lấy thời gian vào hoặc ra
             * 2. trường hợp đặc biệt thỏa các điều kiện :
             *    - đang chọn 1 row, chọn ca tự do, chế độ nhập bổ sung thì tự động thêm
             */
            if (e.Button.Kind == ButtonPredefines.Search)
            {
                fmDSCa formDSCa = new fmDSCa();
                formDSCa.ShowDialog();
                if (formDSCa.m_YesNoCancel == YesNoCancel.Yes)
                {
                    cCa      selectedCa = formDSCa.selectedCa;
                    TimeSpan timeVao, timeRaa;
                    this.GetThoigianVaoraCa(selectedCa, out timeVao, out timeRaa);
                    int[] selectingRowHandle = gridView1.GetSelectedRows();
                    if ((TimeEdit)sender == timeEditBoSungVao || (TimeEdit)sender == timeEditBoSungRaa)
                    {
                        if (selectingRowHandle.Count() == 1 && selectedCa.ID < 0)
                        {
                            cCheckInOut selectingCheckInOut = (gridView1.GetDataRow(selectingRowHandle[0]) != null)
                                                                                                ? (cCheckInOut)(gridView1.GetDataRow(selectingRowHandle[0])["cCheckInOut"]) : null;
                            if (selectingCheckInOut == null)
                            {
                                goto point1;
                            }
                            if (selectingCheckInOut.HaveINOUT == -1)
                            {
                                timeVao = TimeSpan.Zero;
                                DateTime dateTimeVao = (selectingCheckInOut.Vao.Time.Add(selectedCa.WorkingTimeTS));
                                timeRaa = dateTimeVao.TimeOfDay;
                            }
                            else if (selectingCheckInOut.HaveINOUT == -2)
                            {
                                timeRaa = TimeSpan.Zero;
                                DateTime dateTimeRaa = (selectingCheckInOut.Raa.Time.Add(-selectedCa.WorkingTimeTS));
                                timeVao = dateTimeRaa.TimeOfDay;
                            }
                        }
point1:
                        timeEditBoSungVao.Time = DateTime.Today.Date.Add(timeVao);
                        timeEditBoSungRaa.Time = DateTime.Today.Date.Add(timeRaa);
                    }
                    else if ((TimeEdit)sender == timeEditSuaVao || (TimeEdit)sender == timeEditSuaRaa)
                    {
                        timeEditSuaVao.Time = DateTime.Today.Date.Add(timeVao);
                        timeEditSuaRaa.Time = DateTime.Today.Date.Add(timeRaa);
                    }
                }
            }
        }
示例#2
0
        private void test01ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmDSCa frm1      = new fmDSCa();
            int    indexForm = LayVitriForm(this, frm1.GetType());

            if (indexForm != -1)
            {
                frm1 = MdiChildren[indexForm] as fmDSCa;
                if (frm1 != null)
                {
                    frm1.BringToFront();
                }
            }
            else
            {
                frm1.MdiParent   = this;
                frm1.WindowState = FormWindowState.Normal;
                frm1.Show();
            }
        }
        private void btnChonCa_Properties_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            if (e.Button.Kind != ButtonPredefines.Search)
            {
                return;                                                       // không phải bấm button chọn ca thì thoát
            }

            /* thực hiện xử lý
             * 1. xác định ca được
             */
            fmDSCa formDSCa = new fmDSCa();

            formDSCa.ShowDialog();
            if (formDSCa.m_YesNoCancel == YesNoCancel.Yes)
            {
                cCa selectedCa = formDSCa.selectedCa;
                btnChonCa.Tag  = selectedCa;
                btnChonCa.Text = selectedCa.Code;
                m_DaChonCaKhac = true;
            }
        }