public Model_RelationPaperTemp DataRowToModel(DataRow row) { Model_RelationPaperTemp temp = new Model_RelationPaperTemp(); if (row != null) { if (row["RelationPaperTemp_id"] != null) { temp.RelationPaperTemp_id = row["RelationPaperTemp_id"].ToString(); } if (row["RelationPaper_Id"] != null) { temp.RelationPaper_Id = row["RelationPaper_Id"].ToString(); } if (row["TestQuestions_Id"] != null) { temp.TestQuestions_Id = row["TestQuestions_Id"].ToString(); } if (row["CreateUser"] != null) { temp.CreateUser = row["CreateUser"].ToString(); } if (row["Two_WayChecklistDetail_Id"] != null) { temp.Two_WayChecklistDetail_Id = row["Two_WayChecklistDetail_Id"].ToString(); } } return(temp); }
public bool Add(Model_RelationPaperTemp model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into RelationPaperTemp("); builder.Append("RelationPaperTemp_id,RelationPaper_Id,TestQuestions_Id,CreateUser,Two_WayChecklistDetail_Id)"); builder.Append(" values ("); builder.Append("@RelationPaperTemp_id,@RelationPaper_Id,@TestQuestions_Id,@CreateUser,@Two_WayChecklistDetail_Id)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@RelationPaperTemp_id", SqlDbType.Char, 0x24), new SqlParameter("@RelationPaper_Id", SqlDbType.Char, 0x24), new SqlParameter("@TestQuestions_Id", SqlDbType.Char, 0x24), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@Two_WayChecklistDetail_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.RelationPaperTemp_id; cmdParms[1].Value = model.RelationPaper_Id; cmdParms[2].Value = model.TestQuestions_Id; cmdParms[3].Value = model.CreateUser; cmdParms[4].Value = model.Two_WayChecklistDetail_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Update(Model_RelationPaperTemp model) { StringBuilder builder = new StringBuilder(); builder.Append("update RelationPaperTemp set "); builder.Append("RelationPaper_Id=@RelationPaper_Id,"); builder.Append("TestQuestions_Id=@TestQuestions_Id,"); builder.Append("CreateUser=@CreateUser,"); builder.Append("Two_WayChecklistDetail_Id=@Two_WayChecklistDetail_Id"); builder.Append(" where RelationPaperTemp_id=@RelationPaperTemp_id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@RelationPaper_Id", SqlDbType.Char, 0x24), new SqlParameter("@TestQuestions_Id", SqlDbType.Char, 0x24), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@Two_WayChecklistDetail_Id", SqlDbType.Char, 0x24), new SqlParameter("@RelationPaperTemp_id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.RelationPaper_Id; cmdParms[1].Value = model.TestQuestions_Id; cmdParms[2].Value = model.CreateUser; cmdParms[3].Value = model.Two_WayChecklistDetail_Id; cmdParms[4].Value = model.RelationPaperTemp_id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_RelationPaperTemp> DataTableToList(DataTable dt) { List <Model_RelationPaperTemp> list = new List <Model_RelationPaperTemp>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_RelationPaperTemp item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Add(Model_RelationPaperTemp model) { return(this.dal.Add(model)); }
public bool Update(Model_RelationPaperTemp model) { return(this.dal.Update(model)); }