Esempio 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));


                        AddNotesAPIParams addNotesParam = new AddNotesAPIParams
                        {
                            entityCode      = _selectedCurrentEntitysItem.EXTRA_TEXT,
                            accountCode     = _selectedAccountCodeItem.SECOND_EXTRA_TEXT,
                            notesHeader     = txt_notes_header_val.Text,
                            notesDetail     = txt_notes_val.Text,
                            notesDetail_Add = "",
                            userId          = Convert.ToInt32(mSharedPreferencesManager.GetString(
                                                                  ConstantsDroid.USER_ID_PREFERENCE, "")),
                            actionTypeId   = 3,
                            sendTo         = "",
                            privacyId      = Convert.ToInt32(privacyId),
                            accountId      = Convert.ToInt32(_selectedAccountCodeItem.EXTRA_TEXT),
                            notesId        = Convert.ToInt32((!isAddNote) ? (noteObj.NotesId) : "0"),
                            connectionName = WebserviceConstants.CONNECTION_NAME
                        };

                        int notesId = await WebServiceMethods.AddCrmNotes(addNotesParam);

                        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();
            }
        }
Esempio n. 2
0
        async Task SaveNotes()
        {
            if (IosUtils.IosUtility.IsReachable())
            {
                IosUtils.IosUtility.showProgressHud("");
                try
                {
                    AddNotesAPIParams prams = new AddNotesAPIParams()
                    {
                        entityCode      = EntityCode.CompCode,
                        accountCode     = AccountCode.AccountCode,
                        accountId       = Convert.ToInt32(AccountCode.AccountId),
                        notesDetail     = IBNotesDetailsTxt.Text,
                        notesHeader     = IBNotesHeaderTxt.Text,
                        privacyId       = Convert.ToInt32(privacy),
                        connectionName  = WebserviceConstants.CONNECTION_NAME,
                        userId          = Convert.ToInt32(Settings.UserId),
                        notesId         = Convert.ToInt32(notes != null ? notes.NotesId : "0"),
                        notesDetail_Add = "",
                        sendTo          = "",
                        actionTypeId    = 3
                    };

                    var res = await WebServiceMethods.AddCrmNotes(prams);

                    IosUtils.IosUtility.hideProgressHud();
                    if (res == 1)
                    {
                        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);
                }
            }
        }