Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. $.ajax({
  2. url: "test.aspx/Start",
  3. datatype: "json",
  4. cache: false,
  5. async: true,
  6. contentType: "application/json; charset=utf-8",
  7. method: "POST",
  8. data: JSON.stringify({ "HTMLString": str }),
  9. success: function (data) {
  10. if (data.d.length > 0) {
  11. ShowMessage(data.d, "error");
  12. }
  13. }
  14.  
  15. }); return false;
  16.  
  17. [System.Web.Services.WebMethod]
  18. [System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
  19. public static string Start(string HTMLString)
  20. {
  21. bool IsInstalled = Handlers.CheckDirectumIsInstalled();
  22. string result = "";
  23. if (IsInstalled)
  24. {
  25. string filePath = Path.GetTempPath() + "\" + fileName;
  26. // Создадим документ в темп пользователя
  27. Handlers.ConvertToPDF(html, filePath, true);
  28.  
  29. // Подключаемся к СЭД
  30. string AppProgId = "SBLogon.LoginPoint";
  31. Type LoginPointType = Type.GetTypeFromProgID(AppProgId);
  32. dynamic LoginPoint = Activator.CreateInstance(LoginPointType);
  33. dynamic App = LoginPoint.GetApplication("ServerName=STEST;
  34. DBName=DBTEST;
  35. UserName=;Password=");
  36. dynamic Src = App.ScriptFactory.GetObjectByName("test");
  37. Src.Params.SetVar("document", filePath);
  38. Src.Execute();
  39. }
  40. else
  41. {
  42. result = "не установлено ПО...";
  43. }
  44.  
  45.  
  46. return result;
  47.  
  48. }
  49.  
  50. ExceptionType: "System.Runtime.InteropServices.COMException"
  51. Message: "Вход в систему не произведен"
  52. StackTrace:" at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32
  53. hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)
  54. ↵ at CallSite.Target(Closure , CallSite , ComObject , String )
  55. ↵ at CallSite.Target(Closure , CallSite , Object , String )
  56. ↵ at SpecodInfo.Test.Start(String HTMLString)
  57.  
  58. dynamic App = LoginPoint.GetApplication("ServerName=STEST;
  59. DBName=DBTEST;
  60. UserName=;Password=");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement