Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string nume = textBox1.Text;
            string prenume = textBox2.Text;
            string cnp = textBox3.Text;
            int    varsta, clasa;

            try { varsta = int.Parse(textBox4.Text); } catch (Exception) { varsta = -1; }
            try { clasa = int.Parse(textBox5.Text); } catch (Exception) { clasa = -1; }

            if (!string.IsNullOrWhiteSpace(nume) && !string.IsNullOrWhiteSpace(prenume) && !string.IsNullOrWhiteSpace(cnp) && varsta != -1 && clasa != -1)
            {
                ElevEntity elevEntity = new ElevEntity(Guid.NewGuid().ToString(), cnp);
                elevEntity.Nume    = nume;
                elevEntity.Prenume = prenume;
                elevEntity.Varsta  = varsta;
                elevEntity.Clasa   = clasa;

                Task.Run(() => { MasterRepository.EleviRepository.AdaugaElevAsyncTask(elevEntity); });

                textBox1.Text = string.Empty;
                textBox2.Text = string.Empty;
                textBox3.Text = string.Empty;
                textBox4.Text = string.Empty;
                textBox5.Text = string.Empty;
            }
            else
            {
                MessageBox.Show("Completati toate datele!");
            }
        }
Beispiel #2
0
        public async Task AdaugaElevAsyncTask(ElevEntity elev)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=storeksq6lvimcn6gy;AccountKey=okS17G921c6N5lN7Czxi1QJ+DF/fbripzaWiEDoRdp4oh42RoJFz3A5Nfn70dHaoh3mUaFzQIcu9MVDTeHmmiQ==;EndpointSuffix=core.windows.net");

            // Create a table client for interacting with the table service
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create a table client for interacting with the table service
            CloudTable table = tableClient.GetTableReference("elevipssc");
            await table.CreateIfNotExistsAsync();

            var insertOrReplaceOperation = TableOperation.InsertOrReplace(elev);
            await table.ExecuteAsync(insertOrReplaceOperation);
        }
Beispiel #3
0
        private async void button1_ClickAsync(object sender, EventArgs e)
        {
            string cnp = textBox1.Text;

            await Task.Run(async() => { elevGasit = await MasterRepository.EleviRepository.GetElevAsyncTask(cnp); });

            if (elevGasit != null)
            {
                textBox2.Text   = elevGasit.Nume;
                textBox3.Text   = elevGasit.Prenume;
                textBox4.Text   = elevGasit.RowKey;
                textBox5.Text   = elevGasit.Varsta.ToString();
                textBox6.Text   = elevGasit.Clasa.ToString();
                button2.Enabled = true;
            }
        }
        public VeziNoteEleviForm()
        {
            InitializeComponent();

            Task.Run(async () => { note = await MasterRepository.EleviRepository.GetAllNoteAsyncTask(); }).Wait();

            listBox1.Items.Add("Nume\tPrenume\tClasa\tMaterie\tNota");
            listBox1.Items.Add("");
            for(int i = 0; i < note.Count; i++)
            {
                ElevModel elev = null;
                Task.Run(async () => {
                    ElevEntity entity = await MasterRepository.EleviRepository.GetElevAsyncTask(note[i].RowKey);
                    elev = new ElevModel();
                    elev.setId(entity.PartitionKey);
                    elev.setCnp(entity.RowKey);
                    elev.setNume(entity.Nume);
                    elev.setPrenume(entity.Prenume);
                    elev.setVarsta(entity.Varsta);
                    elev.setClasa(entity.Clasa);
                }).Wait();
                listBox1.Items.Add(elev.getInfo(note[i].Materie, note[i].Nota));
            }
        }