예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BudgetSession S = BudgetSession.Get(this);

            if (S.Authenticated())
            {
                Response.Redirect("Default.aspx");
                return;
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ManageDataSession Data = ManageDataSession.Get(this);

            Data.State = ManageDataState.Main;

            BudgetSession S = BudgetSession.Get(this);

            if (S.Authenticated())
            {
                S.LogOut();
            }

            Response.Redirect("Login.aspx");
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BudgetSession S = BudgetSession.Get(this);

            if (S.Authenticated())
            {
                navHome.Visible       = true;
                navManageData.Visible = true;
                navExchange.Visible   = true;
                navLogout.Visible     = true;
            }
            else
            {
                navLogin.Visible = true;
            }
        }
예제 #4
0
        protected void SignIn_Click(object sender, EventArgs e)
        {
            DAL           DbDAL = new DAL();
            BudgetSession S     = BudgetSession.Get(this);

            if (!S.LogIn(DbDAL, inputUsername.Value, inputPassword.Value))
            {
                labelError.InnerText = "Wrong username or password";
                labelError.Visible   = true;
                return;
            }

            if (S.Authenticated())
            {
                Response.Redirect("Default.aspx");
                return;
            }
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BudgetSession S = BudgetSession.Get(this);

            if (!S.Authenticated())
            {
                Response.Redirect("Login.aspx");
                return;
            }

            ManageDataSession Data = ManageDataSession.Get(this);

            if (Data.SelectedCurrency == null)
            {
                DAL DbDAL = new DAL();
                Data.SelectedCurrency = DbDAL.Select <Currency>().Where(C => C.Code == "HRK").First();
            }

            HandleShowState(Data, Data.State);
        }
예제 #6
0
        protected void Confirm_Click(object sender, EventArgs e)
        {
            ManageDataSession Data = ManageDataSession.Get(this);
            BudgetSession     S    = BudgetSession.Get(this);

            try {
                HandleStateConfirm(Data, S);
            } catch (DisplayException E) {
                labelError.Visible   = true;
                labelError.InnerText = E.Message;
                return;
            } catch (Exception E) when(!Debugger.IsAttached)
            {
                labelError.Visible   = true;
                labelError.InnerText = "Internal exception occured in HandleStateConfirm";
                return;
            }

            Server.TransferRequest(Request.Url.AbsolutePath, false);
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DbDAL = new DAL();

            if (BudgetSession.GetUser(DbDAL, "admin") == null)
            {
                BudgetSession.CreateUser(DbDAL, "admin");
                BudgetSession.ResetPassword(DbDAL, "admin", "root");
            }

            BudgetSession S = BudgetSession.Get(this);

            if (!S.Authenticated())
            {
                Response.Redirect("Login.aspx");
                return;
            }

            CreateMonthLists();
            Calculate(S.CurrentUser);
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BudgetSession S = BudgetSession.Get(this);

            if (!S.Authenticated())
            {
                Response.Redirect("Login.aspx");
                return;
            }

            DAL DbDAL = new DAL();

            Currency[] Currencies = DbDAL.Select <Currency>(new[] { new SQLiteParameter("@exchg", 1) }).ToArray();

            if (S.ExchangeCurrency == null)
            {
                S.ExchangeCurrency = Currencies.Where(C => C.Code == "EUR").First();
            }

            RefreshSelected(S);
            btnDropdown.Clear();

            foreach (var Cur in Currencies)
            {
                btnDropdown.AddItem(new DropdownEntry(Cur.Code));
            }

            btnDropdown.Bind();
            GenerateExchangeTable(DbDAL, Currencies, S);

            btnDropdown.OnSelect += (Entry) => {
                S.ExchangeCurrency = Currencies.Where(C => C.Code == Entry.Name).First();
                RefreshSelected(S);
                Server.TransferRequest(Request.Url.AbsolutePath, false);
            };
        }