Exemple #1
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);
                    //}
                }
            }
        }
        private void id_card_Click(object sender, EventArgs e)
        {
            frmVisitor frm = new frmVisitor();

            frm.StartPosition = FormStartPosition.CenterParent;
            frm.formMode      = FormMode.Add;
            frm.visitorMode   = VisitorMode.In;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
        private void VisitorSelected_EventHadler(object sender, EventArgs e)
        {
            var        Id  = Convert.ToInt32(((Control)sender).Tag.ToString());
            var        obj = _service.GetVisitorByAutoID(Id);
            frmVisitor frm = new frmVisitor();

            frm.visitorObj  = obj.TRN_VISITOR;
            frm.formMode    = FormMode.Add;
            frm.visitorMode = VisitorMode.Regulary;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }