예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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));
        }
예제 #5
0
 public int Update(ClassBModel classBModel)
 {
     return(new ClassBModelDAL().Update(classBModel));
 }
예제 #6
0
 public int Add(ClassBModel classBModel)
 {
     return(new ClassBModelDAL().Add(classBModel));
 }