Esempio n. 1
0
        /// <summary>
        /// Добавить информацию и новом доступе
        /// </summary>
        /// <param name="IP">IP адрес пользователя</param>
        /// <param name="host">Домен для которого предоставлен доступ</param>
        /// <param name="expires">До какого времени предоставлен доступ</param>
        /// <param name="accessType">Режим доступа</param>
        public static void Add(string IP, string host, DateTime expires, AccessType accessType)
        {
            // Удаляем старые данные
            Remove(IP, host, accessType);

            // Модель
            var model = new AccessIPModel()
            {
                IP         = IP,
                host       = host,
                accessType = accessType,
                Expires    = expires
            };

            // Обновляем даннные в базе
            if (db.TryGetValue($"{IP}-{host}-{accessType.ToString()}", out var mass))
            {
                mass.Add(model);
            }
            else
            {
                db.Add($"{IP}-{host}-{accessType.ToString()}", new List <AccessIPModel>()
                {
                    model
                });
            }

            // Сохраняем базу
            Save();
        }
Esempio n. 2
0
        public void Test_ToString()
        {
            EnumWrapper wrapper    = EnumWrapper.Get(TestAccessTypes.First);
            AccessType  accessType = AccessType.Get(wrapper);

            Assert.That(accessType.ToString(), Is.EqualTo(wrapper.ToString()));
        }
Esempio n. 3
0
        public ActionResult SubGroupsApp(string groupid, bool aggregated)
        {
            string userId = this.User.QID();

            if (userId == null)
            {
                return(null);
            }

            QuantApp.Kernel.User  user = QuantApp.Kernel.User.FindUser(userId);
            QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid);

            List <Group> sgroups = role.SubGroups(aggregated);



            List <object> jres = new List <object>();

            foreach (Group group in sgroups)
            {
                AccessType ac = group.Permission(null, user);
                if (ac != AccessType.Denied)
                {
                    jres.Add(new
                    {
                        ID          = group.ID,
                        Name        = group.Name,
                        Description = group.Description,
                        Permission  = ac.ToString(),
                    });
                }
            }

            return(Ok(jres));
        }
Esempio n. 4
0
        public ActionResult UserApp(string id)
        {
            string userId = this.User.QID();

            if (userId == null)
            {
                return(null);
            }

            QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId);

            QuantApp.Kernel.User quser = QuantApp.Kernel.User.FindUser(id);

            List <object> jres = new List <object>();

            foreach (QuantApp.Kernel.Group group in QuantApp.Kernel.Group.MasterGroups())
            {
                if (!group.Name.StartsWith("Personal: "))
                {
                    AccessType accessType = group.Permission(null, quser);

                    jres.Add(
                        new
                    {
                        ID         = group.ID,
                        Name       = group.Name,
                        Permission = accessType.ToString()
                    }
                        );
                }
            }


            return(Ok(new { FirstName = quser.FirstName, LastName = quser.LastName, Groups = jres }));
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (this.CurrentUser.AccessLevel == iPAS_Base.AccessLevel.COMPANY_LEVEL || this.CurrentUser.AccessLevel == iPAS_Base.AccessLevel.PORTAL_ADMIN)
                {
                    divShareable.Visible          = true;
                    hdnDeleteUserViewAccess.Value = AccessType.FULL_ACCESS.ToString();
                }
                else
                {
                    int        accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);
                    AccessType access        = CommonBLL.ValidateUserPrivileges(this.CurrentUser.SiteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.ShareUserView));
                    if (access == AccessType.FULL_ACCESS)
                    {
                        divShareable.Visible = true;
                    }
                    else
                    {
                        divShareable.Visible = false;
                    }

                    hdnDeleteUserViewAccess.Value = access.ToString();
                }
            }
        }
Esempio n. 6
0
    private void OnFirebaseReady()
    {
        ready = true;

        switch (accessType)
        {
        case AccessType.WriteIfAdmin:
            accessType = FirebaseManager.IsAdmin ? AccessType.Write : AccessType.Read;
            break;

        case AccessType.ReadIfAdmin:
            accessType = FirebaseManager.IsAdmin ? AccessType.Read : AccessType.Write;
            break;
        }

        firebase.VisualLog(string.Format("AccesType: {0}", accessType.ToString()));

        if (accessType == AccessType.Write)
        {
            StartCoroutine(UpdateValuesCoroutine());
        }
        else
        {
            if (writeValuesOnLoad)
            {
                UpdateValues(() => {
                    StartListening();
                });
            }
            else
            {
                StartListening();
            }
        }
    }
Esempio n. 7
0
 public void SetType(AccessType type)
 {
     alist.ListInfo.ColumnsVisible = false;
     foreach (var column in alist.ListInfo.Columns)
     {
         column.Visible = column.Name == "Group" || column.Name == type.ToString();
     }
 }
Esempio n. 8
0
 public void addAccess(File file, AccessType fileAccessType, GrantDenyType fileGrantDenyType = GrantDenyType.GrantDeny)
 {
     if (!(filesDict[file].ToString().Contains(fileAccessType.ToString())) && (filesDict[file] != AccessType.RWD))
     {
         filesDict[file] = (AccessType)((int)Math.Min(((int)filesDict[file] + (int)fileAccessType), 7));
     }
     grantDenyDict[file] = fileGrantDenyType;
 }
Esempio n. 9
0
        public override string ToString()
        {
            var result = AccessTypes.ToString();

            if (Peek.Mask != null || ReadStrict.Mask != null || UpdateStrict.Mask != null)
            {
                result += "/Masked";
            }
            return("(" + result + ")");
        }
Esempio n. 10
0
 public static string FormatMessage(ObjectName tableName, AccessType accessType, int timeout)
 {
     var timeoutString = timeout == System.Threading.Timeout.Infinite
         ? "Infinite"
         : String.Format("{0}ms", timeout);
     var accessTypeString = accessType == AccessType.ReadWrite
         ? "read/write"
         : accessType.ToString().ToLowerInvariant();
     return String.Format("A {0} lock on {1} was not released before {2}", accessTypeString, tableName, timeoutString);
 }
Esempio n. 11
0
 // The function discards an access from the file.
 public void discardAccess(File file, AccessType fileAccessType)
 {
     if (filesDict.ContainsKey(file))
     {
         if ((filesDict[file].ToString().Contains(fileAccessType.ToString())) && !(filesDict[file] == AccessType.None))
         {
             filesDict[file] = (AccessType)(Math.Max(((int)filesDict[file] - (int)fileAccessType), 0));
         }
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Удалить ключ из базы
        /// </summary>
        /// <param name="IP">IP адрес пользователя</param>
        /// <param name="host">Домен для которого предоставлен доступ</param>
        /// <param name="accessType">Режим предоставленного доступа</param>
        public static void Remove(string IP, string host, AccessType accessType)
        {
            string key = $"{IP}-{host}-{accessType.ToString()}";

            if (db.TryGetValue(key, out _))
            {
                db.Remove(key);
                Save();
            }
        }
        public ActionResult UserData(string id, string groupid, bool aggregated)
        {
            string userId = this.User.QID();

            if (userId == null)
            {
                return(null);
            }

            QuantApp.Kernel.User user = QuantApp.Kernel.User.FindUser(userId);

            QuantApp.Kernel.User quser = QuantApp.Kernel.User.FindUser(id);

            QuantApp.Kernel.Group role = QuantApp.Kernel.Group.FindGroup(groupid);

            if (role == null)
            {
                return(null);
            }

            List <Group> sgroups = role.SubGroups(aggregated);


            List <object> jres = new List <object>();

            var lastLogin = UserRepository.LastUserLogin(id);

            foreach (QuantApp.Kernel.Group group in sgroups)
            {
                if (!group.Name.StartsWith("Personal: "))
                {
                    AccessType accessType = group.Permission(null, quser);

                    jres.Add(
                        new
                    {
                        ID         = group.ID,
                        Name       = group.Name,
                        Permission = accessType.ToString()
                    }
                        );
                }
            }

            return(Ok(new {
                ID = quser.ID,
                Email = quser.Email,
                Permission = role.Permission(null, quser).ToString(),
                MetaData = quser.MetaData,
                FirstName = quser.FirstName,
                LastName = quser.LastName,
                LastLogin = lastLogin,
                Groups = jres
            }));
        }
        private void ValidateUserPrivileges(int userID, int siteID, int accessLevelID)
        {
            AccessType access = CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, userID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.ManagePreventiveMaintenanceSchedule));

            if (access == AccessType.NO_ACCESS)
            {
                Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
            }

            _manageScheduleAccess = access.ToString();
        }
        public static string FormatMessage(ObjectName tableName, AccessType accessType, int timeout)
        {
            var timeoutString = timeout == System.Threading.Timeout.Infinite
                                ? "Infinite"
                                : String.Format("{0}ms", timeout);
            var accessTypeString = accessType == AccessType.ReadWrite
                                ? "read/write"
                                : accessType.ToString().ToLowerInvariant();

            return(String.Format("A {0} lock on {1} was not released before {2}", accessTypeString, tableName, timeoutString));
        }
Esempio n. 16
0
        /// <summary>
        /// Returns true if the user has access to the resource for the specified type of access requested.
        /// </summary>
        /// <param name="path">Path to resource access is requested for.</param>
        /// <param name="username">Username of user trying to access resource.</param>
        /// <param name="roles">Roles user belongs to.</param>
        /// <param name="type">Type of access requested.</param>
        /// <returns>True if user has access to perform action, otherwise false.</returns>
        public bool Authorize(string path, string username, string[] roles, AccessType type)
        {
            var pars = new Node("signal", "magic.io.authorize");

            pars.Add(new Node("path", path));
            pars.Add(new Node("username", username));
            pars.Add(new Node("type", type.ToString()));
            pars.Add(new Node("roles", null, roles.Select(x => new Node(null, x))));
            _signaler.Signal("signal", pars);
            return(pars.Get <bool>());
        }
Esempio n. 17
0
        private void ValidateUserPrivileges(int siteID, int accessLevelID)
        {
            AccessType access = CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.Configure_WorkGroup));

            if (access == AccessType.NO_ACCESS)
            {
                Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
            }
            else
            {
                this.PageAccessRights = access.ToString();
            }
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/WorkOrderResourceViewCalendarScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                ValidateUserPrivileges(siteID, accessLevelID);

                AccessType viewWorkOrderInfo = GetViewWorkOrderInfoPermission(siteID, accessLevelID);

                string servicePath   = ConfigurationManager.AppSettings["MaintWebServicePath"].TrimEnd('/');
                string maintBasePath = ConfigurationManager.AppSettings["MaintBasePath"].TrimEnd('/').ToString();
                int    currentDate   = BLL.MaintenanceBLL.GetSiteCurrentDateTime(siteID).CurrentDate;

                BasicParam basicParam = new BasicParam();
                basicParam.SiteID        = siteID;
                basicParam.UserID        = userID;
                basicParam.AccessLevelID = accessLevelID;
                basicParam.LanguageCode  = this.CurrentUser.LanguageCode;

                UserControls.PagerData resourceViewpagerData = new UserControls.PagerData();
                resourceViewpagerData.PageIndex        = 0;
                resourceViewpagerData.PageSize         = int.Parse(hdnResourceViewPageSize.Value.ToString());
                resourceViewpagerData.CurrentPage      = currentPage;
                resourceViewpagerData.SelectMethod     = "LoadResourceViewTimeline";
                resourceViewpagerData.ServicePath      = servicePath;
                resourceViewpagerData.SiteID           = siteID;
                resourceViewpagerData.UserID           = userID;
                resourceViewpagerData.AccessLevelID    = accessLevelID;
                resourceViewpagerData.PageAccessRights = viewWorkOrderInfo.ToString();

                Page.ClientScript.RegisterStartupScript(GetType(), "LoadResourceViewBasicInfo", "LoadResourceViewBasicInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + "," + (new JavaScriptSerializer()).Serialize(resourceViewpagerData) + ", '" + servicePath + "'," + currentDate + ",'" + maintBasePath + "');", true);
            }
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/ToolsScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);


                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);


                AccessType access        = ValidateUserPrivileges(siteID, accessLevelID);
                AccessType approveAccess = CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.taskGroupApprove));


                Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam();
                basicParam.SiteID        = siteID;
                basicParam.UserID        = userID;
                basicParam.AccessLevelID = accessLevelID;

                string basePath         = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string webServicePath   = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim();
                string uploaderPath     = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                string imagePath        = ConfigurationManager.AppSettings["ToolsImagePath"].Trim() + siteID + "/Thumbnail";
                string imageDefaultPath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/deafult.png";

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.SelectMethod     = "LoadToolsInfo";
                pagerData.ServicePath      = webServicePath;
                pagerData.LoadControlID    = hdnPageSize.ClientID;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.PageAccessRights = access.ToString();

                thDescription.Attributes.Add("onclick", "javascript:SortTabs('" + thDescription.ClientID + "','ToolsDescription');");

                Page.ClientScript.RegisterStartupScript(GetType(), "LoadToolsInfoPage", "LoadToolsInfoPage(" + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(basicParam) + ",'" + basePath + "','" + webServicePath + "','" + uploaderPath + "','" + imageDefaultPath + "','" + imagePath + "','" + hasDeleteAccess + "','" + hasEditAccess + "');", true);
            }
        }
Esempio n. 20
0
        private string ToDebugString()
        {
            string objName;

            if (Lockable is IDbObject)
            {
                objName = ((IDbObject)Lockable).ObjectInfo.FullName.FullName;
            }
            else
            {
                objName = Lockable.ToString();
            }

            return(String.Format("LOCK {0} ON {1} IN {2} MODE", AccessType.ToString().ToUpperInvariant(), objName,
                                 Mode.ToString().ToUpperInvariant()));
        }
Esempio n. 21
0
        /// <summary>
        /// Anade un registro al fichero XML
        /// </summary>
        /// <param name="llamadas"></param>
        /// <param name="user"></param>
        /// <param name="access"></param>
        /// <param name="target"></param>
        private static void AddRecord(ref XElement llamadas, AccessType access, string target)
        {
            // Eliminar el registro con la llamada más antigua
            var calls = from el in llamadas.Elements() select el;

            if (calls.Count() >= 10)
            {
                calls.ElementAt(calls.Count() - 1).Remove();
            }

            // Actualizar valor de la última llamada
            llamadas.SetAttributeValue("Ultima", target);

            // El último elemento es el más reciente
            llamadas.AddFirst(new XElement("Call", new XAttribute("Fecha_Hora", DateTime.Now.ToString()),
                                           new XAttribute("Acceso", access.ToString()),
                                           new XAttribute("Colateral", target)));
        }
Esempio n. 22
0
        private void ThrowEntityException(IMethodInvocation invocation, Exception ex)
        {
            // just in case
            if (ex is EntityException)
            {
                throw ex;
            }

            RemoteService.CheckForDBValidationException(null, ex);

            object[] attrs =
                invocation.Method.GetCustomAttributes(typeof(AccessTypeAttribute), true);
            if (attrs == null || attrs.Length == 0)
            {
                log.Error(string.Format("Can't get AccessTypeAttribute for {0}", invocation.Method.Name));
                throw new EntityException(ex);
            }
            AccessType accessType = ((AccessTypeAttribute)attrs[0]).AccessType;

            switch (accessType)
            {
            case AccessType.FreeAccess:
            case AccessType.None:
                throw new EntityException(ex);

            case AccessType.Read:
            case AccessType.Import:
                throw new LoadException(ex);

            case AccessType.Write:
                throw new SaveOrUpdateException(ex);

            default:
                log.Error(
                    string.Format("Unknown AccessTypeAttribute for {0} ({1})", invocation.Method.Name,
                                  accessType.ToString()));
                throw new EntityException(ex);
            }
        }
Esempio n. 23
0
        private void ValidateUserPrivileges(int siteID, int accessLevelID, string mptDataType)
        {
            AccessType access = CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.Configure_Measuring_Point));

            if (access == AccessType.NO_ACCESS)
            {
                Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
            }
            else
            {
                this.PageAccessRights = access.ToString();
            }

            #region ValidateUserPrivileges for navigation button links

            if (CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.Configure_Functional_Loc)) == AccessType.NO_ACCESS)
            {
                lnkFLocation.Visible = false;
            }

            if (mptDataType != null && mptDataType.ToUpper() == "E")
            {
                if (CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.Configure_Equipments)) == AccessType.NO_ACCESS)
                {
                    lnkEquipmentInfo.Visible = false;
                }
            }
            else if (mptDataType != null && mptDataType.ToUpper() == "M")
            {
                if (CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.Configure_Equipment_Models)) == AccessType.NO_ACCESS)
                {
                    lnkEquipmentInfo.Visible = false;
                }
            }
            #endregion
        }
Esempio n. 24
0
        public async Task GetRequestTokenAsync(string callback)
        {
            if (string.IsNullOrWhiteSpace(callback))
            {
                throw new ArgumentNullException("callback", "callback is required.");
            }

            Parameters.Add("oauth_callback", EncodeToProtectMultiByteCharUrls(callback));
            Parameters.Remove("oauth_token");

            if (AccessType != AuthAccessType.NoChange)
            {
                Parameters.Add("x_auth_access_type", AccessType.ToString().ToLower());
            }

            string response = await HttpGetAsync(OAuthRequestTokenUrl, Parameters).ConfigureAwait(false);

            if (string.IsNullOrWhiteSpace(response))
            {
                throw new ArgumentNullException("Empty response to request token response from Twitter.");
            }

            UpdateCredentialsFromRequestTokenResponse(response);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource
                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/NotificationScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/jQueryCalendarScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                if (Request.QueryString["nid"] != null && Request.QueryString["nid"].Trim().Length > 0)
                {
                    notificationID = Convert.ToInt32(Request.QueryString["nid"].Trim());
                }

                AccessType access = ValidateUserPrivileges(siteID, accessLevelID);
                if (access == AccessType.FULL_ACCESS || access == AccessType.EDIT_ONLY)
                {
                    btnSaveNotification.Attributes.Add("onclick", "javascript:AddUpdateNotification(false);return false;");
                }
                else
                {
                    btnSaveNotification.Attributes.Add("disabled", "disabled");
                }

                string basePath                   = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string webServicePath             = ConfigurationManager.AppSettings["MaintWebServicePath"];
                string uploaderPath               = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                string imagePath                  = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/');
                string notificationAttachmentPath = ConfigurationManager.AppSettings["NotificationAttachmentPath"].TrimEnd('/');

                Vegam_MaintenanceService.SiteDateTimeFormatInfo dateTimeFormat = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);
                string datePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeFormat.DateFormat);

                BasicParam basicParam = new BasicParam();
                basicParam.SiteID        = siteID;
                basicParam.UserID        = userID;
                basicParam.AccessLevelID = accessLevelID;
                basicParam.LanguageCode  = this.CurrentUser.LanguageCode;

                #region notification PagerData
                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.SelectMethod     = "LoadNotificationList";
                pagerData.ServicePath      = webServicePath;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.LoadControlID    = btnSaveNotification.ClientID;
                pagerData.PageAccessRights = access.ToString();
                #endregion

                #region notification type PagerData
                ////using pager for notification types modal popup
                UserControls.PagerData maintTypePagerData = new UserControls.PagerData();
                maintTypePagerData.PageIndex        = 0;
                maintTypePagerData.PageSize         = int.Parse(hdnMasterPageSize.Value.ToString());
                maintTypePagerData.SelectMethod     = "LoadMaintTypesInfo";
                maintTypePagerData.ServicePath      = webServicePath;
                maintTypePagerData.SiteID           = siteID;
                maintTypePagerData.UserID           = userID;
                maintTypePagerData.AccessLevelID    = accessLevelID;
                maintTypePagerData.LoadControlID    = btnSaveNotification.ClientID;
                maintTypePagerData.PageAccessRights = access.ToString();
                #endregion

                #region FLocation and Equipment modal pagerdata
                //using pager for displaying equipment and locations in modal popup
                UserControls.PagerData equipmentPagerData = new UserControls.PagerData();
                equipmentPagerData.PageIndex     = 0;
                equipmentPagerData.PageSize      = int.Parse(hdnEquipmentPageSize.Value.ToString());
                equipmentPagerData.SelectMethod  = "LoadAllEquipmentFLoaction";
                equipmentPagerData.ServicePath   = webServicePath;
                equipmentPagerData.SiteID        = siteID;
                equipmentPagerData.UserID        = userID;
                equipmentPagerData.AccessLevelID = accessLevelID;
                equipmentPagerData.LoadControlID = btnSaveNotification.ClientID;
                #endregion

                thMaintTypes.Attributes.Add("onclick", "javascript:SortMaintTypesTabs('" + thMaintTypes.ClientID + "','MasterDataName');");
                thFLocation.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thFLocation.ClientID + "','LocationName');");
                thEquipment.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thEquipment.ClientID + "','EquipmentName');");
                thEquipmentType.Attributes.Add("onclick", "javascript:SortEquipmentTabs('" + thEquipmentType.ClientID + "','EquipmentType');");
                sortNotifications.Attributes.Add("onclick", "javascript:SortByNotificationName('" + sortNotifications.ClientID + "','NotificationName');");
                ScriptManager.RegisterStartupScript(this, this.GetType(), "NotificationBasicLoadInfo", "javascript:NotificationBasicLoadInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + "," + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(equipmentPagerData) + "," + (new JavaScriptSerializer()).Serialize(maintTypePagerData) + ",'" + basePath + "','" + webServicePath + "','" + notificationID + "','" + hasEditAccess + "','"
                                                    + hasDeleteAccess + "','" + workOrderHasFullAccess + "','" + uploaderPath + "','" + notificationAttachmentPath + "','" + imagePath + "','" + datePickerFormat + "','" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "');", true);
            }
        }
Esempio n. 26
0
        private void AddAccessFuncs(AccessType access)
        {
            foreach (var mr in SharedStateAnalyser.GetMemoryRegions(this.EP))
            {
                List <Variable> inParams = new List <Variable>();

                if (mr.TypedIdent.Type.IsMap)
                {
                    inParams.Add(new LocalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "ptr",
                                                                                 this.AC.MemoryModelType)));
                }

                Procedure proc = new Procedure(Token.NoToken, this.MakeAccessFuncName(access, mr.Name),
                                               new List <TypeVariable>(), inParams, new List <Variable>(),
                                               new List <Requires>(), new List <IdentifierExpr>(), new List <Ensures>());
                proc.AddAttribute("inline", new object[] { new LiteralExpr(Token.NoToken, BigNum.FromInt(1)) });

                this.AC.TopLevelDeclarations.Add(proc);
                this.AC.ResContext.AddProcedure(proc);

                var cmds = new List <Cmd>();

                foreach (var ls in this.AC.MemoryLocksets)
                {
                    if (!ls.TargetName.Equals(mr.Name))
                    {
                        continue;
                    }
                    if (this.ShouldSkipLockset(ls))
                    {
                        continue;
                    }

                    foreach (var cls in this.AC.CurrentLocksets)
                    {
                        if (!cls.Lock.Name.Equals(ls.Lock.Name))
                        {
                            continue;
                        }

                        IdentifierExpr lsExpr = new IdentifierExpr(ls.Id.tok, ls.Id);

                        cmds.Add(new AssignCmd(Token.NoToken,
                                               new List <AssignLhs>()
                        {
                            new SimpleAssignLhs(Token.NoToken, lsExpr)
                        }, new List <Expr> {
                            Expr.And(new IdentifierExpr(cls.Id.tok, cls.Id), lsExpr)
                        }));

                        proc.Modifies.Add(lsExpr);
                        break;
                    }
                }

                if (access == AccessType.WRITE)
                {
                    foreach (var acv in this.AC.GetWriteAccessCheckingVariables())
                    {
                        if (!acv.Name.Split('_')[1].Equals(mr.Name))
                        {
                            continue;
                        }

                        var wacs = this.AC.GetWriteAccessCheckingVariables().Find(val =>
                                                                                  val.Name.Contains(this.AC.GetWriteAccessVariableName(this.EP, mr.Name)));
                        var wacsExpr = new IdentifierExpr(wacs.tok, wacs);

                        cmds.Add(new AssignCmd(Token.NoToken,
                                               new List <AssignLhs>()
                        {
                            new SimpleAssignLhs(Token.NoToken, wacsExpr)
                        }, new List <Expr> {
                            Expr.True
                        }));

                        proc.Modifies.Add(wacsExpr);
                    }
                }
                else if (access == AccessType.READ)
                {
                    foreach (var acv in this.AC.GetReadAccessCheckingVariables())
                    {
                        if (!acv.Name.Split('_')[1].Equals(mr.Name))
                        {
                            continue;
                        }

                        var racs = this.AC.GetReadAccessCheckingVariables().Find(val =>
                                                                                 val.Name.Contains(this.AC.GetReadAccessVariableName(this.EP, mr.Name)));
                        var racsExpr = new IdentifierExpr(racs.tok, racs);

                        cmds.Add(new AssignCmd(Token.NoToken,
                                               new List <AssignLhs>()
                        {
                            new SimpleAssignLhs(Token.NoToken, racsExpr)
                        }, new List <Expr> {
                            Expr.True
                        }));

                        proc.Modifies.Add(racsExpr);
                    }
                }

                List <BigBlock> blocks = null;
                if (mr.TypedIdent.Type.IsMap)
                {
                    var ptr = new LocalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "ptr",
                                                                              this.AC.MemoryModelType));
                    var watchdog = this.AC.GetAccessWatchdogConstants().Find(val =>
                                                                             val.Name.Contains(this.AC.GetAccessWatchdogConstantName(mr.Name)));

                    var ptrExpr      = new IdentifierExpr(ptr.tok, ptr);
                    var watchdogExpr = new IdentifierExpr(watchdog.tok, watchdog);
                    var guardExpr    = Expr.Eq(watchdogExpr, ptrExpr);

                    var ifStmts = new StmtList(new List <BigBlock> {
                        new BigBlock(Token.NoToken, null, cmds, null, null)
                    }, Token.NoToken);
                    var ifCmd = new IfCmd(Token.NoToken, guardExpr, ifStmts, null, null);

                    blocks = new List <BigBlock> {
                        new BigBlock(Token.NoToken, "_" + access.ToString(), new List <Cmd>(), ifCmd, null)
                    };
                }
                else
                {
                    blocks = new List <BigBlock> {
                        new BigBlock(Token.NoToken, "_" + access.ToString(), cmds, null, null)
                    };
                }

                Implementation impl = new Implementation(Token.NoToken, this.MakeAccessFuncName(access, mr.Name),
                                                         new List <TypeVariable>(), inParams, new List <Variable>(), new List <Variable>(),
                                                         new StmtList(blocks, Token.NoToken));

                impl.Proc = proc;
                impl.AddAttribute("inline", new object[] { new LiteralExpr(Token.NoToken, BigNum.FromInt(1)) });

                this.AC.TopLevelDeclarations.Add(impl);
            }
        }
Esempio n. 27
0
 private string MakeAccessFuncName(AccessType access, string name)
 {
     return("_" + access.ToString() + "_LS_" + name + "_$" + this.EP.Name);
 }
 public Stream GetFile(string filePath, FileMode fileMode, AccessType accessType)
 {
     return File.Open(filePath,
         (System.IO.FileMode)Enum.Parse(typeof(System.IO.FileMode), fileMode.ToString()),
         (FileAccess)Enum.Parse(typeof(FileAccess), accessType.ToString()));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script_Resource_Refernce
                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);

                scriptReference      = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/EquipmentModelScriptResource.js";
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                ScriptManager1.Scripts.Add(scriptReference);
                #endregion

                userID        = this.CurrentUser.UserID;
                siteID        = this.CurrentUser.SiteID;
                accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);

                Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam();
                basicParam.SiteID = siteID;
                basicParam.UserID = userID;

                string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/');
                string webServicePath  = ConfigurationManager.AppSettings["MaintWebServicePath"].ToString().TrimEnd('/');
                string basePath        = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');


                SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID);

                UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx");
                divDynamicGridContent.Controls.Add(dynamicGridControl);

                #region Feature Equipment Model

                List <string> featureName = new List <string>();
                featureName.Add(Language_Resources.MaintenanceFeatures.equipmentModels);

                int featureID = 0;
                List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName);
                if (featurePageToLoad.Count > 0)
                {
                    ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.MaintenanceFeatures.equipmentModels);
                    if (result != null)
                    {
                        featureID = result.FeatureID;
                    }
                }
                #endregion

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.CurrentPage      = currentPage;
                pagerData.ServicePath      = webServicePath;
                pagerData.SelectMethod     = "LoadDynamicGridContent";
                pagerData.LoadControlID    = uploadFile.ClientID;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.PlantDateFormat  = dateTimeForamt.DateFormat;
                pagerData.PlantTimeFormat  = dateTimeForamt.TimeFormat;
                pagerData.PageAccessRights = accessType.ToString();

                UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties();
                dynamicGridProperties.GridType         = UserControls.DynamicGridType.Table;
                dynamicGridProperties.FeatureID        = featureID;
                dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat);
                dynamicGridProperties.TableHeaderText  = Language_Resources.EquipmentModel_Resource.listOfEquipmentModel;
                dynamicGridProperties.ImagePath        = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images";
                dynamicGridProperties.PagerData        = pagerData;
                dynamicGridProperties.WebServiceName   = "Vegam_MaintenanceService.asmx";
                dynamicGridProperties.ExcelSheetName   = "EquipmentModelList";

                if (accessType == AccessType.FULL_ACCESS)
                {
                    uploadFile.Attributes.Add("onchange", "javascript:UploadMeasuringPointInfo(); return false;");
                    btnAddNewEquipmentModel.Attributes.Add("onclick", "javascript:AddNewEquipmentModel();return false;");
                }
                else
                {
                    btnUploadExcel.Attributes.Add("disabled", "disabled");
                    btnAddNewEquipmentModel.Attributes.Add("disabled", "disabled");
                }

                string equipmentModelImagePath = ConfigurationManager.AppSettings["EquipmentModelImagePath"].TrimEnd('/');
                Page.ClientScript.RegisterStartupScript(GetType(), "LoadEquipmentModelListPage", "LoadEquipmentModelListPage(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + basePath + "','" + equipmentModelImagePath + "')", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/FunctionalLocationScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                int locationID = 0;
                if (Request.QueryString["flid"] != null && Request.QueryString["flid"].Trim().Length > 0)
                {
                    locationID = Convert.ToInt32(Request.QueryString["flid"].Trim());
                }

                string filterLocationIds = string.Empty;
                if (Request.QueryString["fids"] != null && Request.QueryString["fids"].Trim().Length > 0)
                {
                    filterLocationIds = Request.QueryString["fids"].Trim();
                }

                AccessType access = ValidateUserPrivileges(siteID, accessLevelID);

                //btnClose.Attributes.Add("onclick", "javascript:ViewFLocationList(" + (new JavaScriptSerializer()).Serialize(filterLocationIds) + ");return false;");

                if (locationID == 0)
                {
                    btnAddUpdateFLocation.InnerText = Language_Resources.FunctionalLocation_Resource.saveAndAddMore.ToString();
                }
                else
                {
                    btnAddUpdateFLocation.InnerText = Language_Resources.FunctionalLocation_Resource.update.ToString();
                }

                if (access == AccessType.FULL_ACCESS && locationID == 0)
                {
                    btnAddUpdateFLocation.Attributes.Add("onclick", "javascript:AddUpdateFunctionalLoaction(false);return false;");
                }
                else if (locationID != 0 && (access == AccessType.FULL_ACCESS || access == AccessType.EDIT_ONLY))
                {
                    btnAddUpdateFLocation.Attributes.Add("onclick", "javascript:AddUpdateFunctionalLoaction(true);return false;");
                }
                else
                {
                    btnAddUpdateFLocation.Attributes.Add("disabled", "disabled");
                }

                string webServicePath   = ConfigurationManager.AppSettings["MaintWebServicePath"];
                string basePath         = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string uploaderPath     = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');
                string fLocationImgPath = ConfigurationManager.AppSettings["FunctionalLocImagePath"].ToString().Trim('/') + "/" + siteID + "/" + "Thumbnail";
                string imageDefaultPath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/FLocation.png";

                BasicParam basicParam = new BasicParam();
                basicParam.SiteID        = siteID;
                basicParam.UserID        = userID;
                basicParam.AccessLevelID = accessLevelID;
                basicParam.LanguageCode  = this.CurrentUser.LanguageCode;

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnFLocationPageSize.Value.ToString());
                pagerData.SelectMethod     = "LoadLocationInfo";
                pagerData.ServicePath      = webServicePath;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.LoadControlID    = btnAddUpdateFLocation.ClientID;
                pagerData.PageAccessRights = access.ToString();

                sortFLocation.Attributes.Add("onclick", "javascript:SortByFLocationName('" + sortFLocation.ClientID + "','LocationName');");

                ScriptManager.RegisterStartupScript(this, this.GetType(), "FunctionalLocationBasicInfo", "javascript:FunctionalLocationBasicInfo(" + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(basicParam) + ",'" + basePath + "','" + webServicePath + "','" + imageDefaultPath + "','" + uploaderPath + "','" + locationID + "','" + fLocationImgPath + "','" + hasDeleteAccess + "','" + hasEditAccess + "','" + btnAddUpdateFLocation.ClientID + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                #region Script Resource

                ScriptReference scriptReference = new ScriptReference();
                scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/FunctionalLocationScriptResource.js";
                string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(',');
                scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path);
                scriptManager.Scripts.Add(scriptReference);

                #endregion

                int siteID = CommonBLL.ValidateSiteID(Request);
                if (siteID == 0)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString());
                }

                string filterLocationIds = string.Empty;
                if (Request.QueryString["fids"] != null && Request.QueryString["fids"].Trim().Length > 0)
                {
                    filterLocationIds = Request.QueryString["fids"].Trim();
                }

                int userID        = this.CurrentUser.UserID;
                int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel);

                AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID);

                string basePath       = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/');
                string webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim();
                string imgFunctionalLocProfilePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/FLocation.png";
                string uploaderPath = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/');

                UserControls.PagerData pagerData = new UserControls.PagerData();
                pagerData.PageIndex        = 0;
                pagerData.PageSize         = int.Parse(hdnPageSize.Value.ToString());
                pagerData.SelectMethod     = "LoadFunctionalLocationsInfo";
                pagerData.ServicePath      = webServicePath;
                pagerData.SiteID           = siteID;
                pagerData.UserID           = userID;
                pagerData.AccessLevelID    = accessLevelID;
                pagerData.LoadControlID    = btnUploadExcel.ClientID;
                pagerData.PageAccessRights = accessType.ToString();

                btnFLocationName.Attributes.Add("onclick", "javascript:SortTabs('" + btnFLocationName.ClientID + "','FunctionalLoc');");
                btnUpdateOn.Attributes.Add("onclick", "javascript:SortTabs('" + btnUpdateOn.ClientID + "','UpdateOn');");

                if (accessType == AccessType.FULL_ACCESS)
                {
                    btnAddNewFunctionalLocation.Attributes.Add("onclick", "javascript:AddUpdateNewFunctionalLoaction(" + (new JavaScriptSerializer()).Serialize(0) + ");return false;");
                    uploadFile.Attributes.Add("onchange", "javascript:UploadFunctionalLocationInfo();return false;");
                }
                else
                {
                    btnAddNewFunctionalLocation.Attributes.Add("disabled", "disabled");
                    btnUploadExcel.Attributes.Add("disabled", "disabled");
                }

                ScriptManager.RegisterStartupScript(this, this.GetType(), "InitFunctionalLocationInfo", "javascript:InitFunctionalLocationInfo(" + (new JavaScriptSerializer()).Serialize(pagerData) + ",'" + basePath + "','" + imgFunctionalLocProfilePath + "','" + uploaderPath + "','" + hasEditAccess + "','" + hasDeleteAccess + "'," + (new JavaScriptSerializer()).Serialize(filterLocationIds.Split(',')) + ");", true);
            }
        }
Esempio n. 32
0
        public void InitialiseWorkflow()
        {
            //TODO: Error Checking

            int    StartNodeId;
            int    NodeId;
            int    AccessType;
            int    RelationType;
            int    RelativeGroupId;             //This will need to be an array in later iterations, to allow for multiple branches
            String StartNodeText = "Start";

            ApprovalProcessType TypeDefinition;
            BranchNode          NodeDef;
            GroupRoleRelation   GroupRels;
            TaskAssignment      TA;
            TaskNode            TN;
            ReviewTask          reviewTask; //Can't be called Task as that causes interesting things to happen since .net defines a Task type already

            //Get Start Node for this Workflow Process Type
            TypeDefinition = db.ApprovalProcessTypes.FirstOrDefault(a => a.ApprovalProcessId.Equals(ApprovalProcessId));
            StartNodeId    = (int)TypeDefinition.StartNodeId;
            //Get Relationship to use to send this Node off for approval
            NodeDef = db.BranchNodes.FirstOrDefault(a => a.NodeId.Equals(StartNodeId) && a.Type.Equals(StartNodeText));
            //Note forcing one row returned from NodeDef
            NodeId       = NodeDef.NodeId;
            AccessType   = (int)NodeDef.AccessType;
            RelationType = NodeDef.RelationTypeId;
            //Just done one group for demonstration purposes
            //&& a.RelationTypeId.Equals(RelationType)
            //Has value
            GroupRels       = db.GroupRoleRelations.FirstOrDefault(a => a.ApprovalProcessId == ApprovalProcessId && a.MasterGroupId == MasterGroupId && a.RelationTypeId.Equals(RelationType));
            RelativeGroupId = (int)GroupRels.RelativeGroupId;


            reviewTask = new ReviewTask();
            TA         = new TaskAssignment();
            TN         = new TaskNode();


            reviewTask.ApprovalProcessType = ApprovalProcessId;
            reviewTask.RaiserUserId        = RaiserUserId;
            reviewTask.Status      = "I";
            reviewTask.DateUpdated = System.DateTime.Today;

            db.ReviewTasks.Add(reviewTask);
            db.SaveChanges();

            TA.AccessType   = AccessType.ToString();
            TA.DateAssigned = System.DateTime.Today;
            TA.GroupId      = RelativeGroupId;
            TA.TaskId       = reviewTask.TaskId;
            TA.NodeId       = NodeId;
            db.TaskAssignments.Add(TA);

            TN.NodeId      = NodeId;
            TN.GroupId     = RelativeGroupId;
            TN.TaskId      = reviewTask.TaskId;
            TN.DateUpdated = System.DateTime.Today;
            db.TaskNodes.Add(TN);

            db.SaveChanges();

            //Should really return a success/fail indicator here
        }