Exemplo n.º 1
0
        private async void Btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateForm())
                {
                    if (CrossConnectivity.Current.IsConnected)
                    {
                        CustomProgressDialog.ShowProgDialog(mActivity,
                                                            GetString(Resource.String.saving_message));


                        AddCalendarEventsAPIParams addEventsParam = new AddCalendarEventsAPIParams
                        {
                            entryId        = (!isAddEvent) ? (eventObj.EntryId) : "0",
                            compCode       = "84451",
                            accCode        = "1718904",
                            notesTypeId    = _selectedCalendarTypeItem.EXTRA_TEXT,
                            entryTypeId    = 0,
                            startDate      = txt_start_date_val.Text + " " + txt_start_time_val.Text,
                            endDate        = txt_end_date_val.Text + " " + txt_end_time_val.Text,
                            subject        = txt_subject_val.Text,
                            details        = txt_description_val.Text,
                            assignedTo     = _selectedUsersItem.EXTRA_TEXT,
                            summaryItemId  = "999999999",
                            isCompleted    = false,
                            isPublic       = false,
                            accountId      = "216",
                            connectionName = WebserviceConstants.CONNECTION_NAME
                        };

                        bool isUpdated = await WebServiceMethods.AddCalendarEvents(addEventsParam);

                        CustomProgressDialog.HideProgressDialog();

                        CallBackScreen();
                    }
                    else
                    {
                        UtilityDroid.GetInstance().ShowAlertDialog(mActivity,
                                                                   Resources.GetString(Resource.String.error_alert_title),
                                                                   Resources.GetString(Resource.String.alert_message_no_network_connection),
                                                                   Resources.GetString(Resource.String.alert_cancel_btn), Resources.GetString(Resource.String.alert_ok_btn));
                    }
                }
                else
                {
                    UtilityDroid.GetInstance().ShowAlertDialog(mActivity,
                                                               Resources.GetString(Resource.String.error_alert_title),
                                                               Resources.GetString(Resource.String.alert_message_fill_all_Details),
                                                               Resources.GetString(Resource.String.alert_cancel_btn),
                                                               Resources.GetString(Resource.String.alert_ok_btn));
                }
            }
            catch (Exception ex)
            {
                CustomProgressDialog.HideProgressDialog();
            }
        }
Exemplo n.º 2
0
        async void AddCalendarEvent()
        {
            if (IosUtils.IosUtility.IsReachable())
            {
                IosUtils.IosUtility.showProgressHud("");
                try
                {
                    AddCalendarEventsAPIParams prams = new AddCalendarEventsAPIParams()
                    {
                        subject        = IBSubjectTxt.Text,
                        details        = IBDetailsTxt.Text,
                        startDate      = StartDate.ToString(Utils.Utilities.CALENDAR_DATE_FORMAT),
                        endDate        = EndDate.ToString(Utils.Utilities.CALENDAR_DATE_FORMAT),
                        entryId        = (isEdit) ? (Event.EntryId) : "0",
                        compCode       = "84451",
                        accCode        = "1718904",
                        notesTypeId    = SelectedType.NotesTypeId.ToString(),
                        entryTypeId    = 0,
                        assignedTo     = selectedUser.UserID.ToString(),
                        summaryItemId  = "999999999",
                        isCompleted    = false,
                        isPublic       = false,
                        accountId      = "216",
                        connectionName = WebserviceConstants.CONNECTION_NAME
                    };

                    var res = await WebServiceMethods.AddCalendarEvents(prams);

                    IosUtils.IosUtility.hideProgressHud();
                    if (res)
                    {
                        this.NavigationController.PopViewController(true);
                    }
                    else
                    {
                        IosUtils.IosUtility.showAlertWithInfo(IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSErrorTitle", "LSErrorTitle"),
                                                              IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSUnknownError", "LSErrorTitle"));
                    }
                }
                catch (Exception e)
                {
                    IosUtils.IosUtility.hideProgressHud();
                    IosUtils.IosUtility.showAlertWithInfo(IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSErrorTitle", "LSErrorTitle"),
                                                          e.Message);
                }
            }
        }