예제 #1
0
        /// <summary>
        /// Получить множество номеров каналов из условий запроса с проверкой прав
        /// </summary>
        private HashSet <int> GetCnlSet(string cnlNums, string viewIDs, int viewID, UserRights userRights)
        {
            if (!string.IsNullOrWhiteSpace(cnlNums))
            {
                if (!userRights.ViewAllRight)
                {
                    int[] cnlNumArr = ScadaUtils.ParseIntArray(cnlNums);
                    int[] viewIDArr = ScadaUtils.ParseIntArray(viewIDs);

                    if (!userRights.CheckInCnlRights(cnlNumArr, viewIDArr))
                    {
                        throw new ScadaException(CommonPhrases.NoRights);
                    }
                }

                return(ScadaUtils.ParseIntSet(cnlNums));
            }
            else if (viewID > 0)
            {
                BaseView view = GetViewFromCache(viewID, userRights);
                return(view.CnlSet);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        protected void btnApplyAddedCnls_Click(object sender, EventArgs e)
        {
            // добавление каналов
            if (hidAddedCnlNums.Value != "")
            {
                int[]         addedCnls    = ScadaUtils.ParseIntArray(hidAddedCnlNums.Value);
                int[]         addedViewIDs = ScadaUtils.ParseIntArray(hidAddedViewIDs.Value);
                HashSet <int> selCnlSet    = ChartUtils.GetCnlSet(selCnls);

                for (int i = 0, cnt = Math.Min(addedCnls.Length, addedViewIDs.Length); i < cnt; i++)
                {
                    int cnlNum = addedCnls[i];
                    if (!selCnlSet.Contains(cnlNum))
                    {
                        CnlViewPair pair = new CnlViewPair(cnlNum, addedViewIDs[i]);
                        pair.FillInfo(appData.DataAccess.GetCnlProps(cnlNum), userData.UserViews);
                        selCnls.Add(pair);
                    }
                }

                ViewState.Add("SelCnls", selCnls);
                ShowSelCnls();

                hidAddedCnlNums.Value = "";
                hidAddedViewIDs.Value = "";
            }
        }
예제 #3
0
파일: Link.cs 프로젝트: zhiqiang-hu/scada
        /// <summary>
        /// Загрузить конфигурацию компонента из XML-узла
        /// </summary>
        public override void LoadFromXml(XmlNode xmlNode)
        {
            base.LoadFromXml(xmlNode);

            BackColorOnHover   = xmlNode.GetChildAsString("BackColorOnHover");
            BorderColorOnHover = xmlNode.GetChildAsString("BorderColorOnHover");
            ForeColorOnHover   = xmlNode.GetChildAsString("ForeColorOnHover");
            UnderlineOnHover   = xmlNode.GetChildAsBool("UnderlineOnHover");
            CnlNums.Clear();
            CnlNums.AddRange(ScadaUtils.ParseIntArray(xmlNode.GetChildAsString("CnlNums")));
            PopupSize = PopupSize.GetChildAsSize(xmlNode, "PopupSize");
            Target    = xmlNode.GetChildAsEnum <LinkTarget>("Target");
            Url       = xmlNode.GetChildAsString("Url");
            ViewID    = xmlNode.GetChildAsInt("ViewID");
        }
예제 #4
0
        /// <summary>
        /// Загрузить свойства документа схемы из XML-узла.
        /// </summary>
        public void LoadFromXml(XmlNode xmlNode)
        {
            if (xmlNode == null)
            {
                throw new ArgumentNullException("xmlNode");
            }

            SetToDefault();

            Version       = xmlNode.GetChildAsString("Version");
            Size          = Size.GetChildAsSize(xmlNode, "Size");
            BackColor     = xmlNode.GetChildAsString("BackColor");
            BackImageName = xmlNode.GetChildAsString("BackImageName");
            Font          = Font.GetChildAsFont(xmlNode, "Font");
            ForeColor     = xmlNode.GetChildAsString("ForeColor");
            Title         = xmlNode.GetChildAsString("Title");
            CnlFilter.AddRange(ScadaUtils.ParseIntArray(xmlNode.GetChildAsString("CnlFilter")));
        }
예제 #5
0
 /// <summary>
 /// Получить значение параметра из строки запроса как массив целых чисел.
 /// </summary>
 public static int[] GetParamAsIntArray(this NameValueCollection queryString, string paramName)
 {
     return(ScadaUtils.ParseIntArray(queryString[paramName]));
 }