//插入数据 public int Insert(unit_info obj) { try { int count = PostgreHelper.InsertSingleEntity <unit_info>(obj); return(count); } catch (Exception ex) { throw ex; } }
//更新数据 public int Update(unit_info obj) { try { string sql = "Update fimp.unit_info set unit_no='{0}',unit_name_en='{1}',unit_name_tw='{2}',unit_name_cn='{3}',dept_id='{4}' where seq={5}"; sql = string.Format(sql, obj.unit_no, obj.unit_name_en, obj.unit_name_tw, obj.unit_name_cn, obj.dept_id, obj.seq); int count = PostgreHelper.ExecuteNonQuery(sql); return(count); } catch (Exception ex) { throw ex; } }
//查询单笔数据,通过制程编码搜索 public unit_info SelectSingle(string unit_no = null, int id = 0) { try { unit_info obj = new unit_info(); string sql = null; if (!string.IsNullOrEmpty(unit_no)) { sql = "SELECT * FROM fimp.unit_info where unit_no='{0}' order by seq"; sql = string.Format(sql, unit_no); } else if (id > 0) { sql = "SELECT * FROM fimp.unit_info where seq={0} order by seq"; sql = string.Format(sql, id); } obj = PostgreHelper.GetSingleEntity <unit_info>(sql); return(obj); } catch (Exception ex) { throw ex; } }
public int Update(unit_info obj) { int count = UIS.Update(obj); return(count); }
public int Insert(unit_info obj) { int count = UIS.Insert(obj); return(count); }
public unit_info SelectSingle(string unit_no = null, int id = 0) { unit_info obj = UIS.SelectSingle(unit_no: unit_no, id: id); return(obj); }