Exemplo n.º 1
0
        /// <summary>
        ///     Подготовка данных для отрисовки заголовка страницы(панели с кнопками)
        /// </summary>
        /// <returns></returns>
        protected string RenderHeader()
        {
            using (var w = new StringWriter())
            {
                var btnEdit = MenuButtons.Find(btn => btn.ID == "btnEdit");
                RemoveMenuButton(btnEdit);
                var btnSave = MenuButtons.Find(btn => btn.ID == "btnSave");
                RemoveMenuButton(btnSave);
                var btnApply = MenuButtons.Find(btn => btn.ID == "btnApply");
                RemoveMenuButton(btnApply);
                var btnReCheck = MenuButtons.Find(btn => btn.ID == "btnReCheck");
                RemoveMenuButton(btnReCheck);
                var btnRefresh = MenuButtons.Find(btn => btn.ID == "btnRefresh");
                RemoveMenuButton(btnRefresh);

                var btnMove = new Button
                {
                    ID           = "btnMove",
                    V4Page       = this,
                    Text         = Resx.GetString("Users_lblMoveEquipment"),
                    Title        = Resx.GetString("Users_lblMoveEquipment"),
                    IconJQueryUI = ButtonIconsEnum.Copy,
                    Width        = 205,
                    OnClick      = "Move();"
                };
                AddMenuButton(btnMove);

                RenderButtons(w);

                return(w.ToString());
            }
        }
        /// <summary>
        ///     Подготовка данных для отрисовки заголовка страницы(панели с кнопками)
        /// </summary>
        /// <returns></returns>
        protected string RenderDocumentHeader()
        {
            using (var w = new StringWriter())
            {
                try
                {
                    var btnEdit = MenuButtons.Find(btn => btn.ID == "btnEdit");
                    RemoveMenuButton(btnEdit);

                    var btnSave = MenuButtons.Find(btn => btn.ID == "btnSave");
                    btnSave.Text    = Resx.GetString("cmdOK") + "&nbsp;(F2)";
                    btnSave.OnClick = "cmdasync('cmd', 'SaveAndClose');";
                    if (!((DocPage)ParentPage).DocEditable)
                    {
                        RemoveMenuButton(btnSave);
                    }

                    var btnApply = MenuButtons.Find(btn => btn.ID == "btnApply");
                    btnApply.OnClick = "cmdasync('cmd', 'SaveData');";
                    if (!((DocPage)ParentPage).DocEditable)
                    {
                        RemoveMenuButton(btnApply);
                    }

                    var btnReCheck = MenuButtons.Find(btn => btn.ID == "btnReCheck");
                    RemoveMenuButton(btnReCheck);

                    if (((DocPage)ParentPage).DocEditable && factUsl.PositionId != null && factUsl.PositionId != 0)
                    {
                        var btnClear = new Button
                        {
                            ID           = "btnDelete",
                            V4Page       = this,
                            Text         = Resx.GetString("cmdDelete"),
                            Title        = Resx.GetString("cmdDeleteTitle"),
                            IconJQueryUI = ButtonIconsEnum.Delete,
                            Width        = 105,
                            OnClick      =
                                string.Format("if(confirm('{0} {1}?')) cmdasync('cmd', 'DeleteData');",
                                              Resx.GetString("msgDeleteConfirm"), factUsl.ResourceRus)
                        };

                        AddMenuButton(btnClear);
                    }

                    RenderButtons(w);
                }
                catch (Exception e)
                {
                    var dex = new DetailedException(Resx.GetString("TTN_errFailedGenerateButtons") + ": " + e.Message,
                                                    e);
                    Logger.WriteEx(dex);
                    throw dex;
                }

                return(w.ToString());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Подготовка данных для отрисовки заголовка страницы(панели с кнопками)
        /// </summary>
        /// <returns></returns>
        protected string RenderHeader()
        {
            using (var w = new StringWriter())
            {
                var btnEdit = MenuButtons.Find(btn => btn.ID == "btnEdit");
                RemoveMenuButton(btnEdit);
                var btnReCheck = MenuButtons.Find(btn => btn.ID == "btnReCheck");
                RemoveMenuButton(btnReCheck);
                var btnRefresh = MenuButtons.Find(btn => btn.ID == "btnRefresh");
                RemoveMenuButton(btnRefresh);
                var btnApply = MenuButtons.Find(btn => btn.ID == "btnApply");
                RemoveMenuButton(btnApply);

                var btnSave = MenuButtons.Find(btn => btn.ID == "btnSave");
                btnSave.Title = Resx.GetString("Users_cmdSaveDescription");

                var btnClear = new Button
                {
                    ID           = "btnDelete",
                    V4Page       = this,
                    Text         = Resx.GetString("cmdDelete"),
                    Title        = Resx.GetString("Users_lblDeleteWorkPlace"),
                    IconJQueryUI = ButtonIconsEnum.Delete,
                    Width        = 105,
                    OnClick      = "cmdasync('cmd','DeleteAsc');"
                };

                AddMenuButton(btnClear);


                if (string.IsNullOrEmpty(IdLoc))
                {
                    var btnDelete = MenuButtons.Find(btn => btn.ID == "btnDelete");
                    RemoveMenuButton(btnDelete);
                }

                RenderButtons(w);

                return(w.ToString());
            }
        }
        /// <summary>
        ///     Инициализация/создание кнопок меню
        /// </summary>
        private void SetMenuButtons()
        {
            var btnEdit = MenuButtons.Find(btn => btn.ID == "btnEdit");

            RemoveMenuButton(btnEdit);

            var btnSave = MenuButtons.Find(btn => btn.ID == "btnSave");

            RemoveMenuButton(btnSave);

            var btnApply = MenuButtons.Find(btn => btn.ID == "btnApply");

            btnApply.Title = "Сохранить данные формы";

            var btnRefresh = MenuButtons.Find(btn => btn.ID == "btnRefresh");
            var btnReCheck = MenuButtons.Find(btn => btn.ID == "btnReCheck");

            var btnEquipment = new Button
            {
                ID           = "btnEquipment",
                V4Page       = this,
                Text         = Resx.GetString("Users_lblEquipment"),
                Title        = Resx.GetString("Users_cmdEquipmentDesription"),
                IconJQueryUI = ButtonIconsEnum.Wrench,
                OnClick      = string.Format(
                    "var w = window.open('{0}&Id={1}&DT={2}', 'UserEquipment_{1}', 'menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,width=800'); w.focus();",
                    ReportServer + "?/INVENTORY/Receipt&rc:parameters=false&rs:ClearSession=true",
                    id,
                    DateTime.UtcNow.ToString("yyyyMMddHHmmss")
                    )
            };

            AddMenuButton(btnEquipment);

            var btnPhoto = new Button
            {
                ID           = "btnPhoto",
                V4Page       = this,
                Text         = Resx.GetString("Users_lblPhoto"),
                Title        = Resx.GetString("Users_cmdPhotoDescription"),
                IconJQueryUI = ButtonIconsEnum.Person,
                OnClick      = string.Format(
                    "var w = window.open('{0}','UserPhoto_{1}', 'menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,width=500,height=600'); w.focus();",
                    Config.user_photos + "?Id=" + id, id)
            };

            AddMenuButton(btnPhoto);

            /*
             * if (Request.QueryString["buh1s"] != null)
             * {
             *  var btn1C = new Button
             *  {
             *      ID = "btn1C",
             *      V4Page = this,
             *      Text = Resx.GetString("Users_MoveTo1C"),
             *      Title = Resx.GetString("Users_MoveTo1C"),
             *      IconJQueryUI = ButtonIconsEnum.Copy,
             *      OnClick = "_sync();"
             *  };
             *  AddMenuButton(btn1C);
             * }
             */
        }