private void getApptData()
        {
            try
            {
                AppointmentService.ApptAPIService local = new AppointmentService.ApptAPIService();
                local.Url = serviceUtil.getPpolURL() + "/cxf/ApptAPI";

                appointmentOptions = local.getApptOptions(serviceUtil.getPpolAccount(), serviceUtil.getUserName(), serviceUtil.getPassword());
                if (appointmentOptions != null)
                {
                    appointmentCategory   = appointmentOptions.apptCategoryList;
                    appointmentImportance = appointmentOptions.apptImportanceList;
                    appointmentStatus     = appointmentOptions.apptStatusList;
                    appointmentType       = appointmentOptions.apptTypeList;



                    if (appointmentCategory != null)
                    {
                        this.cbCategory.Items.Add("");
                        for (int i = 0; i < appointmentCategory.Length; i++)
                        {
                            AppointmentService.apptCategory category = appointmentCategory[i];
                            this.cbCategory.Items.Add(category.name);
                        }
                    }
                    if (appointmentImportance != null)
                    {
                        this.cbImportance.Items.Add("");
                        for (int i = 0; i < appointmentImportance.Length; i++)
                        {
                            AppointmentService.apptImportance importance = appointmentImportance[i];
                            this.cbImportance.Items.Add(importance.name);
                        }
                    }
                    if (appointmentStatus != null)
                    {
                        this.cbStatus.Items.Add("");
                        for (int i = 0; i < appointmentStatus.Length; i++)
                        {
                            AppointmentService.apptStatus status = appointmentStatus[i];
                            this.cbStatus.Items.Add(status.name);
                        }
                    }
                    if (appointmentType != null)
                    {
                        this.cbType.Items.Add("");
                        for (int i = 0; i < appointmentType.Length; i++)
                        {
                            AppointmentService.apptType type = appointmentType[i];
                            this.cbType.Items.Add(type.name);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ClassFactory.Instance.ConnectionProblem(ex);
            }
        }
        private void btnTransfer_Click(object sender, EventArgs e)
        {
            try
            {
                AppointmentService.ApptAPIService local = new AppointmentService.ApptAPIService();
                local.Url = serviceUtil.getPpolURL() + "/cxf/ApptAPI";



                if (this.txtName.Text.Trim() == "")
                {
                    MessageBox.Show("Appointment name is a required field.");
                    txtName.Focus();
                }

                else if (this.cbHour.SelectedIndex < 1)
                {
                    MessageBox.Show("Appointment start time is a required field.");
                    this.cbHour.Focus();
                }
                else if (this.cbDuration.SelectedIndex < 1)
                {
                    MessageBox.Show("Appointment duration is a required field.");
                    this.cbDuration.Focus();
                }
                else
                {
                    int durationIndex   = cbDuration.SelectedIndex;
                    int hourIndex       = cbHour.SelectedIndex;
                    int minuteIndex     = cbMinute.SelectedIndex;
                    int typeIndex       = cbType.SelectedIndex;
                    int importanceIndex = cbImportance.SelectedIndex;
                    int statusIndex     = cbStatus.SelectedIndex;
                    int categoryIndex   = cbCategory.SelectedIndex;

                    string startDate = this.dtpStart.Value.Month.ToString() + "/" + this.dtpStart.Value.Day.ToString() + "/" + this.dtpStart.Value.Year;
                    string desc      = this.rtbDetail.Text;
                    string name      = this.txtName.Text;
                    AppointmentService.appointment appt = new AppointmentService.appointment();
                    appt.apptName  = name;
                    appt.apptDesc  = desc;
                    appt.apptDate  = startDate;
                    appt.startTime = hourValue[hourIndex] + ":" + minutesValue[minuteIndex];
                    appt.duration  = (string)durationValue[durationIndex];
                    if (typeIndex < 1)
                    {
                        appt.evtType = "";
                    }
                    else
                    {
                        appt.evtType = this.appointmentType[typeIndex - 1].key;
                    }
                    if (importanceIndex < 1)
                    {
                        appt.evtImportance = "";
                    }
                    else
                    {
                        appt.evtImportance = this.appointmentImportance[importanceIndex - 1].key;
                    }
                    if (statusIndex < 1)
                    {
                        appt.evtStatus = "";
                    }
                    else
                    {
                        appt.evtStatus = this.appointmentStatus[statusIndex].key;
                    }
                    if (categoryIndex < 1)
                    {
                        appt.evtCategory = "";
                    }
                    else
                    {
                        appt.evtCategory = this.appointmentCategory[categoryIndex - 1].key;
                    }

                    if (this.chkPrivate.Checked)
                    {
                        appt.apptPrivate = "Y";
                    }
                    else
                    {
                        appt.apptPrivate = "N";
                    }
                    AppointmentService.appointment appt1 = local.transferEmailAsAppointment(serviceUtil.getPpolAccount(), serviceUtil.getUserName(), serviceUtil.getPassword(), appt);

                    MessageBox.Show("Email was transferred to an appointment '" + appt1.apptName + "' successfully.");

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ClassFactory.Instance.ConnectionProblem(ex);
            }
        }