Exemple #1
0
        /// <summary>
        /// method to return the expression condition to filter out those records that are not accessible to position's locations/equipments
        /// </summary>
        /// <param name="currentUserID"></param>
        /// <param name="roleNameCode">role code.</param>
        /// <param name="isLocation"> if this is true, it will be based on location, else equipment</param>
        /// <param name="hierarchyPathColumn">pass in the column to be built condition, forexample, TablesLogic.tContract.Locations.HierarchyPath</param>
        /// <returns></returns>
        public static ExpressionCondition GetAccessibleCondition(string currentUserID, bool isLocation, SchemaString hierarchyPathColumn, params string[] roleNameCode)
        {
            OUser user = TablesLogic.tUser.Load(new Guid(currentUserID));
            List<OPosition> positions = OPosition.GetPositionsByUserByRoleCode(user, roleNameCode);                

            if (positions != null && positions.Count > 0)
            { 
                foreach (OPosition position in positions)
                {
                    if (isLocation)
                    {
                        ExpressionCondition cond = null;
                        foreach (OLocation location in position.LocationAccess)
                        {
                            if (cond == null)
                                cond = hierarchyPathColumn.Like(location.HierarchyPath + "%");
                            else
                                cond = cond | hierarchyPathColumn.Like(location.HierarchyPath + "%");
                        }
                        return cond;
                    }
                    else
                    {
                        ExpressionCondition cond = null;
                        foreach (OEquipment equipment in position.EquipmentAccess)
                        {
                            if (cond == null)
                                cond = hierarchyPathColumn.Like(equipment.HierarchyPath + "%");
                            else
                                cond = cond | hierarchyPathColumn.Like(equipment.HierarchyPath + "%");
                        }
                        return cond;
                    }
                }                                
            }            
            return null;
        }
Exemple #2
0
 public void ReplaceNameAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "Name", index, newValue.ToString());
 }
Exemple #3
0
 public void AddName(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "Name", newValue.ToString());
 }
Exemple #4
0
 public void InsertFormatAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "", "Format", index, newValue.ToString());
 }
Exemple #5
0
 public void Replacedefault2At(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "default", index, newValue.ToString());
 }
Exemple #6
0
 public void Adddefault2(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "default", newValue.ToString());
 }
Exemple #7
0
 public void InsertunitSymbolAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "unitSymbol", index, newValue.ToString());
 }
Exemple #8
0
 public void ReplaceFormatAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "http://www.opengis.net/wms", "Format", index, newValue.ToString());
 }
Exemple #9
0
 public void AddToolBarImage(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "", "ToolBarImage", newValue.ToString());
 }
Exemple #10
0
 public void ReplaceAbstract2At(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "", "Abstract", index, newValue.ToString());
 }
Exemple #11
0
 public void InsertAbstract2At(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "", "Abstract", index, newValue.ToString());
 }
Exemple #12
0
 public void AddAbstract2(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "", "Abstract", newValue.ToString());
 }
Exemple #13
0
 public void ReplaceauthorityAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "authority", index, newValue.ToString());
 }
Exemple #14
0
 public void InsertauthorityAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "authority", index, newValue.ToString());
 }
Exemple #15
0
 public void Addauthority(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "authority", newValue.ToString());
 }
Exemple #16
0
 public EnumerationType(SchemaString newValue) : base(newValue)
 {
     Validate();
 }
Exemple #17
0
 public void InsertToolBarImageAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "", "ToolBarImage", index, newValue.ToString());
 }
Exemple #18
0
 public void AddunitSymbol(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "unitSymbol", newValue.ToString());
 }
Exemple #19
0
 public void ReplaceToolBarImageAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "", "ToolBarImage", index, newValue.ToString());
 }
Exemple #20
0
 public void ReplaceunitSymbolAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "unitSymbol", index, newValue.ToString());
 }
Exemple #21
0
 public void AddTitle(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "http://www.opengis.net/wms", "Title", newValue.ToString());
 }
Exemple #22
0
 public void Insertdefault2At(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "default", index, newValue.ToString());
 }
Exemple #23
0
 public void InsertTitleAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "http://www.opengis.net/wms", "Title", index, newValue.ToString());
 }
Exemple #24
0
 public void AddFormat(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "", "Format", newValue.ToString());
 }
Exemple #25
0
 public void AddProcessingInstruction(SchemaString name, SchemaString newValue)
 {
     AppendDomChild(NodeType.ProcessingInstruction, "", name.ToString(), newValue.ToString());
 }
Exemple #26
0
 public void ReplaceFormatAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "", "Format", index, newValue.ToString());
 }
Exemple #27
0
 public void AddCDataNode(SchemaString newValue)
 {
     AppendDomChild(NodeType.CData, "", "", newValue.ToString());
 }
Exemple #28
0
 public void InsertNameAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "Name", index, newValue.ToString());
 }
Exemple #29
0
 public void AddComment(SchemaString newValue)
 {
     AppendDomChild(NodeType.Comment, "", "", newValue.ToString());
 }
Exemple #30
0
 public void AddTextNode(SchemaString newValue)
 {
     AppendDomChild(NodeType.Text, "", "", newValue.ToString());
 }
Exemple #31
0
 public void setValue(SchemaString newValue)
 {
     SetDomNodeValue(domNode, newValue.ToString());
 }