示例#1
0
        public string Login(dynamic obj)
        {
            string userinfo = Convert.ToString(obj.usr);
            string pwd      = Convert.ToString(obj.pwd);

            return(DbOp.Login(userinfo, pwd));
        }
示例#2
0
 SQLiteDataAdapter DBInsert(DbOp op, string query, SQLiteConnection connection)
 {
     return(new SQLiteDataAdapter()
     {
         InsertCommand = new SQLiteCommand(query, connection)
     });
 }
示例#3
0
        public override OleDbDataAdapter AdapterUpdate(DbOp op, string query, OleDbConnection connection)
        {
            OleDbDataAdapter A = new OleDbDataAdapter(query, connection);

            A.UpdateCommand = new OleDbCommand(query, connection);
            return(A);
        }
示例#4
0
        private string AddDbOp(Article article, DbOpType opType)
        {
            string db_file_path = DbFilePath;

            article.Html = null;
            string opId = Guid.NewGuid().ToString();

            var op = new DbOp
            {
                Id = opId,
                Op = opType,
            };

            switch (opType)
            {
            case DbOpType.Add:
                op.Article = article;
                break;

            case DbOpType.Delete:
                op.ArticleId = article.Id;
                break;

            default:
                break;
            }

            using (TextWriter writer =
                       new StreamWriter(new FileStream(db_file_path, FileMode.Append, FileAccess.Write)))
            {
                writer.WriteLine(JsonConvert.SerializeObject(op));
            }

            return(op.Id);
        }
示例#5
0
        public override OleDbDataAdapter AdapterInsert(DbOp op, string query, OleDbConnection connection)
        {
            OleDbDataAdapter A = new OleDbDataAdapter(null, connection);

            A.InsertCommand = new OleDbCommand(query, connection);
            return(A);
        }
示例#6
0
        public override SqlDataAdapter AdapterUpdate(DbOp op, string query, SqlConnection connection)
        {
            SqlDataAdapter A = new SqlDataAdapter();

            A.UpdateCommand = new SqlCommand(query, connection);
            return(A);
        }
示例#7
0
 public JArray ListUsre(int st, int pz)
 {
     if (pz > 100)
     {
         pz = 100;
     }
     return(DbOp.GetUserByAddTime(st, pz));
 }
示例#8
0
 /// <summary>
 /// This method is responsible for Parameterizing the Command.
 /// </summary>
 /// <param name="op"></param>
 /// <param name="query"></param>
 /// <param name="connection"></param>
 /// <returns></returns>
 public virtual TAdapter AdapterUpdate(DbOp op, string query, TConnection connection)
 {
     if (this.AdapterUpdateAction != null)
     {
         return(this.AdapterUpdateAction.Invoke(op, query, connection));
     }
     return((TAdapter)null);
 }
示例#9
0
        public string Register(dynamic obj)
        {
            string usn   = Convert.ToString(obj.usn);
            string pwd   = Convert.ToString(obj.pwd);
            string email = Convert.ToString(obj.email);
            string regip = Convert.ToString(obj.regip);

            return(DbOp.RegUser(usn, pwd, email, regip));
        }
示例#10
0
            public SQLiteDataAdapter AdapterUpdate(DbOp op, string Query, SQLiteConnection c)
            {
                SQLiteDataAdapter a = new SQLiteDataAdapter();

//				a.SelectCommand = new SQLiteCommand("SELECT 'return something so we don''t have an empty table.' [result];",c);
                a.UpdateCommand = new SQLiteCommand(Query, c);
                this.ParameterizeUpdate(a.UpdateCommand);
                return(a);
            }
示例#11
0
 virtual public TAdapter DefaultSelectAdapter(DbOp op, string query, TConnection connection)
 {
     return(new TAdapter()
     {
         SelectCommand = new TCommand()
         {
             CommandText = query, Connection = connection
         }
     });
 }
示例#12
0
 public override SQLiteDataAdapter SelectCategoryAdapter(DbOp op, string query, SQLiteConnection connection)
 {
     return(new SQLiteDataAdapter(query, connection));
 }
示例#13
0
 /// <inheritdoc/>
 public override SQLiteDataAdapter AdapterUpdate(DbOp op, string query, SQLiteConnection connection)
 {
     SQLiteDataAdapter A = new SQLiteDataAdapter(null, connection); A.UpdateCommand = new SQLiteCommand(query, connection); return(A);
 }
示例#14
0
 public override OleDbDataAdapter SelectCategoryAdapter(DbOp op, string query, OleDbConnection connection)
 {
     return(new OleDbDataAdapter(query, connection));
 }
示例#15
0
 public abstract TAdapter SelectCategoryAdapter(DbOp op, string query, TConnection connection);
示例#16
0
 public override SqlDataAdapter UpdateCategoryAdapter(DbOp op, string query, SqlConnection connection)
 {
     return(new SqlDataAdapter(query, connection));
 }
示例#17
0
 public override SqlDataAdapter  AdapterSelect(DbOp op, string query, SqlConnection connection)
 {
     return(new SqlDataAdapter(query, connection));
 }
示例#18
0
 public bool DelUser(Guid iduser)
 {
     return(DbOp.DeleteUser(iduser));
 }
示例#19
0
 /// <summary>
 /// Callback: Retrieves the DataAdapter for the respective call.
 /// </summary>
 /// <param name="o"></param>
 /// <param name="query"></param>
 /// <param name="C"></param>
 /// <returns></returns>
 static SQLiteDataAdapter SelectTemplatesAdapter(DbOp o, string query, SQLiteConnection C)
 {
     return(new SQLiteDataAdapter(query, C));
 }