public C_ROUTE GetDataObject() { C_ROUTE DataObject = new C_ROUTE(); DataObject.ID = this.ID; DataObject.ROUTE_NAME = this.ROUTE_NAME; DataObject.DEFAULT_SKUNO = this.DEFAULT_SKUNO; DataObject.ROUTE_TYPE = this.ROUTE_TYPE; DataObject.EDIT_TIME = this.EDIT_TIME; DataObject.EDIT_EMP = this.EDIT_EMP; return(DataObject); }
/// <summary> /// 通過ID更新路由 /// </summary> /// <param name="newRoute"></param> /// <param name="DB"></param> /// <returns>成功返回大於零的數,失敗返回0</returns> public int UpdateById(C_ROUTE newRoute, OleExec DB) { string strSql = $@"update c_route set route_name=:route_name ,default_skuno=:default_skuno ,route_type=:route_type ,edit_time=:edit_time ,edit_emp=:edit_emp where id=:id"; OleDbParameter[] paramet = new OleDbParameter[6]; paramet[0] = new OleDbParameter(":route_name", newRoute.ROUTE_NAME); paramet[1] = new OleDbParameter(":default_skuno", newRoute.DEFAULT_SKUNO); paramet[2] = new OleDbParameter(":route_type", newRoute.ROUTE_TYPE); paramet[3] = new OleDbParameter(":edit_time", newRoute.EDIT_TIME); paramet[4] = new OleDbParameter(":edit_emp", newRoute.EDIT_EMP); paramet[5] = new OleDbParameter(":id", newRoute.ID); int result = DB.ExecuteNonQuery(strSql, CommandType.Text, paramet); return(result); }
/// <summary> /// 添加新的路由 /// </summary> /// <param name="newRoute">新的路由</param> /// <param name="DB"></param> /// <returns>成功返回大於零的數,失敗返回0</returns> public int Add(C_ROUTE newRoute, OleExec DB) { string strSql = $@"insert into c_route(id,route_name,default_skuno,route_type,edit_time,edit_emp)"; strSql = strSql + $@"values(:id,:route_name,:default_skuno,:route_type,:edit_time,:edit_emp)"; OleDbParameter[] paramet = new OleDbParameter[6]; paramet[0] = new OleDbParameter(":id", newRoute.ID); paramet[1] = new OleDbParameter(":route_name", newRoute.ROUTE_NAME); paramet[2] = new OleDbParameter(":default_skuno", newRoute.DEFAULT_SKUNO); paramet[3] = new OleDbParameter(":route_type", newRoute.ROUTE_TYPE); paramet[4] = new OleDbParameter(":edit_time", newRoute.EDIT_TIME); paramet[5] = new OleDbParameter(":edit_emp", newRoute.EDIT_EMP); int result = DB.ExecuteNonQuery(strSql, CommandType.Text, paramet); return(result); }