Example #1
0
        static void Main(string[] args)
        {
            var dbServer = "localhost";
            var dbUsername = "******";
            var dbName = "projectalpha";
            var dbPassword = "";
            DAOConnection daoConnection = new DAOConnection(dbServer, dbUsername, dbPassword, dbName);

            Console.WriteLine("Try connect to database");
            while (!daoConnection.TestConnection())
            {
                Console.WriteLine("DB connection failed");
            }
            Console.WriteLine("DB connection was successful");
            string url = "http://localhost:8000/DEMOService";
            WebService.WebService webService = new WebService.WebService(url);
            webService.StartWebService();
            Console.WriteLine("WebService Running");
            Console.WriteLine("----------------------------------");
            Console.WriteLine("URL: " + webService.URL);
            Console.WriteLine("DB Connection ");
            Console.ReadKey();
            webService.StopWebService();
            Console.WriteLine("WebService was stopped");
        }
Example #2
0
        /// <summary>
        /// Methode om een auto te huren.
        /// </summary>
        /// <param name="Klant_ID"></param>
        /// <param name="Auto_ID"></param>
        /// <param name="Van"></param>
        /// <param name="Tot"></param>
        /// <returns>boolean</returns>

        public static Boolean Huur(int Klant_ID,int Auto_ID,DateTime Van, DateTime Tot)
        {
            try
            {
                WebService.WebService ws = new WebService.WebService();
                ArrayList al = new ArrayList();

                if (Van > Tot)
                {
                    throw new InputException("Gelieve twee correcte data te kiezen.");
                }

                al.Add(Klant_ID);
                al.Add(Auto_ID);
                al.Add(Van);
                al.Add(Tot);

                //Toevoegen bij tblAuto dat deze auto niet meer beschikbaar is !

                if (ws.verhuur_add(al.ToArray()))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception)
            {               
                throw;
            }
        }
        public StudentRecord()
        {
            InitializeComponent();


            LabelUsername.Text = user.Username;
            LabelUserId.Text   = user.Id.ToString();


            // hide admin panel / content
            if (!isAdmin)
            {
            }



            //inits
            ws     = new WebService.WebService();
            dtFunc = new DTFunc();

            //DataGridViewMediaLibary.DataSource = userLogic.getAllUsers();
            //DataGridViewBookingHistory.DataSource = borrowLogic.getByUserForUserHistory(user.Id);
            //DataGridViewReservedHistory.DataSource = reservedLogic.getReservedHistory(user.Id);

            //DataGridViewMediaLibary.DataSource = ws.GetAllUsers();
            DataGridViewBookingHistory.DataSource  = ws.GetByUserForUserHistory(user.Id);
            DataGridViewReservedHistory.DataSource = ws.getReservedHistory(user.Id);
        }
Example #4
0
        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                string nome = this.txtNome.Text;
                string email = this.txtEmail.Text;
                string login = this.txtLogin.Text;
                string senha = this.txtSenha.Text;

                WebService.WebService ws = new WebService.WebService();

                bool result = ws.CadastrarUsuario(nome, email, login, senha);

                if (result)
                {
                    string from = "*****@*****.**";
                    string assunto = "Cadastro de Usuário - Controle de Gastos.";
                    string body = "Seu Cadastro no Controle de gastos foi realizado com sucesso. Acesse sua conta e comece a asar. http://controledegastos.com";
                    string smtp = "";
                    int porta = 0;
                    string usuario = "";
                    string senhaEmail = "";

                    Email.EnvioDeEmail EnvMail = new Email.EnvioDeEmail();
                    EnvMail.dispararEmail(email, string.Empty, string.Empty, from, assunto, body, 1, true, true, smtp, porta, usuario, senhaEmail);

                    Response.Redirect("~/Usuario/CadastroSucesso.aspx");
                }
            }
        }
        public Login()
        {
            InitializeComponent();

            BtnCheatLoggin.Visible     = true;
            ChkBoxIsAdminCheat.Visible = true;


            ws     = new WebService.WebService();
            dtFunc = new DTFunc(); //my class to work with dataTables
        }
Example #6
0
        public EditMediaLibary()
        {
            InitializeComponent();

            // connection inits
            ws     = new WebService.WebService();
            dtFunc = new DTFunc();

            //connect all dataGrids and show
            getAndShowDataGridViews();
        }
Example #7
0
        public StudentSettings()
        {
            InitializeComponent();

            LabelUsername.Text = user.Username;
            LabelUserId.Text   = user.Id.ToString();

            // hide admin panel / content
            if (!isAdmin)
            {
                PanelAdmin.Visible = false;
            }

            //inits connection
            ws     = new WebService.WebService();
            dtFunc = new DTFunc();
        }
        public SignUp()
        {
            InitializeComponent();

            PanelSignUpAdmin.Visible = false;

            // check if I have a user set
            // if true check if its admin
            // if not admin return to main menu
            if (currentUser != null)
            {
                if (currentUser.Userlevel != 1)
                {
                    PanelSignUpAdmin.Visible = true;
                    isAdmin = true;
                }
                else
                {
                    // they should not be able to get here once logged in unless they are an admin

                    //for more details go to STUDENT SETTINGS return btn method
                    Form mainform = Application.OpenForms["MainMenu"];

                    //reset signUp pg class vars
                    resetSignUpPgAdminStatus();

                    if (mainform != null)  //does not yet exist
                    {
                        mainform.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Your logged in but somehow have gotten to sign up page but not gone through mainMenu?");
                    }
                }
            }

            //get connection to db / logic
            //userLogic = new UserLogic();
            ws     = new WebService.WebService();
            dtFunc = new DTFunc();
        }
Example #9
0
        public StudentActivity()
        {
            InitializeComponent();

            LabelUsername.Text = user.Username;
            LabelUserId.Text   = user.Id.ToString();


            // hide admin panel / content
            if (!isAdmin)
            {
            }

            // init connection
            ws     = new WebService.WebService();
            dtFunc = new DTFunc();

            // get data for DGV's
            setDataForDataGridViews();
        }
        public DataGridViewRow activeMediaViewRow = null; //init as no row selected

        public MainMenu()
        {
            InitializeComponent();

            if (currentUser.Userlevel != 1)   // check if user is admin
            {
                isAdmin = true;
            }

            if (!isAdmin)    // depending on user level show different content
            {
                LabelStudentUsername.Text  = currentUser.Username;
                LabelStudentId.Text        = currentUser.Id.ToString();
                LabelAdminUsername.Visible = false;

                PanelMediaLibaryAdminBtns.Visible       = false;
                PanelStudentRowShowAdminContent.Visible = false;
            }
            else
            {
                LabelAdminUsername.Text = "Admin: " + currentUser.Username;
                PanelStudentRowShowStudentContent.Visible = false;
            }



            //inits
            dtFunc = new DTFunc();
            ws     = new WebService.WebService();


            //show all media
            // set data  source for data grid view
            // In this case a List<media>


            //DataGridViewMediaLibary.DataSource = mediaLogic.getAllMedia();
            DataGridViewMediaLibary.DataSource = ws.getAllMedia();
        }
 public WebServiceManagementSession(IWebServiceManagementConfiguration configuration, Caller caller)
 {
     service = new ConfigurableWebService(configuration);
     this.caller = caller;
 }
Example #12
0
        //Add button action
        private void AddButton_Click(object sender, EventArgs e)
        {
            string firstName   = NameText.Text;
            string lastName    = SurnameText.Text;
            string information = InformationText.Text;
            string text        = "photo_url";

            using (var w = new WebClient())
            {
                string clientID = "d4a165a802843b0";
                w.Headers.Add("Authorization", "Client-ID " + clientID);
                var values = new NameValueCollection
                {
                    { "image", Convert.ToBase64String(File.ReadAllBytes(@"Image1.jpg")) }
                };

                byte[] response = w.UploadValues("https://api.imgur.com/3/upload.xml", values);
                var    xx       = XDocument.Load(new MemoryStream(response)).ToString();
                // MessageBox.Show(xx);
            }

            if (errorcode1 == 0 || errorcode2 == 0 || string.IsNullOrWhiteSpace(firstName) || string.IsNullOrWhiteSpace(lastName) || string.IsNullOrWhiteSpace(information))
            {
                ErrorHandling.Show_Inserting_Error();
            }
            else
            {
                DatabaseInfo data = LazyData.Value;
                //data.Myevent += delegate (object ) { }
                var  connection = data.GetConfigInfo();
                User user       = new User(firstName, lastName, information);


                WebService.WebService service = new WebService.WebService();
                //service.InsertRow(user, connection);
                data.InsertRow(user, connection);// Inesrt row to table
                var Users = new List <User> {
                };
                //service.GetDataFromDatabase(Users, connection);
                data.GetDataFromDatabase(Users, connection);// Read information to Collectionion
                UsersInfo userPhoto   = new UsersInfo(firstName, lastName, text);
                var       UsersPhotos = new List <UsersInfo> {
                };
                data.GetDataFromDatabase(Users, connection);        // Read photo information to Collection
                var OrderedUsers = Users.OrderBy(p => p.FirstName); // Linq ordering by name ascending
                //var JoinedUsers = data.GroupJoinCollections(Users, UsersPhotos);
                var JoinedUsers = from p in OrderedUsers
                                  join c in UsersPhotos
                                  on p.FirstName equals c.FirstName
                                  select new
                {
                    PersonName    = p.FirstName,
                    PersonSurname = c.LastName,
                    PersonInfo    = p.Information,
                    PersonPhoto   = c.Text
                };


                NameText.Text        = String.Empty;
                SurnameText.Text     = String.Empty;
                InformationText.Text = String.Empty;
                ImageView.Image      = null;
                icon1.Image          = null;
                icon2.Image          = null;
            }
        }
 public WebServiceManagementSessionFactory(IWebServiceManagementConfiguration configuration)
 {
     this.configuration = configuration;
     service = new ConfigurableWebService(configuration);
 }