Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool flgApplyEdit;

                flgApplyEdit = AppointmentManager.Save(objAppoint, currentUser);

                if (flgApplyEdit)
                {
                    /// Commented Temporarily to clear error when internet is not available.

                    if (objAppoint.IsNew)
                    {
                        GetSMSRespons();
                    }
                    // instance the event args and pass it value
                    AppointUpdateEventArgs args = new AppointUpdateEventArgs(objAppoint.DBID, objAppoint.EntryNo, objAppoint.EntryDate, objAppoint.AppointmentNo, objAppoint.Name, objAppoint.AppointmentDate, objAppoint.ScheduleTime);

                    // raise event wtth  updated
                    if (Entry_DataChanged != null)
                    {
                        if (this.IsNew)
                        {
                            Entry_DataChanged(this, args, DataEventType.INSERT_EVENT);
                        }
                        else
                        {
                            Entry_DataChanged(this, args, DataEventType.UPDATE_EVENT);
                        }
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Record Not Saved.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Close();
            }
        }
Пример #2
0
        private void Entry_DataChanged(object sender, AppointUpdateEventArgs e, DataEventType Action)
        {
            ListViewItem lvItem;

            switch (Action)
            {
            case DataEventType.INSERT_EVENT:

                lvItem      = new ListViewItem();
                lvItem.Name = Convert.ToString(e.DBID);
                lvItem.Text = Convert.ToString(e.EntryNo);
                lvItem.SubItems.Add(e.EntryDate.ToShortDateString());
                lvItem.SubItems.Add(Convert.ToString(e.AppointmentNo));
                lvItem.SubItems.Add(e.Name);
                lvItem.SubItems.Add(e.AppointmentDate.ToShortDateString());
                lvItem.SubItems.Add(e.SchTime.ToShortTimeString());

                lvwAppoints.Items.Add(lvItem);
                lvwAppoints.EnsureVisible(lvItem.Index);

                break;

            case DataEventType.UPDATE_EVENT:
                lvItem                  = lvwAppoints.Items[lvwAppoints.SelectedItems[0].Index];
                lvItem.Text             = Convert.ToString(e.EntryNo);
                lvItem.SubItems[1].Text = e.EntryDate.ToShortDateString();
                lvItem.SubItems[2].Text = Convert.ToString(e.AppointmentNo);
                lvItem.SubItems[3].Text = e.Name;
                lvItem.SubItems[4].Text = e.AppointmentDate.ToShortDateString();
                lvItem.SubItems[5].Text = e.SchTime.ToShortTimeString();

                lvwAppoints.Items[lvItem.Index].Selected = true;
                lvwAppoints.EnsureVisible(lvwAppoints.SelectedItems[0].Index);

                break;
            }
        }
Пример #3
0
        private void cancelAppointmentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (objUIRights.ModifyRight)
                {
                    Appointment objApmt;
                    objApmt           = AppointmentManager.GetItem(Convert.ToInt32(lvwAppoints.SelectedItems[0].Name));
                    objApmt.ApmtClose = true;

                    bool flgApplyEdit;
                    flgApplyEdit = AppointmentManager.Save(objApmt, objCurUser);
                    if (flgApplyEdit)
                    {
                        // instance the event args and pass it value
                        AppointUpdateEventArgs args = new AppointUpdateEventArgs(objApmt.DBID, objApmt.EntryNo, objApmt.EntryDate, objApmt.AppointmentNo, objApmt.Name, objApmt.AppointmentDate, objApmt.ScheduleTime);

                        // raise event wtth  updated
                        Entry_DataChanged(this, args, DataEventType.UPDATE_EVENT);
                    }
                    else
                    {
                        MessageBox.Show("Record Not Saved.");
                    }
                    FillList(cboAppointmentNo.Text, cboName.Text);
                }
                else
                {
                    throw new Exception("Not Authorised.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }