Sunday, May 3, 2015

Open PDF Document with URL

 ShowModal: function (content, title, command, showCancel) {
        ///<summary>
        ///     Used to Create ModelPopup for messges
        ///</summary>
        /// <param name="content" optional="true" type="String">
        ///     Used to show the content in the modal window
        /// </param>
        /// <param name="title" optional="true" type="String">
        ///     Used to Show the title for modal window
        /// </param>
        /// <param name="command" optional="true" type="String">
        ///     Which Operation need to perform after the OK button click
        /// </param>
        /// <param name="showCancel" optional="true" type="Bool">
        ///      determins need to show cancel button or not
        /// </param>
        if (showCancel) {
            $("#MSGBox").html(content).dialog({
                modal: true,
                title: title,
                resizable: false,
                beforeClose: function () {
                },
                buttons: {
                    OK: function () {
                        $(this).dialog("close");
                        if (typeof ModalOk == 'function') { // if any more function want to done in the ok click, please add the ModalOk function in page
                            ModalOk(command); // command used to identifies the which action perfomed eg: save,delete,..
                        }

                    },
                    Cancel: function () {
                        $(this).dialog("close");
                    }
                }
            });
        }
        else {
            $("#MSGBox").html(content).dialog({
                modal: true,
                title: title,
                resizable: false,
                beforeClose: function () {
                    if (typeof ModalOk == 'function') { // if any more function want to done in the ok click, please add the ModalOk function in page
                        ModalOk(command); // command used to identifies the which action perfomed eg: save,delete,..
                    }
                },
                buttons: {
                    OK: function () {
                        $(this).dialog("close");
                    }

                }
            });
        }

    },

function OpenPDF(url) {
    if (url != "") {
        var win = window.open(url, '_blank', 'location=no,menubar=no,scrollbars=yes,titlebar=no,toolbar=no,width=1200,height=800,left=100,top=0');
        if (!win) {
            var eMsg = "<span><ul><li>" + errorMessage + ' ' + window.location.host + "</li></ul></span>";
            ERPScriptUtils.ShowModal(eMsg, errorTitle);
            $("#MSGBox").addClass("error");
        }
        return false;
    }
}
function GetPDFUrl(url) {
    if (url != "") {
        var winurl = "window.open('" + url + "', '_blank', 'location=no,menubar=no,scrollbars=yes,titlebar=no,toolbar=no,width=1200,height=800,left=100,top=0');return false;";
        return winurl;
    }
    else
        return "";
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...