Ejemplo n.º 1
0
        public ModelEmployee Login(String SerialNumber, String Password)
        {
            var employee    = new ModelEmployee();
            var daoEmployee = new DaoEmployee();

            foreach (DataRow row in daoEmployee.Login(SerialNumber, Password).Rows)
            {
                employee.Name        = Convert.ToString(row["Name"]);
                employee.Departament = Convert.ToString(row["Departament"]);
                employee.SeriaNumber = Convert.ToString(row["SerialNumber"]);
                employee.IsTecnic    = Convert.ToInt32(row["IsTecnic"]);
            }
            return(employee);
        }
Ejemplo n.º 2
0
        public void AlterEmployee(ModelEmployee modelEmployee)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(sqlConnection()))
                {
                    string queryString = "UPDATE EMPLOYEE SET NAME = '" + modelEmployee.Name + "', DEPARTAMENT = '" + modelEmployee.Departament + "', SERIALNUMBER = '" + modelEmployee.SeriaNumber + "', ISTECNIC = '" + modelEmployee.IsTecnic + "', PASSWORD = '******' WHERE SERIALNUMBER = '" + modelEmployee.SeriaNumber + "'";

                    SqlCommand command = new SqlCommand(queryString, connection);
                    command.Connection.Open();
                    command.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        public void Save(ModelEmployee modelEmployee)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(sqlConnection()))
                {
                    string queryString = "INSERT INTO EMPLOYEE(NAME, DEPARTAMENT, SERIALNUMBER, ISTECNIC, PASSWORD) VALUES('" + modelEmployee.Name + "','" + modelEmployee.Departament + "','" + modelEmployee.SeriaNumber + "','" + modelEmployee.IsTecnic + "','" + modelEmployee.Password + "')";

                    SqlCommand command = new SqlCommand(queryString, connection);
                    command.Connection.Open();
                    command.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
        public List <ModelEmployee> ListEmployee()
        {
            var lista       = new List <ModelEmployee>();
            var daoEmployee = new DaoEmployee();

            foreach (DataRow row in daoEmployee.List().Rows)
            {
                var employee = new ModelEmployee();
                employee.Name        = Convert.ToString(row["Name"]);
                employee.Departament = Convert.ToString(row["Departament"]);
                employee.SeriaNumber = Convert.ToString(row["SerialNumber"]);
                employee.IsTecnic    = Convert.ToInt32(row["IsTecnic"]);

                lista.Add(employee);
            }
            return(lista);
        }