Beispiel #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;
        }
Beispiel #2
0
 public void ReplaceNameAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "Name", index, newValue.ToString());
 }
Beispiel #3
0
 public void AddName(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "Name", newValue.ToString());
 }
Beispiel #4
0
 public void InsertFormatAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "", "Format", index, newValue.ToString());
 }
Beispiel #5
0
 public void Replacedefault2At(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "default", index, newValue.ToString());
 }
Beispiel #6
0
 public void Adddefault2(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "default", newValue.ToString());
 }
Beispiel #7
0
 public void InsertunitSymbolAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "unitSymbol", index, newValue.ToString());
 }
Beispiel #8
0
 public void ReplaceFormatAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "http://www.opengis.net/wms", "Format", index, newValue.ToString());
 }
Beispiel #9
0
 public void AddToolBarImage(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "", "ToolBarImage", newValue.ToString());
 }
Beispiel #10
0
 public void ReplaceAbstract2At(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "", "Abstract", index, newValue.ToString());
 }
Beispiel #11
0
 public void InsertAbstract2At(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "", "Abstract", index, newValue.ToString());
 }
Beispiel #12
0
 public void AddAbstract2(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "", "Abstract", newValue.ToString());
 }
Beispiel #13
0
 public void ReplaceauthorityAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "authority", index, newValue.ToString());
 }
Beispiel #14
0
 public void InsertauthorityAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "authority", index, newValue.ToString());
 }
Beispiel #15
0
 public void Addauthority(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "authority", newValue.ToString());
 }
Beispiel #16
0
 public EnumerationType(SchemaString newValue) : base(newValue)
 {
     Validate();
 }
Beispiel #17
0
 public void InsertToolBarImageAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "", "ToolBarImage", index, newValue.ToString());
 }
Beispiel #18
0
 public void AddunitSymbol(SchemaString newValue)
 {
     AppendDomChild(NodeType.Attribute, "", "unitSymbol", newValue.ToString());
 }
Beispiel #19
0
 public void ReplaceToolBarImageAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "", "ToolBarImage", index, newValue.ToString());
 }
Beispiel #20
0
 public void ReplaceunitSymbolAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Attribute, "", "unitSymbol", index, newValue.ToString());
 }
Beispiel #21
0
 public void AddTitle(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "http://www.opengis.net/wms", "Title", newValue.ToString());
 }
Beispiel #22
0
 public void Insertdefault2At(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "default", index, newValue.ToString());
 }
Beispiel #23
0
 public void InsertTitleAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Element, "http://www.opengis.net/wms", "Title", index, newValue.ToString());
 }
Beispiel #24
0
 public void AddFormat(SchemaString newValue)
 {
     AppendDomChild(NodeType.Element, "", "Format", newValue.ToString());
 }
Beispiel #25
0
 public void AddProcessingInstruction(SchemaString name, SchemaString newValue)
 {
     AppendDomChild(NodeType.ProcessingInstruction, "", name.ToString(), newValue.ToString());
 }
Beispiel #26
0
 public void ReplaceFormatAt(SchemaString newValue, int index)
 {
     ReplaceDomChildAt(NodeType.Element, "", "Format", index, newValue.ToString());
 }
Beispiel #27
0
 public void AddCDataNode(SchemaString newValue)
 {
     AppendDomChild(NodeType.CData, "", "", newValue.ToString());
 }
Beispiel #28
0
 public void InsertNameAt(SchemaString newValue, int index)
 {
     InsertDomChildAt(NodeType.Attribute, "", "Name", index, newValue.ToString());
 }
Beispiel #29
0
 public void AddComment(SchemaString newValue)
 {
     AppendDomChild(NodeType.Comment, "", "", newValue.ToString());
 }
Beispiel #30
0
 public void AddTextNode(SchemaString newValue)
 {
     AppendDomChild(NodeType.Text, "", "", newValue.ToString());
 }
Beispiel #31
0
 public void setValue(SchemaString newValue)
 {
     SetDomNodeValue(domNode, newValue.ToString());
 }