protected override void EntityFieldInit() { if (!V4IsPostBack) { id = Request.QueryString["id"]; idDoc = Request.QueryString["idDoc"]; idParentPage = Request.QueryString["idpp"]; resultGuid = Request.QueryString["idResult"]; ParentPage = KescoHub.GetPage(idParentPage) as Nakladnaya; if (ParentPage == null) { ShowMessage(Resx.GetString("errRetrievingPageObject"), Resx.GetString("errPrinting"), MessageStatus.Error); return; } if (Request.QueryString["sf"] != null) { efShipperStore.Value = Request.QueryString["sf"].Length == 0 ? "0" : Request.QueryString["sf"]; } if (Request.QueryString["st"] != null) { efPayerStore.Value = Request.QueryString["st"].Length == 0 ? "0" : Request.QueryString["st"]; } } base.EntityFieldInit(); }
/// <summary> /// инициализация контролов /// </summary> protected override void EntityFieldInit() { if (!V4IsPostBack) { id = Request.QueryString["id"]; idDoc = Request.QueryString["idDoc"]; idParentPage = Request.QueryString["idpp"]; ue = Request.QueryString["ue"]; ParentPage = KescoHub.GetPage(idParentPage) as DocPage; if (ParentPage == null) { ShowMessage(Resx.GetString("errRetrievingPageObject"), Resx.GetString("errPrinting"), MessageStatus.Error); return; } if (!string.IsNullOrEmpty(id) && id != "0") { factUsl = new FactUsl(id); //factUsl = GetObjectById(typeof(FactUsl), id) as FactUsl; if (factUsl == null || factUsl.Id == "0") { throw new LogicalException(Resx.GetString("TTN_ ERRMoveStockInitialized"), "", Assembly.GetExecutingAssembly().GetName(), Priority.Info); } } else { factUsl = new FactUsl { DocumentId = int.Parse(idDoc) }; RenderAgent1(); RenderAgent2(); efChanged.ChangedByID = null; } SetInitValue(); } Entity = factUsl; efResource.BindStringValue = factUsl.ResourceIdBind; efResourceRus.BindStringValue = factUsl.ResourceRusBind; chAgent1.BindStringValue = factUsl.Agent1Bind; chAgent2.BindStringValue = factUsl.Agent2Bind; efResourceLat.BindStringValue = factUsl.ResourceLatBind; efUnit.BindStringValue = factUsl.UnitIdBind; efCount.BindStringValue = factUsl.CountBind; efMCoef.BindStringValue = factUsl.CoefBind; efCostOutNDS.BindStringValue = factUsl.CostOutNDSBind; efStavkaNDS.BindStringValue = factUsl.StavkaNDSIdBind; efSummaOutNDS.BindStringValue = factUsl.SummaOutNDSBind; efSummaNDS.BindStringValue = factUsl.SummaNDSBind; efVsego.BindStringValue = factUsl.VsegoBind; base.EntityFieldInit(); }
/// <summary> /// Возвращает экземпляр интерфейса <see cref="T:System.Web.IHttpHandler" /> для обработки требуемого ресурса. /// </summary> /// <returns> /// Новый обработчик <see cref="T:System.Web.IHttpHandler" />, обрабатывающий запрос; в противном случае — null. /// </returns> /// <param name="context"> /// Экземпляр класса <see cref="T:System.Web.HttpContext" />, который предоставляет ссылки на /// внутренние объекты сервера (например, Запрос, Ответ. Сеанс и Сервер), используемые для обслуживания HTTP-запросов. /// </param> /// <param name="requestType">Метод http для передачи данных (GET или POST), используемый клиентом.</param> /// <param name="virtualPath">Виртуальный путь к требуемому ресурсу.</param> /// <param name="path">Свойство <see cref="P:System.Web.HttpRequest.PhysicalApplicationPath" /> требуемого ресурса.</param> public override IHttpHandler GetHandler(HttpContext context, string requestType, string virtualPath, string path) { if (context != null) { var idp = context.Request.QueryString["idp"]; if (!string.IsNullOrEmpty(idp)) { return((IHttpHandler)KescoHub.GetPage(idp)); } } return(base.GetHandler(context, requestType, virtualPath, path)); }
protected override void EntityFieldInit() { if (!V4IsPostBack) { id = Request.QueryString["id"]; idDoc = Request.QueryString["idDoc"]; idParentPage = Request.QueryString["idpp"]; typeNabor = Request.QueryString["type"]; TypeNabor = typeNabor == "Payer"; ParentPage = KescoHub.GetPage(idParentPage) as Nakladnaya; if (ParentPage == null) { ShowMessage(Resx.GetString("errRetrievingPageObject"), Resx.GetString("errPrinting"), MessageStatus.Error); return; } if (!String.IsNullOrEmpty(id) && id != "0") { mris = new Mris(id); CurrentDv = Convert.ToInt32(id); if (mris == null || mris.Id == "0") { throw new LogicalException(Resx.GetString("TTN_ ERRMoveStockInitialized"), "", System.Reflection.Assembly.GetExecutingAssembly().GetName(), Priority.Info); } } else { mris = new Mris { DocumentId = int.Parse(idDoc) }; } SetInitValue(); } Entity = mris; efShipperPayer.Value = TypeNabor ? ParentPage.PayerField.Value : ParentPage.ShipperField.Value; efResource.Value = mris.Resource.Id; efUnit.Value = mris.Unit.Id; efResidence.Value = TypeNabor ? mris.PayerStore.Residence.Id : mris.ShipperStore.Residence.Id; efStore.Value = TypeNabor ? mris.PayerStore.Id : mris.ShipperStore.Id; base.EntityFieldInit(); }
private void Print() { var idpage = Request.QueryString["idpage"]; if (string.IsNullOrEmpty(idpage)) { ShowMessage("Ошибка получения идентификатора страницы", "Ошибка печати", MessageStatus.Error); return; } var p = KescoHub.GetPage(idpage); if (p == null) { ShowMessage("Ошибка получения объекта страницы", "Ошибка печати", MessageStatus.Error); return; } _qsParams = ((Details)p)._qsParams; var w = new StringWriter(); w.Write( "<html><head><title>{0}</title><style>table {{border-collapse: collapse;}} table, td, th {{border: 1px solid black;}} .tdR{{text-align:right}} .tdC{{text-align:center}}</style></head><body onload=\"window.print()\">", Resx.GetString("lPrint")); w.Write("<h3>Детализированный отчёт по телефонным звонкам</h3>"); w.Write("<h4>Дата формирования: {0}</h4>", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " MSK"); w.Write(RenderTitle().ToString()); w.Write("<br/><br/>"); var gridDataPrint = ((Details)p).gridData; gridDataPrint.Settings.IsPrintVersion = true; gridDataPrint.RenderGridData(w); gridDataPrint.Settings.IsPrintVersion = false; w.Write("</body></html>"); PrintResponse = w.ToString(); }
public static void TimerElapsed(object sender, ElapsedEventArgs e) { KescoHub.RemovePagesWithOutConnection(); }
public void ProcessRequest(HttpContext context) { context.Response.CacheControl = "no-cache"; var appRoot = Page.GetWebAppRoot(); var cuser = new Employee(true); var w = context.Response; w.Write(Environment.NewLine); w.Write("<!DOCTYPE html>"); w.Write(Environment.NewLine); w.Write("<html>"); w.Write(Environment.NewLine); w.Write("<head>"); w.Write(Environment.NewLine); w.Write("<title>Активные соединения</title>"); w.Write(Environment.NewLine); w.Write("<meta http-equiv='X-UA-Compatible' content='IE=edge'/>"); w.Write(Environment.NewLine); w.Write($"<link href='{Config.styles_css}Kesco.css' rel='stylesheet' type='text/css'/>"); w.Write(Environment.NewLine); w.Write($"<script src='{Config.styles_js}jquery-1.12.4.min.js' type ='text/javascript'></script>"); w.Write(Environment.NewLine); w.Write( $"<script src='{Config.styles_js}jquery.signalR-2.4.1.min.js' type ='text/javascript'></script>"); w.Write(Environment.NewLine); w.Write($"<script src='{Config.styles_js}kesco.js' type ='text/javascript'></script>"); w.Write(Environment.NewLine); w.Write($"<script src='{appRoot}/signalr/hubs' type ='text/javascript'></script>"); w.Write(Environment.NewLine); w.Write(@"<script>"); w.Write(Environment.NewLine); w.Write($"var v4_userId = {cuser.Id}"); w.Write(Environment.NewLine); w.Write(@" var v4_kescoHub = null; var v4_tryingToReconnect = false; $(document).ready(function () { v4_kescoHub = $.connection.kescoSignalHub; registerClientMethods(); $.connection.hub.connectionSlow = function () { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Медленное подключение'); }; $.connection.hub.reconnecting(function() { v4_tryingToReconnect = true; //console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Восстановление соединения'); var msg = 'Связь с сервером потеряна!'; $('#divConnections').html('<strong>' + msg + '</strong>'); $('#divAllConnections').html(''); setTimeout(v4_brokenConnection, 15000); }); $.connection.hub.reconnected(function() { v4_tryingToReconnect = false; // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Соединение восстановлено'); location.href = location.href; }); $.connection.hub.disconnected(function() { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Подключение потеряно'); if ($.connection.hub.lastError) { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Ошибка:' + $.connection.hub.lastError.message); } if (!v4_tryingToReconnect) { setTimeout(function() { $.connection.hub.start().done(function() { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Попытка восстановления подключения'); }).fail(function() { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Ошибка при попытке восстановления подключения'); }); }, 10); } }); $.connection.hub.stateChanged = function() { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Изменение состояние подключения') }; // $.connection.hub.logging = true; $.connection.hub.start().done(function () { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Соединение установлено'); }).fail(function () { // console.log('[' + (new Date()).toLocaleTimeString() + '] KescoHub Ошибка установке соединения'); }); }); function registerClientMethods() { v4_kescoHub.client.onPageConnected = function () { v4_kescoHub.server.onPageRegistered('signalview','',v4_userId,'','','0','signalview_ashx', '', false,false); } v4_kescoHub.client.refreshActivePagesInfo = function (pages) { v4_refreshListActivePages(pages); } v4_kescoHub.client.refreshSignalViewInfo = function (info) { $('#divParamsInApp').html(info.CountPages); var trace = $('#divTrace').html(); if (trace.length > 4000) trace = ''; $('#divTrace').html(info.TraceInfo + trace); } } function v4_refreshListActivePages(pages){ var cnt = pages.length; $('#divAllConnections').html(""Всего активных соединений: "" + cnt); var tblConnections = ""<table class='grid'>""; tblConnections +=""<thead>""; tblConnections +=""<tr class='gridHeader'>""; tblConnections +=""<td>Транспорт</td>""; tblConnections +=""<td>Пользователь</td>""; tblConnections +=""<td>Идентификатор страницы</td>""; tblConnections +=""<td>Страница</td>""; tblConnections +=""<td>Код объекта</td>""; tblConnections +=""<td>Что делает</td>""; tblConnections +=""<td>Когда подключился</td>""; tblConnections +=""</tr>""; tblConnections +=""</thead>""; tblConnections +=""<tbody>""; $.each(pages, function() { tblConnections +=""<tr>""; tblConnections +=""<tr>""; tblConnections +=""<td>"" + this.TransportSignalR + ""</td>""; tblConnections +=""<td>"" + this.UserName + ""</td>""; tblConnections +=""<td>"" + this.PageId + ""</td>""; tblConnections +=""<td>"" + this.ItemName + ""</td>""; tblConnections +=""<td>"" + this.EntityId + ""</td>""; tblConnections +=""<td>"" + (this.IsEditable?""Редактирует"":""Просматривает"") + ""</td>""; tblConnections +=""<td>"" + Kesco.toLocalTime(this.StartTimeFormat) + ""</td>""; tblConnections +=""</tr>""; }); tblConnections +=""</tbody>""; if (cnt>0) { tblConnections += '</table>'; } else { tblConnections=""""; } $('#divConnections').html(tblConnections); } function v4_brokenConnection() { if (window.status == v4_signalStatus) { v4_tryingToReconnect = true; $.connection.hub.stop(); v4_hubImpossibleConnect(); } } "); w.Write(Environment.NewLine); w.Write("</script>"); w.Write(Environment.NewLine); w.Write("</head>"); w.Write(Environment.NewLine); w.Write("<body style=\"margin:8px;\">"); w.Write(Environment.NewLine); w.Write("<div id='divConnections'></div>"); w.Write("<div id='divAllConnections'></div>"); //######################################################################### var info = $"{DateTime.Now:dd.MM.yy HH:mm:ss} -> При загрузке получили актуальную информацию о состоянии KescoHub"; var cnt = KescoHub.GetAllPages().Count(); w.Write( $"<br/><div class=\"v4DivInline\">Страниц в KescoHub: </div><div class=\"v4DivInline\" id=\"divParamsInApp\">{cnt}</div>"); w.Write($"<div>Действия: </div><div id=\"divTrace\"><div>{info}</div></div>"); if (context.Application.AllKeys.Contains("Error")) { // эти ошибки ловятся в Global.asax в методе Application_Error w.Write("</br>"); w.Write("</br>"); w.Write("<div>В Application обнаружен объект ошибки:</div>"); var exObj = context.Application["Error"] as Exception; if (exObj != null) { w.Write(exObj.Message); w.Write(Environment.NewLine); w.Write(exObj.StackTrace); } } //######################################################################### w.Write(Environment.NewLine); w.Write("</body>"); w.Write(Environment.NewLine); w.Write("</html>"); }
protected void Print() { var idpage = Request.QueryString["idpage"]; if (!string.IsNullOrEmpty(idpage)) { var p = KescoHub.GetPage(idpage); if (p != null) { var dt = ((EmplDaysDetailsForm)p).SourceCash.GetSourceTable(!((EmplDaysDetailsForm)p) ._notDisplayEmpty); if (dt.Rows.Count > 0) { WrResponse = string.Format("<html><head><title>{0}</title></head><body onload=\"window.print()\">", Resx.GetString("lPrint")); WrResponse += "<b>" + Resx.GetString("hPageDetailsTitle") + "</b> (" + DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss") + ")"; WrResponse += "<div style=\"margin-top:10px;margin-bottom:10px;\"><b>" + ((EmplDaysDetailsForm)p).SourceCash.GetEmployeeName(IsRusLocal) + "</b></div>"; WrResponse += "<table style=\"border-collapse:collapse;\">"; WrResponse += string.Format( "<tr style=\"height: 25px; font-weight: bold; text-align: center;\"><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>", Resx.GetString("lblDate"), Resx.GetString("cStartTime"), Resx.GetString("cEndTime"), Resx.GetString("cInterval"), Resx.GetString("сAbsent")); foreach (DataRow row in dt.Rows) { string descr, start = "", end = "", work = "", notwork = ""; var isRedDay = ((EmplDaysDetailsForm)p).IsRedDay((DateTime)row["DAY_VALUE"], out descr); var dateValue = string.Format( "{0}(<font color=\"{2}\">{1}</font>) <font color=\"{2}\">{3}</font>", ((DateTime)row["DAY_VALUE"]).ToString("dd.MM.yyyy"), ((DateTime)row["DAY_VALUE"]).ToString("ddd", IsRusLocal ? new CultureInfo("ru-RU") : new CultureInfo("en-US")), isRedDay ? "#FF0000" : "#000000", descr); if (!string.IsNullOrEmpty(row[0].ToString())) { start = row[2].ToString(); end = row[3].ToString(); work = row[5].ToString() == "00:00:00" ? "" : row[5].ToString(); notwork = row[4].ToString() == "00:00:00" ? "" : row[4].ToString(); } WrResponse += "<tr>"; WrResponse += "<td style=\"border-bottom: darkgray 1px solid;border-right: darkgray 1px solid;\">" + dateValue + "</td>"; WrResponse += "<td style=\"text-align: center;border-bottom: darkgray 1px solid;border-right: darkgray 1px solid;\">" + start + "</td>"; WrResponse += "<td style=\"text-align: center;border-bottom: darkgray 1px solid;border-right: darkgray 1px solid;\">" + end + "</td>"; WrResponse += "<td style=\"text-align: center;border-bottom: darkgray 1px solid;border-right: darkgray 1px solid;\">" + work + "</td>"; WrResponse += "<td style=\"text-align: center;border-bottom: darkgray 1px solid;\">" + notwork + "</td>"; WrResponse += "</tr>"; } if (dt.Rows.Count > 1) { WrResponse += string.Format( "<tr><td colspan='3' align='right'><b>{0} </b></td><td align='center'><b>{1}:{2}:{3}</b></td><td align='center'><b>{4}:{5}:{6}</b></td></tr>", Resx.GetString("lTotal"), ((EmplDaysDetailsForm)p)._summaryWorkTime.Hours + ((EmplDaysDetailsForm)p)._summaryWorkTime.Days * 24, ((EmplDaysDetailsForm)p)._summaryWorkTime.Minutes.ToString("D2"), ((EmplDaysDetailsForm)p)._summaryWorkTime.Seconds.ToString("D2"), ((EmplDaysDetailsForm)p)._summaryAbsentTime.Hours + ((EmplDaysDetailsForm)p)._summaryAbsentTime.Days * 24, ((EmplDaysDetailsForm)p)._summaryAbsentTime.Minutes.ToString("D2"), ((EmplDaysDetailsForm)p)._summaryAbsentTime.Seconds.ToString("D2")); } WrResponse += "</table>"; if (((EmplDaysDetailsForm)p).SourceCash.IsError) { WrResponse += Resx.GetString("lErrorDesc"); } WrResponse += "</body></html>"; } } } }
/// <summary> /// Разрешает обработку веб-запросов НТТР для пользовательского элемента HttpHandler, который реализует интерфейс /// <see cref="T:System.Web.IHttpHandler" />. /// </summary> /// <param name="context"> /// Объект <see cref="T:System.Web.HttpContext" />, предоставляющий ссылки на внутренние серверные /// объекты (например, Request, Response, Session и Server), используемые для обслуживания HTTP-запросов. /// </param> public void ProcessRequest(HttpContext context) { context.Response.CacheControl = "no-cache"; context.Response.AppendHeader("X-UA-Compatible", "IE=Edge"); Page p; try { if (string.IsNullOrEmpty(context.Request.QueryString["idp"])) { context.Handler = base.GetHandler(context, context.Request.RequestType, context.Request.CurrentExecutionFilePath, context.Request.PhysicalApplicationPath); p = context.Handler as Page; if (p != null) { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = CorporateCulture.GetCorporateCulture(p.CurrentUser.Language); p.Data["StartDate"] = DateTime.UtcNow; p.Data["Url"] = context.Request.Url.PathAndQuery; p.CurrentUser.Host = context.Server.MachineName; p.IDPage = Guid.NewGuid().ToString(); p.V4Request = context.Request; p.V4Response = context.Response; KescoHub.AddPage(p.IDPage, p); var info = $"{DateTime.Now:dd.MM.yy HH:mm:ss} -> В KescoHub зарегистрирована новая страница [{p.IDPage}]"; KescoHub.RefreshSignalViewInfo(new KescoHubTraceInfo { TraceInfo = info }); } if (context.Handler != null) { context.Handler.ProcessRequest(context); } } else { var qsidp = context.Request.QueryString["idp"]; p = KescoHub.GetPage(qsidp) as Page; if (p == null) { RenderPageReload(context); var info = $"{DateTime.Now.ToString("dd.MM.yy HH:mm:ss")} -> Станица {qsidp} не найдена в KescoHub. Страница, отправившая запрос с левым idp - будут перезагружена"; KescoHub.RefreshSignalViewInfo(new KescoHubTraceInfo { TraceInfo = info }); } else { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = CorporateCulture.GetCorporateCulture(p.CurrentUser.Language); p.V4IsPostBack = true; p.IDPostRequest = Guid.NewGuid().ToString(); p.V4Request = context.Request; p.V4Response = context.Response; p.ProcessRequest(); p.Flush(); var requestParams = GetRequestV4Params(context.Request.Params); var info = $"{DateTime.Now:dd.MM.yy HH:mm:ss} -> Перехват события.{requestParams}"; KescoHub.RefreshSignalViewInfo(new KescoHubTraceInfo { TraceInfo = info }); } } } catch (Exception ex) { var sb = new StringBuilder(); var qsidp = context.Request.QueryString["idp"]; if (!string.IsNullOrEmpty(qsidp)) { try { p = KescoHub.GetPage(qsidp) as Page; p.V4Request = context.Request; p.V4Response = context.Response; RenderDialogException(sb, ex, true); p.JS.Write(sb.ToString()); p.Flush(); } catch { Logger.WriteEx(ex); RenderDialogException(sb, ex, false); RenderErrorPage(context, sb); } var info = $"{DateTime.Now:dd.MM.yy HH:mm:ss} -> На странице [{qsidp}] возникла ошибка {ex.Message}"; KescoHub.RefreshSignalViewInfo(new KescoHubTraceInfo { TraceInfo = info }); } else { Logger.WriteEx(ex); RenderDialogException(sb, ex, false); RenderErrorPage(context, sb); var info = $"{DateTime.Now:dd.MM.yy HH:mm:ss} -> В приложении возникла ошибка {ex.Message}"; KescoHub.RefreshSignalViewInfo(new KescoHubTraceInfo { TraceInfo = info }); } } }
private void ProcessRequestByIdPage(HttpContext context) { var callbackKey = context.Request.Form["callbackKey"] ?? context.Request.QueryString["callbackKey"]; var control = context.Request.Form["control"] ?? context.Request.Form["control"] ?? context.Request.QueryString["control"]; var clientName = context.Request.Form["clientname"] ?? context.Request.QueryString["clientname"]; var command = context.Request.Form["command"] ?? context.Request.QueryString["command"]; //Реализуем принудительное закрытие signal-соединения. if (control == "window" && command == "pageclose") { var p = KescoHub.GetPage(callbackKey) as Page; if (p != null) { p.SaveParameters(); p.V4Dispose(); } return; } //Реализуем принудительное закрытие signal-соединения. if (control == "window" && command == "refreshForce") { var p = KescoHub.GetPage(callbackKey) as Page; if (p != null) { } return; } //Реализуем отправки сообщения о клиентской ошибке if (control == "window" && command == "error") { var message = HttpUtility.UrlDecode(context.Request["messageError"]); var type = int.Parse(context.Request["typeError"] ?? "1"); var p = (Priority)type; Logger.WriteEx(new LogicalException (message, "Message: " + message + ";\n" + (context.Request["linenumberError"].Length > 0 ? "Line: " + context.Request["linenumberError"] + ";\n" : "") + (context.Request["urlError"].Length > 0 ? "Url: " + HttpUtility.UrlDecode(context.Request["urlError"]) : ""), Assembly.GetExecutingAssembly().GetName(), "window.onError", p)); return; } control = context.Request.Form["control"] ?? context.Request.Form["control"] ?? context.Request.QueryString["callbackKey"]; if (string.IsNullOrEmpty(callbackKey) || string.IsNullOrEmpty(control)) { throw new LogicalException("Ошибка передачи параметров", "Не переданы обязательные параметры callbackKey|control", Assembly.GetExecutingAssembly().GetName()); } var page = KescoHub.GetPage(callbackKey) as Page; if (page == null) { throw new Exception("Ошибка -> " + callbackKey); } if (!string.IsNullOrEmpty(clientName)) { KescoHub.SendMessage(new SignalMessage { PageId = callbackKey, IsV4Script = true, Message = $"<js>v4_clientName = '{clientName}'; v4_setToolTip();</js>" }); return; } var value = context.Request.Form["value"]; var valueText = context.Request.Form["valueText"]; var escaped = context.Request.Form["escaped"]; var multiReturn = context.Request.Form["multiReturn"]; if (escaped.Equals("1")) { value = HttpUtility.UrlDecode(value); valueText = HttpUtility.UrlDecode(valueText ?? ""); } if (value == null || value.Equals("0")) { if (!string.IsNullOrEmpty(control)) { KescoHub.SendMessage(new SignalMessage { PageId = callbackKey, IsV4Script = true, Message = $"<js>var suff= gi('{control}_0')!=null?'_0':''; $(window).focus(); setTimeout(function () {{$('#{control}' + suff).focus();}},10);</js>" }); } } else { if (callbackKey == control && command.ToLower().Equals("checksimilar")) { KescoHub.SendMessage(new SignalMessage { PageId = callbackKey, IsV4Script = true, Message = $"<js>$(window).focus(); v4_setIdEntity('{HttpUtility.JavaScriptStringEncode(value ?? "")}', '{HttpUtility.JavaScriptStringEncode(command ?? "CHECKSIMILAR")}');</js>" }); } else { KescoHub.SendMessage(new SignalMessage { PageId = callbackKey, IsV4Script = true, Message = $"<js>$(window).focus(); v4s_setSelectedValue('{control}', '{callbackKey}', JSON.parse('{HttpUtility.JavaScriptStringEncode(value ?? "")}'), '{(multiReturn == "2" ? "True" : "False")}');</js>" }); } } }