Ejemplo n.º 1
0
        private void SetPageControl(ContainerAppointment obj)
        {
            if (obj.PageInfo == null)
            {
                obj.PageInfo = new Pagination();
            }

            if (obj.PageInfo.PAGE == 1)
            {
                btnFirst.Enabled    = false;
                btnPrevious.Enabled = false;
            }
            else
            {
                btnFirst.Enabled    = true;
                btnPrevious.Enabled = true;
            }

            if (obj.PageInfo.PAGE >= obj.PageInfo.TOTAL_PAGE)
            {
                btnLast.Enabled = false;
                btnNext.Enabled = false;
            }
            else
            {
                btnLast.Enabled = true;
                btnNext.Enabled = true;
            }

            txtPage.Text = "หน้า : " + obj.PageInfo.PAGE.ToString() + "/" + obj.PageInfo.TOTAL_PAGE.ToString();
        }
Ejemplo n.º 2
0
        private void gridAppointmentList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                if (e.ColumnIndex == 0 && gridAppointmentList.Rows[e.RowIndex].Cells["STATUS"].Value.ToString() != "เข้าพบแล้ว")
                {
                    var id = Convert.ToInt32(gridAppointmentList.Rows[e.RowIndex].Cells["AUTO_ID"].Value);
                    ContainerAppointment container = new ContainerAppointment();
                    var         filter             = new AppointmentFilter();
                    TRN_VISITOR visitorObj         = new TRN_VISITOR();
                    filter.AUTO_ID   = id;
                    container.Filter = filter;
                    var obj = _service.GetItem(container);
                    visitorObj.CONTACT_EMPLOYEE_ID = obj.TRN_APPOINTMENT.CONTACT_EMPLOYEE_ID;
                    visitorObj.FIRST_NAME          = obj.TRN_APPOINTMENT.REQUEST_FIRST_NAME;
                    visitorObj.LAST_NAME           = obj.TRN_APPOINTMENT.REQUEST_LAST_NAME;
                    visitorObj.ID_CARD             = obj.TRN_APPOINTMENT.REQUEST_ID_CARD;
                    visitorObj.REASON_ID           = obj.TRN_APPOINTMENT.REASON_ID;
                    visitorObj.MAS_EMPLOYEE        = obj.TRN_APPOINTMENT.MAS_EMPLOYEE;
                    visitorObj.MAS_REASON          = obj.TRN_APPOINTMENT.MAS_REASON;
                    frmVisitor frm = new frmVisitor();
                    frm.visitorObj  = visitorObj;
                    frm.formMode    = FormMode.Add;
                    frm.visitorMode = VisitorMode.Appointment;

                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        var res = _service.UpdateStatus(id);
                        if (res.Status)
                        {
                            //MessageBox.Show(Message.MSG_SAVE_COMPLETE, "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            ResetScreen();
                        }
                        else
                        {
                            MessageBox.Show(res.ExceptionMessage, "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }

                    //var res = _service.UpdateStatus(id);
                    //if (res.Status)
                    //{
                    //    MessageBox.Show(Message.MSG_SAVE_COMPLETE, "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //    ResetScreen();
                    //}
                    //else
                    //{
                    //    MessageBox.Show(res.ExceptionMessage, "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //}
                }
            }
        }
Ejemplo n.º 3
0
        private void BindGridData()
        {
            var filter = new AppointmentFilter()
            {
                ID_CARD       = txtIDCard.Text,
                FIRST_NAME    = txtName.Text,
                LAST_NAME     = txtLastName.Text,
                LICENSE_PLATE = txtLicense.Text,
            };

            if (chkDate.Checked)
            {
                filter.CONTACT_DATE = dtContactDate.Value;
            }

            _container.Filter = filter;
            _container        = _service.Retrieve(_container);
            SetDataSourceHeader(gridAppointmentList, ListHeader(), _container.ResultObj);
            SetPageControl(_container);
        }
Ejemplo n.º 4
0
        private void Save()
        {
            var obj = new TRN_APPOINTMENT();

            obj = GetObjectFromControl();
            obj.CONTACT_DATE = dtContactDate.Value.Date + dtTime.Value.TimeOfDay;

            var container = new ContainerAppointment {
                TRN_APPOINTMENT = obj
            };

            var res = _service.Create(container);

            if (res.Status)
            {
                MessageBox.Show(Message.MSG_SAVE_COMPLETE, "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show(res.Message + res.ExceptionMessage);
            }
        }