public ActionResult EditPet(int?petid, String petName, String petType, String petColor, String petRace, int petOwner) { PETCAREEntities ef = new PETCAREEntities(); List <object> lista = new List <object>(); lista.Add(petName); lista.Add(petType); lista.Add(petColor); lista.Add(petRace); lista.Add(petOwner); Debug.WriteLine(petOwner); lista.Add(petid); Debug.WriteLine("ID consumido " + petOwner); object[] arr = lista.ToArray(); int rowAffected = ef.Database.ExecuteSqlCommand("update pets set petName=@p0, petType=@p1, petColor=@p2, petRace=@p3, customerOwnerId=@p4 where petId = @p5", arr); if (rowAffected > 0) { Debug.WriteLine("executed"); return(Redirect("petview")); } return(Redirect("petview")); }
public ActionResult GetPetToEdit(int?id) { PETCAREEntities ef = new PETCAREEntities(); pets pet = null; Debug.WriteLine(id); List <Object> AnotherDoubleModel = new List <Object>(); List <customers> clientes = ef.customers.SqlQuery("select * from customers").ToList <customers>(); List <pets> thefirstIs = ef.pets.SqlQuery("select * from pets").ToList <pets>(); if (id != null) { pet = ef.pets.SqlQuery("select * from pets where petId = @id", new SqlParameter("id", id)).FirstOrDefault(); thefirstIs.Insert(0, pet); } if (pet != null) { AnotherDoubleModel.Insert(0, thefirstIs); AnotherDoubleModel.Insert(1, clientes); Debug.WriteLine(pet.petName); } return(View(AnotherDoubleModel)); }
public ActionResult EditService(int?idserv, String serviceName, String serviceDescription, Decimal serviceMonto, DateTime serviceDuration, int servtypes) { PETCAREEntities ef = new PETCAREEntities(); List <object> lista = new List <object>(); lista.Add(serviceName); lista.Add(serviceDescription); lista.Add(serviceMonto); lista.Add(serviceDuration); lista.Add(servtypes); Debug.WriteLine(idserv); lista.Add(idserv); Debug.WriteLine("ID consumido " + idserv); object[] arr = lista.ToArray(); int rowAffected = ef.Database.ExecuteSqlCommand("update t_services set serviceName=@p0, serviceDescription=@p1, servicePrice=@p2, serviceDuration=@p3,serviceTypeId=@p4 where serviceId = @p5", arr); if (rowAffected > 0) { Debug.WriteLine("executed"); return(Redirect("servicesview")); } return(Redirect("servicesview")); }
public ActionResult EditEmployee(int?idemp, String employeeName, String employeeMail, Decimal employeeSalary, DateTime employeeBirthday, String employeePhone) { PETCAREEntities ef = new PETCAREEntities(); List <object> lista = new List <object>(); lista.Add(employeeName); lista.Add(employeeMail); lista.Add(employeeSalary); lista.Add(employeeBirthday); lista.Add(employeePhone); Debug.WriteLine(idemp); lista.Add(idemp); Debug.WriteLine("ID consumido " + idemp); object[] arr = lista.ToArray(); int rowAffected = ef.Database.ExecuteSqlCommand("update Employees set employeeName=@p0, employeeMail=@p1, employeeSalary=@p2, employeeBirthday=@p3,employeePhone=@p4 where employeeId = @p5", arr); if (rowAffected > 0) { Debug.WriteLine("executed"); return(Redirect("employeeview")); } return(Redirect("employeeview")); }
// obtiene los datos de la factura a editar public ActionResult GetServicesToEdit(int?id) { PETCAREEntities ef = new PETCAREEntities(); t_services serv = null; Debug.WriteLine(id); List <Object> AnotherDoubleModel = new List <Object>(); List <serviceType> types = ef.serviceType.SqlQuery("select * from serviceType").ToList <serviceType>(); List <t_services> thefirstIs = ef.t_services.SqlQuery("select * from t_services").ToList <t_services>(); if (id != null) { serv = ef.t_services.SqlQuery("select * from t_services where serviceId = @id", new SqlParameter("id", id)).FirstOrDefault(); thefirstIs.Insert(0, serv); } if (serv != null) { AnotherDoubleModel.Insert(0, thefirstIs); AnotherDoubleModel.Insert(1, types); Debug.WriteLine(serv.serviceName); } return(View(AnotherDoubleModel)); }
public ActionResult AddBill(int customerId, int serviceId, int employeeId, Decimal total) { PETCAREEntities db = new PETCAREEntities(); List <object> lista = new List <object>(); DateTime billDate = DateTime.Now; int userId = 1; lista.Add(billDate); lista.Add(userId); lista.Add(customerId); lista.Add(serviceId); lista.Add(employeeId); lista.Add(total); object[] arr = lista.ToArray(); int rowsAf = db.Database.ExecuteSqlCommand("insert into bill (billDate,userId,customerId,serviceId,employeeId,total)values (@p0,@p1,@p2,@p3,@p4,@p5)", arr); if (rowsAf > 0) { Debug.WriteLine("Agregado"); return(Redirect("billview")); } return(Redirect("billview")); }
public ActionResult Index() { PETCAREEntities x = new PETCAREEntities(); var utypeList = x.userstype.SqlQuery("select * from Userstype").ToList <userstype>(); return(View(utypeList)); }
// GET: Employees public ActionResult employeeview() { PETCAREEntities ef = new PETCAREEntities(); List <employees> empleados = ef.employees.SqlQuery("select * from Employees").ToList <employees>(); return(View(empleados)); }
public ActionResult DeleteEmployee(int?id) { PETCAREEntities db = new PETCAREEntities(); Debug.WriteLine(id); if (id != null) { db.Database.ExecuteSqlCommand("delete from employees where employeeId = @id", new SqlParameter("id", id)); return(RedirectToAction("employeeview", "Employees")); } return(View()); }
// GET: Services public ActionResult servicesview() { PETCAREEntities db = new PETCAREEntities(); List <t_services> serviceList = db.t_services.SqlQuery("select * from t_services").ToList <t_services>(); List <serviceType> types = db.serviceType.SqlQuery("select * from serviceType").ToList <serviceType>(); List <Object> DoubleViewModel = new List <Object>(); DoubleViewModel.Add(serviceList); DoubleViewModel.Add(types); return(View(DoubleViewModel)); }
// GET: Pets public ActionResult petview() { PETCAREEntities db = new PETCAREEntities(); List <pets> petList = db.pets.SqlQuery("select * from pets").ToList <pets>(); List <customers> clientes = db.customers.SqlQuery("select * from customers").ToList <customers>(); List <Object> DoubleViewModel = new List <Object>(); DoubleViewModel.Add(petList); DoubleViewModel.Add(clientes); return(View(DoubleViewModel)); }
// GET: Bill //test public ActionResult billview() { PETCAREEntities db = new PETCAREEntities(); List <t_services> serviceList = db.t_services.SqlQuery("select * from t_services").ToList <t_services>(); List <employees> emps = db.employees.SqlQuery("select * from employees").ToList <employees>(); List <customers> cust = db.customers.SqlQuery("select * from customers").ToList <customers>(); List <bill> bill_list = db.bill.SqlQuery("select * from bill").ToList <bill>(); List <Object> tripleViewModel = new List <Object>(); tripleViewModel.Add(serviceList); tripleViewModel.Add(emps); tripleViewModel.Add(cust); tripleViewModel.Add(bill_list); return(View(tripleViewModel)); }
public ActionResult AddServiceType(String serviceTypeName, String serviceTypeDescription) { PETCAREEntities d = new PETCAREEntities(); List <Object> list = new List <Object>(); list.Add(serviceTypeName); list.Add(serviceTypeDescription); object[] arr = list.ToArray(); int n_row = d.Database.ExecuteSqlCommand("insert into serviceType (serviceTypeName,serviceTypeDescription) values (@p0,@p1)", arr); if (n_row > 0) { return(RedirectToAction("servicesview", "Services")); } return(RedirectToAction("servicesview", "Services")); }
public ActionResult TryLogin(String UserName, String Password, String utype) { PETCAREEntities x = new PETCAREEntities(); var UserList = x.users.SqlQuery("select * from Users").ToList <users>(); foreach (var e in UserList) { if (e.userName == UserName && e.userPassword == Password && e.userstype.userTypeName == utype) { // Debug.WriteLine(e.userName); return(Redirect("welcomepage")); } else { // return Redirect("Index"); } } return(View(UserList)); }
public ActionResult GetEmployeesToEdit(int?id) { PETCAREEntities ef = new PETCAREEntities(); employees emp = null; Debug.WriteLine(id); this.id = id; if (id != null) { emp = ef.employees.SqlQuery("select * from employees where employeeId = @id", new SqlParameter("id", id)).FirstOrDefault(); } if (emp != null) { Debug.WriteLine(emp.employeeName); } return(View(emp)); }
public ActionResult AddEmployee(String employeeName, String employeeMail, Decimal employeeSalary, DateTime employeeBirthday, String employeePhone) { PETCAREEntities ef = new PETCAREEntities(); List <object> lista = new List <object>(); lista.Add(employeeName); lista.Add(employeeMail); lista.Add(employeeSalary); lista.Add(employeeBirthday); lista.Add(employeePhone); object[] arr = lista.ToArray(); int rowAffected = ef.Database.ExecuteSqlCommand("insert into Employees (employeeName,employeeMail,employeeSalary,employeeBirthday,employeePhone) values (@p0,@p1,@p2,@p3,@p4)", arr); if (rowAffected > 0) { Debug.WriteLine("executed"); return(Redirect("employeeview")); } return(Redirect("employeeview")); }
public ActionResult AddService(String serviceName, String serviceDescription, Decimal serviceMonto, DateTime serviceDuration, int servtypes) { PETCAREEntities db = new PETCAREEntities(); List <object> lista = new List <object>(); lista.Add(serviceName); lista.Add(serviceDescription); lista.Add(serviceMonto); lista.Add(serviceDuration); lista.Add(servtypes); object[] arr = lista.ToArray(); Debug.WriteLine(servtypes); int rowsAf = db.Database.ExecuteSqlCommand("insert into t_services (serviceName,serviceDescription,servicePrice,serviceDuration,serviceTypeId)values (@p0,@p1,@p2,@p3,@p4)", arr); if (rowsAf > 0) { Debug.WriteLine("Agregado"); return(Redirect("servicesview")); } return(Redirect("servicesview")); }
public ActionResult AddPet(String petName, String petType, String petColor, String petRace, int petOwner) { PETCAREEntities db = new PETCAREEntities(); List <object> lista = new List <object>(); lista.Add(petName); lista.Add(petType); lista.Add(petColor); lista.Add(petRace); lista.Add(petOwner); object[] arr = lista.ToArray(); Debug.WriteLine(petOwner); int rowsAf = db.Database.ExecuteSqlCommand("insert into pets (petName,petType,petColor,petRace,customerOwnerId)values (@p0,@p1,@p2,@p3,@p4)", arr); if (rowsAf > 0) { Debug.WriteLine("Agregado"); return(Redirect("petview")); } return(Redirect("petview")); }