public bool Add(Model_TestQuestions_Option model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into TestQuestions_Option("); builder.Append("TestQuestions_Option_Id,TestQuestions_Id,TestQuestions_OptionParent_OrderNum,TestQuestions_Option_Content,TestQuestions_Option_OrderNum,CreateTime,TestQuestions_Score_ID)"); builder.Append(" values ("); builder.Append("@TestQuestions_Option_Id,@TestQuestions_Id,@TestQuestions_OptionParent_OrderNum,@TestQuestions_Option_Content,@TestQuestions_Option_OrderNum,@CreateTime,@TestQuestions_Score_ID)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@TestQuestions_Option_Id", SqlDbType.Char, 0x24), new SqlParameter("@TestQuestions_Id", SqlDbType.Char, 0x24), new SqlParameter("@TestQuestions_OptionParent_OrderNum", SqlDbType.Int, 4), new SqlParameter("@TestQuestions_Option_Content", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@TestQuestions_Option_OrderNum", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@TestQuestions_Score_ID", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.TestQuestions_Option_Id; cmdParms[1].Value = model.TestQuestions_Id; cmdParms[2].Value = model.TestQuestions_OptionParent_OrderNum; cmdParms[3].Value = model.TestQuestions_Option_Content; cmdParms[4].Value = model.TestQuestions_Option_OrderNum; cmdParms[5].Value = model.CreateTime; cmdParms[6].Value = model.TestQuestions_Score_ID; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_TestQuestions_Option> DataTableToList(DataTable dt) { List <Model_TestQuestions_Option> list = new List <Model_TestQuestions_Option>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_TestQuestions_Option item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Update(Model_TestQuestions_Option model) { StringBuilder builder = new StringBuilder(); builder.Append("update TestQuestions_Option set "); builder.Append("TestQuestions_Id=@TestQuestions_Id,"); builder.Append("TestQuestions_OptionParent_OrderNum=@TestQuestions_OptionParent_OrderNum,"); builder.Append("TestQuestions_Option_Content=@TestQuestions_Option_Content,"); builder.Append("TestQuestions_Option_OrderNum=@TestQuestions_Option_OrderNum,"); builder.Append("CreateTime=@CreateTime,"); builder.Append("TestQuestions_Score_ID=@TestQuestions_Score_ID"); builder.Append(" where TestQuestions_Option_Id=@TestQuestions_Option_Id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@TestQuestions_Id", SqlDbType.Char, 0x24), new SqlParameter("@TestQuestions_OptionParent_OrderNum", SqlDbType.Int, 4), new SqlParameter("@TestQuestions_Option_Content", SqlDbType.NVarChar, 0x3e8), new SqlParameter("@TestQuestions_Option_OrderNum", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@TestQuestions_Score_ID", SqlDbType.Char, 0x24), new SqlParameter("@TestQuestions_Option_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.TestQuestions_Id; cmdParms[1].Value = model.TestQuestions_OptionParent_OrderNum; cmdParms[2].Value = model.TestQuestions_Option_Content; cmdParms[3].Value = model.TestQuestions_Option_OrderNum; cmdParms[4].Value = model.CreateTime; cmdParms[5].Value = model.TestQuestions_Score_ID; cmdParms[6].Value = model.TestQuestions_Option_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public Model_TestQuestions_Option DataRowToModel(DataRow row) { Model_TestQuestions_Option option = new Model_TestQuestions_Option(); if (row != null) { if (row["TestQuestions_Option_Id"] != null) { option.TestQuestions_Option_Id = row["TestQuestions_Option_Id"].ToString(); } if (row["TestQuestions_Id"] != null) { option.TestQuestions_Id = row["TestQuestions_Id"].ToString(); } if ((row["TestQuestions_OptionParent_OrderNum"] != null) && (row["TestQuestions_OptionParent_OrderNum"].ToString() != "")) { option.TestQuestions_OptionParent_OrderNum = new int?(int.Parse(row["TestQuestions_OptionParent_OrderNum"].ToString())); } if (row["TestQuestions_Option_Content"] != null) { option.TestQuestions_Option_Content = row["TestQuestions_Option_Content"].ToString(); } if ((row["TestQuestions_Option_OrderNum"] != null) && (row["TestQuestions_Option_OrderNum"].ToString() != "")) { option.TestQuestions_Option_OrderNum = new int?(int.Parse(row["TestQuestions_Option_OrderNum"].ToString())); } if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != "")) { option.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString())); } if (row["TestQuestions_Score_ID"] != null) { option.TestQuestions_Score_ID = row["TestQuestions_Score_ID"].ToString(); } } return(option); }
public bool Add(Model_TestQuestions_Option model) { return(this.dal.Add(model)); }
public bool Update(Model_TestQuestions_Option model) { return(this.dal.Update(model)); }