Exemple #1
0
 /// <summary>
 /// Aus DropDown-Liste den ausgewählten User (bzw. dessen Uid) lesen, User-Objekt aus DB holen und in Session-Variable speichern
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     bll.clsUserFacade _myUsers     = new bll.clsUserFacade();
     bll.clsUser       _currentUser = _myUsers.UserGetById(Convert.ToInt32(ddlUsers.SelectedValue));
     Session["CurrentUser"] = _currentUser;
     lblUser.Text           = "Hallo " + _currentUser.Name + " aus " + _currentUser.Address + "!";
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            bll.clsUserFacade  facade = new bll.clsUserFacade();
            List <bll.clsUser> user   = facade.UsersGetAll();

            //bll.clsUser usr;
            bll.clsOrderFacade          orfacade = new bll.clsOrderFacade();
            List <bll.clsOrderExtended> orders;

            double[] sumUser;
            sumUser = new double[user.Count];
            for (int i = 0; i < user.Count; i++)
            {
                orders = orfacade.OrdersGetByID(user.ElementAt(i).ID.ToString());
                for (int j = 0; j < orders.Count; j++)
                {
                    sumUser[i] = sumUser[i] + orders.ElementAt(j).OrderSum;
                }
            }

            double higest = 0;

            for (int i = 0; i < sumUser.Length; i++)
            {
                if (higest < sumUser.ElementAt(i))
                {
                    higest = sumUser.ElementAt(i);
                }
            }

            Label1.Text = higest.ToString();
        }
        /// <summary>
        /// Page_Load(): wird beim Aufruf der Seite aufgerfen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            bll.clsUserFacade _Users = new bll.clsUserFacade();

            lblCount1.Text      = Convert.ToString(_Users.CountUsers());
            lblCountActive.Text = Convert.ToString(_Users.CountActiveUsers());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bll.clsUserFacade facade = new bll.clsUserFacade();
            List<bll.clsUser> user = facade.UsersGetAll();
            //bll.clsUser usr;
            bll.clsOrderFacade orfacade = new bll.clsOrderFacade();
            List<bll.clsOrderExtended> orders;
            double[] sumUser;
            sumUser = new double[user.Count];
            for(int i = 0; i < user.Count; i++)
            {

                orders =orfacade.OrdersGetByID(user.ElementAt(i).ID.ToString());
                for (int j =0; j<orders.Count; j++)
                {
                    sumUser[i] = sumUser[i] + orders.ElementAt(j).OrderSum;
                }
            }

            double higest = 0;
            for(int i = 0; i < sumUser.Length; i++)
            {
                if (higest < sumUser.ElementAt(i))
                {
                    higest = sumUser.ElementAt(i);
                }
            }

            Label1.Text = higest.ToString();
        }
Exemple #5
0
 /// <summary>
 /// PageLoad(): beim ersten Aufruf (GET): uid aus Parameter auslesen, zugehörigen User lesen, Felder in Form befüllen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.Request.Params.GetKey(0) == "uid")
     {   // wir erwarten als Parameter "uid" beim Seitenaufruf  eine UserId
         int _uid = Convert.ToInt32(Page.Request.Params.GetValues(0)[0]);
         if (!IsPostBack)
         {
             lblMsg.Text = "GET: " + Page.Request.Params.GetKey(0) + " " + _uid.ToString(); // nur zur Ablaufverfolgung
             bll.clsUserFacade _Users  = new bll.clsUserFacade();
             bll.clsUser       _myUser = _Users.UserGetById(_uid);                          // User lesen
             txtName.Text          = _myUser.Name;
             txtAddress.Text       = _myUser.Address;
             txtPassword.Text      = _myUser.Password;
             txtDistanz.Text       = _myUser.Distance.ToString();;
             chkIsActive.Checked   = _myUser.IsActive;
             rblRole.SelectedValue = _myUser.Role.ToString();
         }
         else
         {                                                                                   // Postback: Benutzer hat die Änderungen gemacht und will sie speichern
             // Speicherung wird in btnUpdate_Click() gemacht
             lblMsg.Text = "POST: " + Page.Request.Params.GetKey(0) + " " + _uid.ToString(); // nur zur Ablaufverfolgung
         }
     }
     else
     {
         lblMsg.Text = "Error Parameter: " + Page.Request.Params.GetKey(0);
     }
 }   // Page_load()
 /// <summary>
 /// Aus DropDown-Liste den ausgewählten User (bzw. dessen Uid) lesen, User-Objekt aus DB holen und in Session-Variable speichern
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     bll.clsUserFacade _myUsers = new bll.clsUserFacade();
     bll.clsUser _currentUser = _myUsers.UserGetById(Convert.ToInt32(ddlUsers.SelectedValue));
     Session["CurrentUser"] = _currentUser;
     lblUser.Text = "Hallo " + _currentUser.Name + " aus " + _currentUser.Address + "!";
 }
        /// <summary>
        /// Page_Load(): wird beim Aufruf der Seite aufgerfen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            bll.clsUserFacade _Users = new bll.clsUserFacade();

            lblCount1.Text = Convert.ToString(_Users.CountUsers());
            lblCountActive.Text = Convert.ToString(_Users.CountActiveUsers());
        }
        protected void btnUnregister_Click(object sender, EventArgs e)
        {
            int  i     = 0;
            bool found = false;

            bll.clsUserFacade  Users = new bll.clsUserFacade();
            List <bll.clsUser> List;

            List = Users.UsersGetAll();

            while (i < List.Count && found == false)
            {
                if (inUsername.Text == List.ElementAt(i).Name)
                {
                    found = true;
                }
                else
                {
                    i = i + 1;
                }
            }
            if (found)
            {
                if (inPassword.Text == List.ElementAt(i).Password)
                {
                    List.ElementAt(i).IsActive = false;
                    Response.Redirect("Default.apsx");
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = "Das Passwort ist Falsch";
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = "Das User ist Falsch";
            }
        }
Exemple #9
0
        }   // Page_load()

        /// <summary>
        /// btnUpdate_Click(): Änderungen des Users in DB speichern
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            bll.clsUserFacade _Users   = new bll.clsUserFacade();
            bll.clsUser       _updUser = new bll.clsUser();
            _updUser.ID       = Convert.ToInt32(Page.Request.Params.GetValues(0)[0]);
            _updUser.Name     = txtName.Text;
            _updUser.Address  = txtAddress.Text;
            _updUser.Password = txtPassword.Text;
            _updUser.Distance = Convert.ToInt32(txtDistanz.Text);
            _updUser.IsActive = chkIsActive.Checked;
            _updUser.Role     = Convert.ToInt32(rblRole.SelectedValue);
            bool result = _Users.UserUpdate(_updUser);       // Update in DB

            if (result)
            {
                lblMsg.Text += " Update erfolgreich";
            }
            else
            {
                lblMsg.Text += " Update nicht erfolgreich";
            }
        } // btnUpdate_Click()
        protected void btnUnregister_Click(object sender, EventArgs e)
        {
            int i = 0;
            bool found = false;
            bll.clsUserFacade Users = new bll.clsUserFacade();
            List<bll.clsUser> List;
            List = Users.UsersGetAll();

            while (i < List.Count && found == false)
            {
                if (inUsername.Text == List.ElementAt(i).Name)
                {
                    found = true;
                }
                else
                {
                    i = i + 1;
                }

            }
            if (found)
            {
                if (inPassword.Text == List.ElementAt(i).Password)
                {
                    List.ElementAt(i).IsActive = false;
                    Response.Redirect("Default.apsx");
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text = "Das Passwort ist Falsch";
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text = "Das User ist Falsch";
            }
        }
Exemple #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int  i     = 0;
            bool found = false;

            bll.clsUserFacade  Users = new bll.clsUserFacade();
            List <bll.clsUser> List;

            List = Users.UsersGetAll();

            while (i < List.Count && found == false)
            {
                if (inUser.Text == List.ElementAt(i).Name)
                {
                    found = true;
                }
                else
                {
                    i = i + 1;
                }
            }
            if (found)
            {
                if (inPassword.Text == List.ElementAt(i).Password)
                {
                    if (List.ElementAt(i).IsActive)
                    {
                        Session.RemoveAll();

                        Session.Add("Current User", List.ElementAt(i));
                        Response.Redirect("Redirect.aspx");
                    }
                    //if(List.ElementAt(i).Role == 0)
                    //{
                    //    Response.Redirect("Costumer/CostumerDefault.aspx");
                    //}
                    //else
                    //{
                    //    if (List.ElementAt(i).Role == 1)
                    //    {
                    //        Response.Redirect("Manager/ManagerDefault.aspx");
                    //    }
                    //    else
                    //    {
                    //        Response.Redirect("Worker/WorkerDefault.aspx");
                    //    }
                    //}

                    //Response.Redirect("default.aspx");

                    else
                    {
                        lblError.Visible = true;
                        lblError.Text    = "Sie sind als Inaktiv Makiert und dürfen sich desswegen nicht Anmelden, bitte kontaktiren sie uns wenn wir sie wieder aktiviren sollen.";
                    }
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = "Das Passwort ist nicht korrekt.";
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = "Dieser User existiert nicht.";
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            int i = 0;
            bool found = false;
            bll.clsUserFacade Users = new bll.clsUserFacade();
            List<bll.clsUser> List;
            List = Users.UsersGetAll();

            while (i < List.Count && found == false)
            {
                if (inUser.Text == List.ElementAt(i).Name)
                {
                    found = true;
                }
                else
                {
                    i = i + 1;
                }

            }
            if (found)
            {
                if (inPassword.Text == List.ElementAt(i).Password)
                {
                    if (List.ElementAt(i).IsActive) {
                        Session.RemoveAll();

                        Session.Add("Current User", List.ElementAt(i));
                        Response.Redirect("Redirect.aspx"); }
                    //if(List.ElementAt(i).Role == 0)
                    //{
                    //    Response.Redirect("Costumer/CostumerDefault.aspx");
                    //}
                    //else
                    //{
                    //    if (List.ElementAt(i).Role == 1)
                    //    {
                    //        Response.Redirect("Manager/ManagerDefault.aspx");
                    //    }
                    //    else
                    //    {
                    //        Response.Redirect("Worker/WorkerDefault.aspx");
                    //    }
                    //}

                    //Response.Redirect("default.aspx");

                    else
                    {
                        lblError.Visible = true;
                        lblError.Text = "Sie sind als Inaktiv Makiert und dürfen sich desswegen nicht Anmelden, bitte kontaktiren sie uns wenn wir sie wieder aktiviren sollen.";
                    } }
                else
                {
                    lblError.Visible = true;
                    lblError.Text = "Das Passwort ist nicht korrekt.";
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text = "Dieser User existiert nicht.";
            }
        }