Exemplo n.º 1
0
        public static DataTable SelectTableSP(string storeProcedure)
        {
            DataTable dt = new DataTable();

            try
            {
                return(DBLibs.ExecuteStoreProcedure_Select(storeProcedure, new Hashtable(), Cnn));
                //SqlCommand cmd = new SqlCommand(storeProcedure, con);
                //cmd.Connection = con;
                //if (con.State == ConnectionState.Closed) { con.Open(); }
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.CommandText = storeProcedure;
                //SqlDataAdapter da = new SqlDataAdapter(cmd);
                //DataSet ds = new DataSet();
                //da.Fill(ds);
                //dt = ds.Tables[0];
                //return dt;
            }
            catch (Exception)
            {
                return(dt);
            }

            finally
            {
                con.Close();
            }
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var dt = DBLibs.ExecuteStoreProcedure_Select("sp_gianhang_list", new Hashtable(), _cnn);

            ViewBag.DsGianHang = dt;

            return(View());
        }
Exemplo n.º 3
0
        public DataTable get_danhsach_giaovien_avaiable(int id_truong)
        {
            Hashtable args = new Hashtable();

            args.Add("id_truong", id_truong);
            DataTable dt = DBLibs.ExecuteStoreProcedure_Select("sp_get_danhsach_giaovien_chatting_avaiable", args, ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            return(dt);
        }
Exemplo n.º 4
0
        public DataTable get_tonghop_statushocsinh(int id_truong)
        {
            Hashtable args = new Hashtable();

            args.Add("id_truong", id_truong);
            DataTable dt = DBLibs.ExecuteStoreProcedure_Select("sp_tonghop_statushocsinh", args, ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            return(dt);
        }
Exemplo n.º 5
0
        public ActionResult GetUserSearch(string name = "")
        {
            Hashtable args2 = new Hashtable();

            args2.Add("name", name);
            var dt = DBLibs.ExecuteStoreProcedure_Select("be_GetAllUserSearch", args2, _cnn);

            ViewBag.User = dt;
            return(PartialView("_UsersPartial"));
        }
        private DataTable DsDanhMuc(string t = "")
        {
            var args = new Hashtable
            {
                { "loai", t = Request["t"] }
            };
            var dt = DBLibs.ExecuteStoreProcedure_Select("GetDanhMuc", args, _cnn);

            return(dt);
        }
Exemplo n.º 7
0
        public ActionResult GetUserbyRole(string id = "")
        {
            Hashtable args2 = new Hashtable();

            // args2.Add("uId", uId);
            args2.Add("id", id);
            var dt = DBLibs.ExecuteStoreProcedure_Select("be_GetUserbyRole", args2, _cnn);

            ViewBag.User = dt;
            return(PartialView("_UsersPartial"));
        }
Exemplo n.º 8
0
        public static DataTable SelectTableSP(string StoreProcName, SqlParameter[] param = null)
        {
            DataTable dt = new DataTable();

            try
            {
                var args = new Hashtable();
                if (param == null)
                {
                    return(DBLibs.ExecuteStoreProcedure_Select(StoreProcName, args, Cnn));
                }
                foreach (var p in param)
                {
                    if (p.DbType.ToString() == "DateTime")
                    {
                        var timeValue = DateTime
                                        .ParseExact(p.Value.ToString(), "dd/MM/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture)
                                        .ToString("yyyy-MM-dd HH:mm:ss.fff");
                        args.Add(p.ParameterName.Replace("@", ""), timeValue);
                    }
                    else
                    {
                        args.Add(p.ParameterName.Replace("@", ""), p.Value.ToString());
                    }
                }
                return(DBLibs.ExecuteStoreProcedure_Select(StoreProcName, args, Cnn));
                //            SqlCommand cmd = new SqlCommand(StoreProcName);
                //            cmd.Connection = con;
                //if (con.State == ConnectionState.Closed) { con.Open(); }
                //cmd.CommandType = CommandType.StoredProcedure;
                //            if (param != null)
                //            {
                //                for (int i = 0; i < param.Length; i++)
                //                {
                //                    cmd.Parameters.Add(param[i]);
                //                }
                //            }
                //            SqlDataAdapter da = new SqlDataAdapter(cmd);
                //            DataSet ds = new DataSet();
                //            da.Fill(ds);
                //            dt = ds.Tables[0];
                //            return dt;
            }
            catch (Exception)
            {
                return(dt);
            }

            finally
            {
                con.Close();
            }
        }
        public ActionResult Search(int cat, int status = 2, string title = "")
        {
            Hashtable args2 = new Hashtable();

            args2.Add("title", title);
            args2.Add("catId", cat);
            args2.Add("status", status);
            var dt = DBLibs.ExecuteStoreProcedure_Select("be_GetNewsSearch", args2, _cnn);

            ViewBag.Data = dt;
            return(PartialView("Search"));
        }
Exemplo n.º 10
0
        public ActionResult FilterTag(int type = 1, int show = 0, string name = "")
        {
            Hashtable args2 = new Hashtable();

            args2.Add("type", type);
            args2.Add("show_athome", show);
            args2.Add("name", name);
            var dt = DBLibs.ExecuteStoreProcedure_Select("be_GetFilterTag", args2, _cnn);

            ViewBag.Data = dt;
            return(PartialView("FilterTag"));
        }
Exemplo n.º 11
0
        // GET: Users
        //public ActionResult Index()
        //{
        //    var sql = $@"SELECT * FROM dbo.AspNetUsers";
        //    var dtUser = DBLibs.GetDataBy_DataAdapter(sql, _cnn);
        //    ViewBag.User = dtUser;
        //    return View();
        //}

        public ActionResult GetUserSearch(string name = "", int trangthai = 0)
        {
            Hashtable args2 = new Hashtable();

            args2.Add("uId", uId);
            args2.Add("trangthai", trangthai);
            args2.Add("name", name);
            var dt = DBLibs.ExecuteStoreProcedure_Select("be_GetAllUserSearch", args2, _cnn);

            ViewBag.User   = dt;
            ViewBag.status = trangthai;
            return(PartialView("_UsersPartial"));
        }
Exemplo n.º 12
0
        public static DataTable RecoveryFromLogs(string type, int start_logtime, int end_logtime, string table_name_of_value_modified, string column_name_of_value_modified, string id_of_row_modified, int top = 10)
        {
            var args = new Hashtable
            {
                { "type", type },
                { "modifier_guid", "" },
                { "modifier_id", 0 },
                { "table_name", table_name_of_value_modified },
                { "column_name", column_name_of_value_modified },
                { "id_of_row", id_of_row_modified },
                { "start_time", start_logtime },
                { "end_time", end_logtime },
                { "top", top }
            };

            return(DBLibs.ExecuteStoreProcedure_Select("Proc_GetLogs", args, ConfigurationManager.ConnectionStrings["LogsConnection"].ConnectionString));
        }
Exemplo n.º 13
0
        public DataTable get_alllogs(int startTimestame = 0, int endTimestame = 0, int limit = 1000)
        {
            if (startTimestame == 0)
            {
                startTimestame = CLibs.DatetimeToTimestamp(DateTime.Now.AddMonths(-6));
            }
            if (endTimestame == 0)
            {
                endTimestame = CLibs.DatetimeToTimestamp(DateTime.Now);
            }

            var args = new Hashtable
            {
                { "start_time", startTimestame },
                { "end_time", endTimestame },
                { "top", limit }
            };
            var dt = DBLibs.ExecuteStoreProcedure_Select("sp_get_tracelogs_all", args, _cnn);

            return(dt);
        }
Exemplo n.º 14
0
        public ActionResult Demo(int type = 1, int id = 0, int cat = 0)
        {
            ViewBag.cat = Request["cat"].MapInt();
            string sql     = $@"SELECT * FROM dbo.DanhMucChung Where LoaiDanhMuc=2 ORDER BY SoThuTu";
            var    dtAlbum = DBLibs.GetDataBy_DataAdapter(sql, _cnn);

            ViewBag.DsAlbum = dtAlbum;
            string query   = $@"SELECT * FROM dbo.DanhMucChung Where LoaiDanhMuc=3 ORDER BY SoThuTu";
            var    dtVideo = DBLibs.GetDataBy_DataAdapter(query, _cnn);
            //ViewBag.Type = Request["type"];
            var qr       = $@"SELECT n.id,n.page_kind_appear,n.position_inpage,n.type,n.order_inpage,n.main_content,n.alter_content,n.url,n.tooltip,n.size,n.width,
              n.height,n.AlbumId,n.GroupAlbumID, dbo.GetCountAlbumid(n.id)TenDanhMuc FROM dbo.Images n  Where page_kind_appear =" + type;
            var dtImages = DBLibs.GetDataBy_DataAdapter(qr, _cnn);

            if (dtImages == null || dtImages.Rows.Count < 1)
            {
                ViewBag.ImageHomeC = new DataTable();
            }
            else
            {
                Hashtable args = new Hashtable();
                args.Add("type", type);
                args.Add("albumId", cat);
                if (cat > 0)
                {
                    dtImages = DBLibs.ExecuteStoreProcedure_Select("be_Image_byCat", args, _cnn);
                }
                ViewBag.dsImg = dtImages;
            }
            ViewBag.Images = $"{Server.MapPath(@"\")}UserData\\{type}\\Images";
            // var dt = DBLibs.GetDataBy_DataAdapter("SELECT id,page_kind_appear,position_inpage,type,order_inpage,main_content,alter_content,url,tooltip,size,width,height, AlbumId FROM dbo.News ORDER BY  Id desc", _cnn);


            ViewBag.alBumID = cat;
            ViewBag.Type    = Request["type"];

            return(View());
        }