コード例 #1
0
        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();
        }
コード例 #2
0
        /// <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();
        }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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>)&nbsp<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}&nbsp</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>";
                    }
                }
            }
        }
コード例 #7
0
        /// <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
                    });
                }
            }
        }
コード例 #8
0
        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>"
                    });
                }
            }
        }