public ClassBModel ToModel(SQLiteDataReader reader) { ClassBModel classBModel = new ClassBModel(); classBModel.Id = Convert.ToInt32(ToModelValue(reader, "id")); classBModel.ClassA = (string)ToModelValue(reader, "classA"); classBModel.ClassB = (string)ToModelValue(reader, "classB"); classBModel.ClassNote = (string)ToModelValue(reader, "classNote"); classBModel.CreateTime = Convert.ToDateTime(ToModelValue(reader, "createTime")); return(classBModel); }
public int Add(ClassBModel classBModel) { string sql = "INSERT INTO classB (classA, classB, classNote, createTime) VALUES (@classA, @classB, @classNote, @createTime)"; SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@classA", ToDBValue(classBModel.ClassA)), new SQLiteParameter("@classB", ToDBValue(classBModel.ClassB)), new SQLiteParameter("@classNote", ToDBValue(classBModel.ClassNote)), new SQLiteParameter("@createTime", ToDBValue(classBModel.CreateTime)), }; return(SqlHelper.ExecuteNonQuery(sql, para)); }
private void saveClassB(string classA, string classB) { var canInsert = new BLL.ClassBModelBLL().GetByClassName(classA, classB); if (canInsert == null) { Models.ClassBModel info = new ClassBModel() { ClassA = classA, ClassB = classB, CreateTime = DateTime.Now }; new BLL.ClassBModelBLL().Add(info); } }
public int Update(ClassBModel classBModel) { string sql = "UPDATE classB " + "SET " + " classA = @classA" + ", classB = @classB" + ", classNote = @classNote" + ", createTime = @createTime" + " WHERE id = @id"; SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@id", classBModel.Id) , new SQLiteParameter("@classA", ToDBValue(classBModel.ClassA)) , new SQLiteParameter("@classB", ToDBValue(classBModel.ClassB)) , new SQLiteParameter("@classNote", ToDBValue(classBModel.ClassNote)) , new SQLiteParameter("@createTime", ToDBValue(classBModel.CreateTime)) }; return(SqlHelper.ExecuteNonQuery(sql, para)); }
public int Update(ClassBModel classBModel) { return(new ClassBModelDAL().Update(classBModel)); }
public int Add(ClassBModel classBModel) { return(new ClassBModelDAL().Add(classBModel)); }