/// <summary> /// 简单查询 /// </summary> /// <param name="sql"></param> public List <CarDispatch> QueryGetList(string sql) { try { DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarDispatch> _list = ModelConvert.ToList <CarDispatch>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <CarDispatch> GetList() { try { string sql = string.Format("select * from t_car_dispatch"); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarDispatch> _list = ModelConvert.ToList <CarDispatch>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public CarApplySocialpeople GetModelByID(int id) { try { string sql = string.Format("select * from t_car_apply_socialpeople where ApplyID = {0}", id); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarApplySocialpeople> _list = ModelConvert.ToList <CarApplySocialpeople>(dt); return(_list.Count == 0 ? null : _list[0]); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <CarRepairItem> GetList() { try { string sql = string.Format(@"select a.*, b.EmployeeName from t_car_repair_item a left join t_employee b on a.OperateID = b.EmployeeID "); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarRepairItem> _list = ModelConvert.ToList <CarRepairItem>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <Department> GetList() { try { string sql = string.Format(@"select a.*, b.DepartmentName ParentName, c.EmployeeName InChargeName from t_department a left join t_department b on a.ParentID = b.DepartmentID left join t_employee c on a.InChargeID = c.EmployeeID"); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <Department> _list = ModelConvert.ToList <Department>(dt); return(_list); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <CarDispatch> GetListByState(int state) { try { string sql = string.Format(@"select a.*, b.EmployeeName, c.CarNo from t_car_dispatch a left join t_employee b on a.EmployeeID = b.EmployeeID left join t_car c on a.CarID = c.CarID where a.Status = {0}", state); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarDispatch> _list = ModelConvert.ToList <CarDispatch>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <CarriageReturn> GetList() { try { string sql = string.Format(@"select a.*, b.EmployeeName, c.CarNo, d.EmployeeName OperatorName from t_carriage_return a left join t_employee b on a.EmployeeID = b.EmployeeID left join t_car c on a.CarID = c.CarID left join t_employee d on a.OperatorID = d.EmployeeID"); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarriageReturn> _list = ModelConvert.ToList <CarriageReturn>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <CarRepairRecord> GetList() { try { string sql = string.Format(@"select a.*, b.EmployeeName CreatName, c.CarNo, d.RepairName from t_car_repair_record a left join t_employee b on a.CreatID = b.EmployeeID left join t_car c on a.CarID = c.CarID left join t_car_repair_item d on a.ItemStr = d.ItemID" ); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarRepairRecord> _list = ModelConvert.ToList <CarRepairRecord>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <Employee> GetList() { try { string sql = string.Format(@"select a.*, b.DepartmentName, c.EmployeeName OperateName from t_employee a left join t_department b on a.DepartmentID = b.DepartmentID left join t_employee c on a.OperateID = c.EmployeeID "); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <Employee> _list = ModelConvert.ToList <Employee>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary > /// 获得数据列表 /// </summary> /// <param name="sql"></param> public List <CarDispatchApply> GetNotAuditList() { try { string sql = string.Format(@"select a.*, b.EmployeeName, c.CarNo, d.EmployeeName OperatorName from t_car_dispatch_apply a left join t_employee b on a.EmployeeID = b.EmployeeID left join t_car c on a.CarID = c.CarID left join t_employee d on a.OperatorID = d.EmployeeID where a.Status = 1"); DataTable dt = MysqlHelper.ExecuteDataTable(sql); List <CarDispatchApply> _list = ModelConvert.ToList <CarDispatchApply>(dt); return(_list); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 执行存储过程,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close ) /// </summary> /// <param name="storedProcName">存储过程名</param> /// <param name="parameters">存储过程参数</param> /// <returns>MySqlDataReader</returns> protected List <T> RunProcedureGetList <T>(string storedProcName, ref QfParameter[] parameters) { var ds = Connector.RunProcedureDataSet(storedProcName, ref parameters); return(ModelConvert.ToList <T>(ds)); }
/// <summary> /// 执行存储过程,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close ) /// </summary> /// <param name="storedProcName">存储过程名</param> /// <param name="parameters">存储过程参数</param> /// <returns>MySqlDataReader</returns> protected List <T> RunProcedureGetList <T>(string storedProcName, ref Dictionary <string, QfParameter> parameters) { var ds = Connector.RunProcedure(storedProcName, ref parameters); return(ModelConvert.ToList <T>(ds)); }
/// <summary> /// 执行查询语句,返回List /// </summary> /// <param name="strSql">查询语句</param> /// <param name="cmdParms"></param> /// <returns>MySqlDataReader</returns> protected List <T> QueryGetList <T>(string strSql, params QfParameter[] cmdParms) { var ds = Connector.Query(strSql, cmdParms); return(ModelConvert.ToList <T>(ds)); }
/// <summary> /// 执行查询语句,返回List /// </summary> /// <param name="strSql">查询语句</param> /// <returns>MySqlDataReader</returns> protected List <T> QueryGetList <T>(string strSql) { var ds = Connector.Query(strSql); return(ModelConvert.ToList <T>(ds)); }