public int SaveEmsGoal(EmsGoalQuery query) { StringBuilder sql = new StringBuilder(); try { query.Replace4MySQL(); sql.Append("insert into ems_goal (`department_code`,`year`,`month`,`goal_amount`,`status`,`create_time`,`create_user`) "); sql.AppendFormat(" VALUES('{0}',{1} ,{2} ,{3} ,{4},'{5}',{6}); ",query.department_code,query.year,query.month,query.goal_amount,query.status,CommonFunction.DateTimeToString(query.create_time),query.user_userid); return _access.execCommand(sql.ToString()); } catch (Exception ex) { throw new Exception("EmsDao-->SaveEmsGoal-->"+sql.ToString()+ex.Message,ex); } }
public int EditEmsGoal(EmsGoalQuery query) { StringBuilder sql = new StringBuilder(); try { query.Replace4MySQL(); sql.AppendFormat("update ems_goal set goal_amount={0} where row_id={1};",query.goal_amount,query.row_id); return _access.execCommand(sql.ToString()); } catch (Exception ex) { throw new Exception("EmsDao-->EditEmsGoal-->" + sql.ToString() + ex.Message, ex); } }
public int VerifyData(EmsGoalQuery query) { StringBuilder sql = new StringBuilder(); try { query.Replace4MySQL(); sql.AppendFormat("select count(eg.row_id) as totalCount from ems_goal eg where eg.`year`={0} and eg.`month`={1} and eg.department_code='{2}'; ", query.year, query.month,query.department_code); DataTable _dt = _access.getDataTable(sql.ToString()); return Convert.ToInt32(_dt.Rows[0]["totalCount"]); } catch (Exception ex) { throw new Exception("EmsDao-->VerifyData-->"+sql.ToString()+ex.Message,ex); } }