-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadminoptions.cs
122 lines (100 loc) · 4.43 KB
/
adminoptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
namespace Saiyagym
{
class user1options //EL USUARIO 1 PUEDE AGREGAR, MODIFICAR, VENDER Y ELIMINAR
{
static int option;
static int retorno;
public user1options()
{
MAINMENU:
Console.WriteLine("1. AGREGAR UN CLIENTE \n 2.ABONO MENSUAL \n 3.PUNTO DE VENTA \n 4.ELIMINAR CLIENTE");
option = Convert.ToInt32(Console.ReadLine());
switch(option)
{
case 1:
clientfields op1 = new clientfields();
retorno = 0;
Console.WriteLine("ID");
op1.id_client = Convert.ToInt32(Console.ReadLine());
SqlCommand comando1 = new SqlCommand(string.Format("Insert into clients(id_client) values ('{0}')", op1.id_client));
retorno = comando1.ExecuteNonQuery();
goto MAINMENU;
case 2:
clientfields op2 = new clientfields();
retorno = 0;
Console.WriteLine("Introduzca ID del cliente");
op2.id_client = Convert.ToInt32(Console.ReadLine());
//Console.WriteLine("Estado");
op2.status = true;
Console.WriteLine("Avisos");
op2.advice = Convert.ToString(Console.ReadLine());
SqlCommand comando2 = new SqlCommand(string.Format("Insert into clients(id_client, status, advice) values ('{0}','{1}','{2}')",
op2.id_client, op2.status, op2.advice));
retorno = comando2.ExecuteNonQuery();
goto MAINMENU;
case 3:
break;
case 4:
clientfields op4 = new clientfields();
retorno = 0;
Console.WriteLine("ID");
op4.id_client = Convert.ToInt32(Console.ReadLine());
SqlCommand comando4 = new SqlCommand(string.Format("Delete from clients(id_client) values ('{0}')", op4.id_client));
retorno = comando4.ExecuteNonQuery();
goto MAINMENU;
default:
Console.WriteLine("ERROR");
Console.ReadLine();
break;
}
}
}
class user2options
{
static int option;
static int retorno;
public user2options()
{
MAINMENU:
Console.WriteLine("1. AGREGAR UN CLIENTE \n 2.ABONO MENSUAL \n 3.PUNTO DE VENTA");
option = Convert.ToInt32(Console.ReadLine());
switch (option)
{
case 1:
clientfields op1 = new clientfields();
retorno = 0;
Console.WriteLine("ID");
op1.id_client = Convert.ToInt32(Console.ReadLine());
SqlCommand comando1 = new SqlCommand(string.Format("Insert into clients(id_client) values ('{0}')", op1.id_client));
retorno = comando1.ExecuteNonQuery();
goto MAINMENU;
case 2:
clientfields op2 = new clientfields();
retorno = 0;
Console.WriteLine("Introduzca ID del cliente");
op2.id_client = Convert.ToInt32(Console.ReadLine());
//Console.WriteLine("Estado");
op2.status = true;
Console.WriteLine("Avisos");
op2.advice = Convert.ToString(Console.ReadLine());
SqlCommand comando2 = new SqlCommand(string.Format("Insert into clients(id_client, status, advice) values ('{0}','{1}','{2}')",
op2.id_client, op2.status, op2.advice));
retorno = comando2.ExecuteNonQuery();
goto MAINMENU;
case 3:
break;
default:
Console.WriteLine("ERROR");
Console.ReadLine();
break;
}
}
} //EL USUARIO 2 NO PUEDE ELIMINAR
}