public int getIdcourse(String course_service) { int existe = 0; //bandera IDataReader idr = null; sb.Clear(); sb.Append("USE escuela_manejo;"); sb.Append("SELECT id_course_service FROM course_service WHERE name =" + "'" + course_service + "';"); try { con.AbrirCOnexion(); idr = con.Leer(CommandType.Text, sb.ToString()); if (idr.Read()) { existe = (Int32)idr["id_course_service"]; } return(existe); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); throw; } finally { idr.Close(); con.CerrarConexion(); } }//fin del metodo
public ListStore ListCourse() { ListStore data = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); IDataReader dr = null; sb.Clear(); sb.Append("SELECT id_vehicle,id_category,model,brand,plate,color,state FROM vehicle"); try { con.AbrirCOnexion(); dr = con.Leer(CommandType.Text, sb.ToString()); while (dr.Read()) { data.AppendValues(dr[0].ToString(), dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString(), dr[6].ToString()); //dr.Close(); }//fin de while return(data); } catch (Exception e) { ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, e.Message); ms.Run(); ms.Destroy(); throw; } finally { dr.Close(); con.CerrarConexion(); } }//fin del metodo
public ListStore getColumnsService(String course_service) { PaymentDetails tpaymentdetails = new PaymentDetails(); IDataReader idr = null; sb.Clear(); sb.Append("USE escuela_manejo;"); sb.Append("SELECT id_course_service, name, price, state FROM course_service WHERE name =" + "'" + course_service + "';"); try { con.AbrirCOnexion(); idr = con.Leer(CommandType.Text, sb.ToString()); while (idr.Read()) { datos.AppendValues(idr[0].ToString(), idr[1].ToString(), idr[2].ToString(), idr[3].ToString()); //benito.AppendValues(idr[0].ToString(), idr[1].ToString() , idr[2].ToString()); tpaymentdetails.Id_course_service = (Int32)idr[0]; DetailInfo.Add(tpaymentdetails); //dr.Close(); }//fin de while return(datos); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); throw; } finally { idr.Close(); con.CerrarConexion(); } }//fin del metodo
public bool SaveCourseOperating(CourseOperating ins) { bool guardado = false; //bandera int x = 0; //variable de control sb.Clear(); sb.Append("INSERT INTO course_operating "); sb.Append("(id_course,id_instructor,id_vehicle,id_customer,start_date,end_date)"); sb.Append(" VALUES('" + ins.Id_course + "','" + ins.Id_instructor + "','" + ins.Id_vehicle + "','" + ins.Id_customer + "','" + ins.Start_date + "','" + ins.End_date + "')"); try { con.AbrirCOnexion(); x = con.Ejecutar(CommandType.Text, sb.ToString()); if (x > 0) { guardado = true; ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Se guardo el curso con exito!!!"); ms.Run(); ms.Destroy(); } return(guardado); } catch (Exception e) { ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, e.Message); ms.Run(); ms.Destroy(); throw; } finally { con.CerrarConexion(); } } //fin del metodo
public bool Saverol(escuela_manejo.Rol trol) { bool guardado = false; //bandera int x = 0; //variable de control sb.Clear(); sb.Append("INSERT INTO Rol "); sb.Append("(Rol,state)"); sb.Append(" VALUES('" + trol.Rols + "','" + trol.State + "')"); try { con.AbrirCOnexion(); x = con.Ejecutar(CommandType.Text, sb.ToString()); if (x > 0) { guardado = true; ///ms = new MessageDialog(null, DialogFlags.Modal, //MessageType.Info, ButtonsType.Ok, "Se guardo el usuario con exito!!!"); //ms.Run(); //ms.Destroy(); } return(guardado); } catch (Exception e) { ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, e.Message); ms.Run(); ms.Destroy(); throw; } finally { con.CerrarConexion(); } }//fin del metodo
public bool SaveUser(User tus) { bool guardado = false; //bandera int x = 0; //variable de control sb.Clear(); sb.Append("INSERT INTO User "); sb.Append("(user,pwd,first_name,last_name,email,state,id,phone)"); sb.Append(" VALUES('" + tus.Username + "','" + tus.Pwd + "','" + tus.First_name + "','" + tus.Last_name + "','" + tus.Email + "','" + tus.State + "','" + tus.Id + "','" + tus.Phone + "')"); try { con.AbrirCOnexion(); x = con.Ejecutar(CommandType.Text, sb.ToString()); if (x > 0) { guardado = true; ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Se guardo el usuario con exito!!!"); ms.Run(); ms.Destroy(); } return(guardado); } catch (Exception e) { ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, e.Message); ms.Run(); ms.Destroy(); throw; } finally { con.CerrarConexion(); } }//fin del metodo
public bool SaveCourse(Course cour) { bool guardado = false; //bandera int x = 0; //variable de control sb.Clear(); sb.Append("INSERT INTO course "); sb.Append("(name,description)"); sb.Append(" VALUES('" + cour.Name + "','" + cour.Description + "')"); try { con.AbrirCOnexion(); x = con.Ejecutar(CommandType.Text, sb.ToString()); if (x > 0) { guardado = true; ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Se guardo el curso con exito!!!"); ms.Run(); ms.Destroy(); } return(guardado); } catch (Exception e) { ms = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, e.Message); ms.Run(); ms.Destroy(); throw; } finally { con.CerrarConexion(); } }//fin del metodo
public DTcoursesAdmin() { var conCoursesAd = new Connection.Connection(); conCoursesAd.AbrirCOnexion(); }
public DTsecurityAdmin() { var consecurityAd = new Connection.Connection(); consecurityAd.AbrirCOnexion(); }