Esempio n. 1
0
        private void LoadGridView()
        {
            conn.Connect();


            var reult = conn.database.RunCommand <BsonDocument>(new BsonDocument {
                { "eval", "getCustomer()" }
            });

            var array = reult["retval"].AsBsonArray;

            foreach (var document in array)
            {
                DataGridViewRow row = (DataGridViewRow)gridviewKH.Rows[0].Clone();
                // row.Cells[0].Value = b["_id"].AsObjectId;
                row.Cells[0].Value = document["HoTen"].AsString;
                row.Cells[1].Value = (document["tuoi"].AsInt64).ToString();
                row.Cells[2].Value = document["DiaChi"].AsString;
                row.Cells[3].Value = (document["dienThoai"].AsInt64).ToString();
                row.Cells[4].Value = document["maGiamGia"].AsString;
                row.Cells[5].Value = document["_id"].AsObjectId;
                gridviewKH.Rows.Add(row);
            }
        }
Esempio n. 2
0
    //排序
    public static DataTable ExecuteQuery(out int total, string sql, string sortExpression, int start, int count, params SqlParameter[] cmdParms)
    {
        string        sort = String.IsNullOrEmpty(sortExpression) ? "":" order by " + sortExpression;
        string        sql1 = "select count(*)" + sql.Substring(sql.IndexOf(" from"));
        SqlConnection con  = ConnectDB.Connect();
        SqlCommand    cmd  = new SqlCommand(sql + sort, con);
        SqlCommand    cmd1 = new SqlCommand(sql1, con);

        con.Open();
        foreach (SqlParameter parm in cmdParms)
        {
            cmd.Parameters.Add(parm);
            cmd1.Parameters.Add(parm);
        }
        total = Int32.Parse(cmd1.ExecuteScalar().ToString());//查询第一行获取记录
        DataTable      dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        try
        {
            da.Fill(start, count, dt);
            return(dt);
        }
        catch
        {
            return(null);
        }
        finally
        {
            da.Dispose();
            cmd.Dispose();
            cmd1.Dispose();
            con.Close();
            con.Dispose();
        }
    }
 public CategoryNewsController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public NewsController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 5
0
 public GroupTinhnangController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 6
0
 public ProductsController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public CommentsController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 8
0
 public OrderController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 9
0
        public AuthRepository(ISocialMediaDBSettings settings)
        {
            var db = ConnectDB.Connect(settings);

            _users = db.GetCollection <User>("Users");
        }
 public CategoryImageController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public testController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public PermissionController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public IntroductionController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 14
0
 public QuangcaoController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
        public PostRepository(ISocialMediaDBSettings settings) : base(settings)
        {
            var db = ConnectDB.Connect(settings);

            _posts = db.GetCollection <Post>("Posts");
        }
Esempio n. 16
0
 public HDSudungController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 17
0
 public BaohanhController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public DanhmucPhukienController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public FaqController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public SettingController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
        public GenericRepository(ISocialMediaDBSettings settings)
        {
            var db = ConnectDB.Connect(settings);

            _collection = db.GetCollection <TDocument>(GetCollectionName(typeof(TDocument)));
        }
Esempio n. 22
0
 public AddressController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 23
0
 public MenuController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 24
0
 public VitriController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 25
0
        public LikeRepository(ISocialMediaDBSettings settings) : base(settings)
        {
            var db = ConnectDB.Connect(settings);

            _likes = db.GetCollection <Like>("Likes");
        }
Esempio n. 26
0
        public CommentRepository(ISocialMediaDBSettings settings) : base(settings)
        {
            var db = ConnectDB.Connect(settings);

            _comments = db.GetCollection <Comment>("Comments");
        }
 public ConfigController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
Esempio n. 28
0
 public UsersController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }
 public DanhmucsanphamController()
 {
     con = ConnectDB.Connect();
     ConnectDB.Open();
 }