public static Draff getFromReader(IDataReader rd) { Draff Item = new Draff(); if (rd.FieldExists("D_ID")) { Item.ID = (Int32)(rd["D_ID"]); } if (rd.FieldExists("D_RowId")) { Item.RowId = (Guid)(rd["D_RowId"]); } return(Item); }
public static Draff SelectById(Int32 D_ID) { Draff Item = new Draff(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("D_ID", D_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblDraff_Select_SelectById_hoangda", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static Draff Insert(Draff Inserted) { Draff Item = new Draff(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("D_RowId", Inserted.RowId); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblDraff_Insert_InsertNormal_hoangda", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }