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(); } }
public ActionResult Index() { var dt = DBLibs.ExecuteStoreProcedure_Select("sp_gianhang_list", new Hashtable(), _cnn); ViewBag.DsGianHang = dt; return(View()); }
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); }
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); }
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); }
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")); }
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")); }
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")); }
// 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")); }
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)); }
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); }
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()); }