public Model_SyncFileToSchool DataRowToModel(DataRow row) { Model_SyncFileToSchool school = new Model_SyncFileToSchool(); if (row != null) { if (row["SyncFileToSchool_Id"] != null) { school.SyncFileToSchool_Id = row["SyncFileToSchool_Id"].ToString(); } if (row["SchoolId"] != null) { school.SchoolId = row["SchoolId"].ToString(); } if (row["ResourceToResourceFolder_Id"] != null) { school.ResourceToResourceFolder_Id = row["ResourceToResourceFolder_Id"].ToString(); } if (row["Remark"] != null) { school.Remark = row["Remark"].ToString(); } if (row["CreateUser"] != null) { school.CreateUser = row["CreateUser"].ToString(); } if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != "")) { school.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString())); } } return(school); }
public bool Add(Model_SyncFileToSchool model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into SyncFileToSchool("); builder.Append("SyncFileToSchool_Id,SchoolId,ResourceToResourceFolder_Id,Remark,CreateUser,CreateTime)"); builder.Append(" values ("); builder.Append("@SyncFileToSchool_Id,@SchoolId,@ResourceToResourceFolder_Id,@Remark,@CreateUser,@CreateTime)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SyncFileToSchool_Id", SqlDbType.Char, 0x24), new SqlParameter("@SchoolId", SqlDbType.VarChar, 50), new SqlParameter("@ResourceToResourceFolder_Id", SqlDbType.Char, 0x24), new SqlParameter("@Remark", SqlDbType.VarChar, 0x3e8), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime) }; cmdParms[0].Value = model.SyncFileToSchool_Id; cmdParms[1].Value = model.SchoolId; cmdParms[2].Value = model.ResourceToResourceFolder_Id; cmdParms[3].Value = model.Remark; cmdParms[4].Value = model.CreateUser; cmdParms[5].Value = model.CreateTime; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List<Model_SyncFileToSchool> DataTableToList(DataTable dt) { List<Model_SyncFileToSchool> list = new List<Model_SyncFileToSchool>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_SyncFileToSchool item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return list; }
public bool Update(Model_SyncFileToSchool model) { StringBuilder builder = new StringBuilder(); builder.Append("update SyncFileToSchool set "); builder.Append("SchoolId=@SchoolId,"); builder.Append("ResourceToResourceFolder_Id=@ResourceToResourceFolder_Id,"); builder.Append("Remark=@Remark,"); builder.Append("CreateUser=@CreateUser,"); builder.Append("CreateTime=@CreateTime"); builder.Append(" where SyncFileToSchool_Id=@SyncFileToSchool_Id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SchoolId", SqlDbType.VarChar, 50), new SqlParameter("@ResourceToResourceFolder_Id", SqlDbType.Char, 0x24), new SqlParameter("@Remark", SqlDbType.VarChar, 0x3e8), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@SyncFileToSchool_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.SchoolId; cmdParms[1].Value = model.ResourceToResourceFolder_Id; cmdParms[2].Value = model.Remark; cmdParms[3].Value = model.CreateUser; cmdParms[4].Value = model.CreateTime; cmdParms[5].Value = model.SyncFileToSchool_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(Model_SyncFileToSchool model) { return this.dal.Add(model); }
public bool Update(Model_SyncFileToSchool model) { return this.dal.Update(model); }