Beispiel #1
0
        public static void StartApplication()
        {
            if (Disabled || startWasCalled || Initializer.Executed)
            {
                return;
            }
            try
            {
                lock (lockObject)
                {
                    var disabled = WebConfigurationManager.AppSettings["BoC.Web.DisableAutoStart"];
                    if ("true".Equals(disabled, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Disabled = true;
                        return;
                    }

                    if (startWasCalled)
                    {
                        return;
                    }

                    Initializer.Execute();
                    startWasCalled = true;
                }
            }
            catch
            {
                InfrastructureHelper.UnloadAppDomain();
                throw;
            }
        }
        public static void StartApplication()
        {
            if (startWasCalled || Initializer.Executed)
            {
                return;
            }

            try
            {
                lock (lockObject)
                {
                    if (startWasCalled)
                    {
                        return;
                    }
                    Initializer.Execute();
                    startWasCalled = true;
                }
            }
            catch
            {
                InfrastructureHelper.UnloadAppDomain();
                throw;
            }
        }
Beispiel #3
0
        private static void OnChanged(string key, object value, CacheItemRemovedReason reason)
        {
            // Only handle case when the dependency has changed.
            if (reason != CacheItemRemovedReason.DependencyChanged)
            {
                return;
            }

            // Scan the app root for a webpages file
            if (
                WebPagesDeployment.AppRootContainsWebPagesFile(
                    _physicalFileSystem,
                    HttpRuntime.AppDomainAppPath
                    )
                )
            {
                // Unload the app domain so we register plan9 when the app restarts
                InfrastructureHelper.UnloadAppDomain();
            }
            else
            {
                // We need to re-register since the item was removed from the cache
                RegisterForChangeNotifications();
            }
        }
Beispiel #4
0
        public ActionResult AddRooms()
        {
            InfrastructureHelper helper = new InfrastructureHelper();

            ViewBag.hostelBlocks = new SelectList(helper.GetHostelBlocks(), "blockNumber", "blockNumber");
            ViewBag.roomTypes    = new SelectList(helper.GetRoomTypes(), "id", "val");

            return(View());
        }
Beispiel #5
0
        public ActionResult AddHostel(AddHostelViewModel userInput)
        {
            StudentHelper        helper  = new StudentHelper();
            InfrastructureHelper helper1 = new InfrastructureHelper();

            ViewBag.genderList = new SelectList(helper.GetGenders(), "id", "val");

            return(Json(helper1.AddHostel(userInput), JsonRequestBehavior.AllowGet));
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            ErrorTableRow.Style.Add("display", "none");
            signInBtnWrap.Style.Add("margin-top", "10px");

            //User pass is set on the client side because of devexpress restrictions of texbox attribute password

            VnosUporabnik.Text = InfrastructureHelper.GetCookieValue(Enums.UserCredentialCookie.User.ToString());
        }
Beispiel #7
0
 internal static void ThrowIfCodeDomDefinedExtension(string virtualPath, HttpException e)
 {
     if (e is HttpCompileException)
     {
         var extension = Path.GetExtension(virtualPath);
         if (InfrastructureHelper.IsCodeDomDefinedExtension(extension))
         {
             throw new HttpException(String.Format(CultureInfo.CurrentCulture, WebPageResources.WebPage_FileNotSupported, extension, virtualPath));
         }
     }
 }
Beispiel #8
0
 private Building[] InitializeArray(int length, Account acc)
 {
     Building[] array = new Building[length];
     for (int i = 0; i < length; ++i)
     {
         var building = new Building();
         building.Init(i + 1, 0, 0, false);
         array[i] = building;
     }
     array[39].Type = InfrastructureHelper.GetTribesWall(acc.AccInfo.Tribe);
     array[38].Type = Helpers.Classificator.BuildingEnum.RallyPoint;
     return(array);
 }
Beispiel #9
0
        public ActionResult AddRooms(Room userInput)
        {
            InfrastructureHelper helper = new InfrastructureHelper();

            ViewBag.hostelBlocks = new SelectList(helper.GetHostelBlocks(), "blockNumber", "blockNumber");
            ViewBag.roomTypes    = new SelectList(helper.GetRoomTypes(), "id", "val");

            if (!ModelState.IsValid)
            {
                return(View(userInput));
            }

            helper.AddRoom(userInput);

            return(View());
        }
        protected void ASPxButton_Potrdi(object sender, EventArgs e)
        {
            Authentication auth          = new Authentication();
            bool           signInSuccess = false;
            string         message       = "";
            string         username      = CommonMethods.Trim(VnosUporabnik.Text);
            string         password      = CommonMethods.Trim(VnosGeslo.Text);

            try
            {
                if (username != "" && password != "")
                {
                    signInSuccess = auth.Authenticate(username, password);
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }


            string url = Session["PreviousPage"].ToString();

            if (signInSuccess)
            {
                ClientScript.RegisterStartupScript(GetType(), "ANY_KEY", string.Format("window.parent.OnClosePopupEventHandler_Prijava('{0}','{1}');", "Potrdi", url), true);
                ClientScript.RegisterStartupScript(GetType(), "ANY_KEY", "clientLoadingPanel.Hide();", true);

                InfrastructureHelper.SetCookieValue(Enums.UserCredentialCookie.User.ToString(), VnosUporabnik.Text);
                if (RememberMe.Checked)
                {
                    InfrastructureHelper.SetCookieValue(Enums.UserCredentialCookie.UserPass.ToString(), VnosGeslo.Text);
                }
                else//if we don't want to system to save our pass we uncheck checkbox and the cookie will be removed
                {
                    InfrastructureHelper.TryRemoveCookie(Enums.UserCredentialCookie.UserPass.ToString());
                }

                Session.Remove("PreviousPage");
            }
            else
            {
                txtError.Text = "Napačna prijava! Pnovno vnesi geslo in uporabniško ime!";
                ErrorTableRow.Style.Add("display", "block");
                signInBtnWrap.Style.Add("margin-top", "0");
            }
        }
        public static List <Building> GetBuildings(Account acc, HtmlAgilityPack.HtmlDocument htmlDoc)
        {
            var             fields    = htmlDoc.GetElementbyId("village_map").ChildNodes.Where(x => x.Name == "div").ToList();
            List <Building> buildings = new List <Building>();

            for (byte i = 0; i < fields.Count; i++)
            {
                var vals = fields[i].GetAttributeValue("class", "").Split(' ');

                var location = (int)Parser.RemoveNonNumeric(vals.FirstOrDefault(x => x.StartsWith("a")));
                if (location <= 18 || location > 40)
                {
                    continue;
                }

                var gid = Convert.ToByte(vals.FirstOrDefault(x => x.StartsWith("g")).Replace("g", ""));

                byte lvl;
                var  lvlNode = fields[i].Descendants("div").FirstOrDefault(x => x.HasClass("labelLayer"));
                if (lvlNode == null)
                {
                    lvl = 0;
                }
                else
                {
                    lvl = Convert.ToByte(lvlNode.InnerText);
                }

                var uc = fields[i].Descendants("div").FirstOrDefault(x => x.HasClass("underConstruction")) != null;
                //var b = fields[i].Child
                var building = new Building();
                buildings.Add(building.Init(
                                  location,
                                  lvl,//Convert.ToByte(vals[4].Replace("level", "")),
                                  gid,
                                  uc
                                  ));
            }
            buildings.FirstOrDefault(x => x.Id == 39).Type = Helpers.Classificator.BuildingEnum.RallyPoint;
            buildings.FirstOrDefault(x => x.Id == 40).Type = InfrastructureHelper.GetTribesWall(acc.AccInfo.Tribe);
            return(buildings);
        }
Beispiel #12
0
 private static void ShutdownCallBack(object state)
 {
     InfrastructureHelper.UnloadAppDomain();
 }