public static DataTable SelectNewsByRangeId(String RangeNewsId) { using (MainDB db = new MainDB()) { DataTable table = db.StoredProcedures.vc_News_SelectListNewsByRangeNewsId(RangeNewsId); return(table); } }
public static DataTable BaiNoiBat_BaiNoiBat_Select(string EditionType) { using (MainDB db = new MainDB()) { return(db.SelectQuery("Select * From v_BaiNoiBatTrangChu_Select vbn Join NewsPublished np On vbn.News_ID = np.News_ID Join Category c On np.Cat_ID = c.Cat_ID Where c.EditionType_ID = " + EditionType + " Order By Thutu")); } }
public static int GetRowsNews(string strWhere, string cpmode, bool isClear) { if (strWhere == null) { strWhere = ""; } string strCacheName = "GetRowsNews_" + cpmode + "_" + HttpContext.Current.User.Identity.Name; if (isClear) { HttpContext.Current.Cache.Remove(strCacheName); } DataTable objresult = HttpContext.Current.Cache[strCacheName] as DataTable; if (objresult == null) { using (MainDB objdb = new MainDB()) { objresult = objdb.StoredProcedures.News_GetListNewNumRow(strWhere, cpmode, HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name); } //DFISYS.BO.Common.Utils.SetDataToCache(objresult, strCacheName, "News",); //HttpContext.Current.Cache.Insert(strCacheName, objresult, null, DateTime.Now.AddMinutes(60), TimeSpan.Zero); } return((int)objresult.Rows[0][0]); }
public static DataTable GetNewslistOfNewsSpecialListControl(string strWhere, int PageSize, int StartRow, string SortExpression) { string cpmode = ""; if (HttpContext.Current.Request.QueryString["cpmode"] != null) { cpmode = HttpContext.Current.Request.QueryString["cpmode"].ToString(); } if (string.IsNullOrEmpty(SortExpression)) { SortExpression = "[News].News_ModifiedDate DESC"; } //Lay gia tri mode list de xu ly if (strWhere == null) { strWhere = ""; } DataTable objresult; int intPageNum = StartRow / PageSize + 1; //lay duoc du lieu cua tat ca nhung thang co trang thai la status can lay using (MainDB objdb = new MainDB()) { objresult = objdb.StoredProcedures.News_GetListNewSpecial(strWhere, StartRow.ToString(), PageSize.ToString(), SortExpression); } return(objresult); }
/// Update Question------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_Question_Update", new object[] { Question_ID, Sourse_ID, Channel_ID, Question_Content, Question_Answer, Question_Time, User_Name, User_Age, User_Sex, User_Address, User_Mobile, User_Email, User_Job, Status }, new string[] { "@Question_ID", "@Sourse_ID", "@Channel_ID", "@Question_Content", "@Question_Answer", "@Question_Time", "@User_Name", "@User_Age", "@User_Sex", "@User_Address", "@User_Mobile", "@User_Email", "@User_Job", "@Status" }, false); } }
private static void newsupdate(long _news_id, bool blnIsFocus, int intNewMode) { MainDB objDb = new MainDB(); objDb.BeginTransaction(); try { NewsRow objRow; NewsPublishedRow publishedRow = null; bool IsPublished = false; String cpmode = HttpContext.Current.Request.QueryString["cpmode"]; if (cpmode.IndexOf("publishedlist") >= 0 || cpmode.IndexOf("removedlist") >= 0) { IsPublished = true; } //using (MainDB objDb = new MainDB()) //{ objRow = objDb.NewsCollection.GetByPrimaryKey(_news_id); if (IsPublished) { publishedRow = objDb.NewsPublishedCollection.GetByPrimaryKey(_news_id); } //} if (objRow != null) { //thuc hien doi trang thai cua tin - luu thong tin modified thanh ngay gio hien tai. //objRow.News_Status = _news_status; objRow.News_isFocus = blnIsFocus; objRow.News_Mode = intNewMode; objRow.News_ModifiedDate = DateTime.Now; if (IsPublished && publishedRow != null) { publishedRow.News_isFocus = blnIsFocus; publishedRow.News_Mode = intNewMode; publishedRow.News_ModifedDate = DateTime.Now; } //using (MainDB objDb = new MainDB()) //{ objDb.NewsCollection.Update(objRow); if (IsPublished && publishedRow != null) { objDb.NewsPublishedCollection.Update(publishedRow); } //} } // Commit Transaction objDb.CommitTransaction(); } catch (Exception ex) { objDb.RollbackTransaction(); } finally { objDb.Close(); } }
public void DelThread(string _selected_id) { if (_selected_id.IndexOf(",") <= 0) { //DeleteFile(_selected_id); try { int intid = Convert.ToInt32(_selected_id); using (MainDB objDB = new MainDB()) { objDB.NewsThreadCollection.DeleteByPrimaryKey(intid); } } catch { } } else { string[] objTempSel = _selected_id.Split(','); //foreach (string temp in objTempSel) //{ // DeleteFile(temp.Trim()); //} try { using (MainDB objDB = new MainDB()) { objDB.NewsThreadCollection.Delete("Thread_ID in (" + _selected_id + ")"); } } catch { } } }
/// Update CourseLog------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_CourseLog_Update", new object[] { CourseLog_ID, CourseLog_Date, Course_ID, Course_Content }, new string[] { "@CourseLog_ID", "@CourseLog_Date", "@Course_ID", "@Course_Content" }, false); } }
public static void UpdateView(int advId) { using (var ndb = new MainDB(MasterConnectionString)) { ndb.StoredProcedures.AdvUpdateView(advId); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // list of object that can be add to editor bindDropdownlistModules(); //js.Text = "<script>window.addEventListener?window.addEventListener('onload',loadContent,false):window.attachevent('onload',loadContent);</script>"; //js.Text = "<script>addLoadEvent(loadContent); saveViewstate(); //__doPostBack('LinkButton1', '');</script>"; NewsContent.AssetManagerWidth = "750"; NewsContent.AssetManagerHeight = "530"; NewsContent.AssetManager = "/AssetManager/assetmanager.asp?user="******"Select News_Title From News Where News_Id=" + newsId.ToString()); if (objTitleNews != null) { lblTitleNews.Text = objTitleNews.ToString(); } } } }
public static List <AdvZoneEntity> GetZoneByCatId(int catId) { var zoneByCatId = new DataTable(); string cacheName = string.Format("GetZoneByCatId_{0}", catId); var fromCache = Utils.GetFromCache <List <AdvZoneEntity> >(cacheName); if ((fromCache == null) || (fromCache == null)) { using (MainDB ndb = new MainDB()) { zoneByCatId = ndb.StoredProcedures.GetZoneByCatId(catId); } int num = (zoneByCatId != null) ? zoneByCatId.Rows.Count : 0; if (num > 0) { for (int i = 0; i < num; i++) { var row = zoneByCatId.Rows[0]; var item = new AdvZoneEntity(); item.ID = Utils.GetObj <int>(row["ID"]); item.isActive = (row["isActive"] != null) ? Convert.ToBoolean(row["isActive"]) : false; item.Name = Utils.GetObj <string>(row["Name"]); item.WidthDefault = Utils.GetObj <int>(row["WidthDefault"]); item.Cat_ID = Utils.GetObj <int>(row["Cat_ID"]); fromCache.Add(item); } } Utils.SaveToCacheDependency(TableName.DATABASE_NAME, TableName.QUANGCAO_ZONE, cacheName, fromCache); } if (fromCache == null) { fromCache = new List <AdvZoneEntity>(); } return(fromCache); }
/// <summary> /// Dành cho trường hợp nhúng Embed vào trang của Ambient hoặc Infinity. /// </summary> /// <param name="zoneId"></param> /// <param name="catId"></param> /// <returns></returns> public static string GetAdvEmbedScriptItemById(int zoneId, int catId) { DataTable advItemById; string cacheName = string.Format("GetAdvEmbedScriptItemById_{0}__{1}", zoneId, catId); var fromCache = Utils.GetFromCache <string>(cacheName); if (fromCache == null) { using (MainDB ndb = new MainDB()) { advItemById = ndb.StoredProcedures.GetAdvItemById(zoneId, catId); } fromCache = string.Empty; string str3 = string.Empty; var entity = new AdvItemEntity(); int num = (advItemById != null) ? advItemById.Rows.Count : 0; for (int i = 0; i < num; i++) { DataRow row = advItemById.Rows[i]; entity.Type = (row["Type"] != null) ? Utils.GetObj <int>(row["Type"]) : 0; if (entity.Type == 5) { str3 += (row["SourceFile"] != null) ? Utils.GetObj <string>(row["SourceFile"]) : string.Empty; } } str3 = str3.Trim(); fromCache = str3 + fromCache; Utils.SaveToCacheDependency(TableName.DATABASE_NAME, new string[] { TableName.QUANGCAO_ITEM, TableName.ZONE_ITEM }, cacheName, fromCache); } return(fromCache); }
public void LoadCapture(string path) { PacketListView.Items.Clear(); _currentXmlFile = path; ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile)); try { var capture = XmlCaptureImporter.Load(path); _version = capture.Version; _db = _mainWindow.VersioningProvider.GetDatabaseForVersion(_version); foreach (var packet in capture.Packets) { // Add a packet to the view, but no update to the label AddPacketToListView(packet, true); } // Backwards compatibility _wasCapturedMs = capture.UsingSystemTime != null && bool.Parse(capture.UsingSystemTime); UpdateInfoLabel(); } catch (Exception exc) { new ExtendedErrorView($"Could not load capture at {path}.", exc.ToString(), "Error").ShowDialog(); #if DEBUG throw; #endif } }
public static void BaiNoiBat_BaiNoiBat_Update(long[] newsIds, int[] thutu, string newsIdNotSelected, string editionType) { using (MainDB db = new MainDB()) { // xóa hết các bài trong bảng BonBaiNoiBat string sql = "Delete From BonBaiNoiBat" + Environment.NewLine; // insert từng bài đã chọn vào bảng BonBaiNoiBat for (int i = 0; i < newsIds.Length; i++) { sql += "Insert Into BonBaiNoiBat (News_Id, isNoiBat, Thutu) Values (" + newsIds.GetValue(i) + ", 0, " + thutu[i] + ")" + Environment.NewLine; } // cập nhật lại những tin không được chọn thành tin bình thường if (!string.IsNullOrEmpty(newsIdNotSelected)) { sql += "Update News Set News_Mode = 0 From News Join Category On News.Cat_ID = Category.Cat_ID " + "Where Category.EditionType_ID = " + editionType + "AND News_ID In (" + newsIdNotSelected + ") AND (News_PublishDate < DATEADD(HOUR,-48,GETDATE())) " + Environment.NewLine; sql += "Update newspublished Set News_Mode = 0 From NewsPublished Join Category On NewsPublished.Cat_ID = Category.Cat_ID" + " Where Category.EditionType_ID = " + editionType + " AND News_ID In (" + newsIdNotSelected + ") AND (News_PublishDate < DATEADD(HOUR,-48,GETDATE())) " + Environment.NewLine; } db.AnotherNonQuery(sql); } }
public DataTable GetThreadlist(string strWhere, int PageSize, int StartRow) { //lay thong tin ve menh de where de loc thong tin if (strWhere == null) { strWhere = ""; } DataTable table = new DataTable(); using (MainDB objdb = new MainDB()) table = objdb.StoredProcedures.vc_NewsThread_SelectList(strWhere, StartRow, PageSize); DataTable objTemp = table.Clone(); if (table.Rows.Count == 0) { DataRow dr = objTemp.NewRow(); dr["Thread_ID"] = 0; dr["Title"] = "Chưa có dữ liệu"; dr["Thread_isForcus"] = false; dr["Thread_Logo"] = ""; dr["Row"] = 0; objTemp.Rows.Add(dr); table.Dispose(); return(objTemp); } return(table); }
public static void DeleteFeedback(string ID) { using (MainDB db = new MainDB()) { db.AnotherNonQuery("delete from FeedBack where ID in(" + ID + ")"); } }
public static DataTable GetNewslist(string strWhere, int PageSize, int StartRow, bool isFistPage) { //Lay gia tri mode list de xu ly if (strWhere == null) { strWhere = ""; } if (isFistPage) { StartRow = 0; } if (PageSize == 0) { PageSize = 40; } string cpmode = ""; if (HttpContext.Current.Request.QueryString["cpmode"] != null) { cpmode = HttpContext.Current.Request.QueryString["cpmode"].ToString(); } DataTable objresult; int intPageNum = StartRow / PageSize + 1; //lay duoc du lieu cua tat ca nhung thang co trang thai la status can lay using (MainDB objdb = new MainDB()) { //objresult = objdb.NewsCollection.GetPageAsDataTable(intPageNum, PageSize, strWhere, "News_ModifiedDate DESC"); ; objresult = objdb.StoredProcedures.News_GetListNew(strWhere, cpmode, HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, StartRow.ToString(), PageSize.ToString(), "[News].News_PublishDate DESC"); } return(objresult); }
/// Update ChannelResponse------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_ChannelResponse_Update", new object[] { ChannelResponse_ID, Sourse_ID, UserID, ChannelResponse_NameManager, IsActive }, new string[] { "@ChannelResponse_ID", "@Sourse_ID", "@UserID", "@ChannelResponse_NameManager", "@IsActive" }, false); } }
/// Update Course------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_Course_Update", new object[] { Course_ID, Course_Date, Course_Title, Course_InitContent, Course_SubTitle, Course_Content, Course_Image, Course_ImageNote, isActive, News_ID, Status, PublicOrder }, new string[] { "@Course_ID", "@Course_Date", "@Course_Title", "@Course_InitContent", "@Course_SubTitle", "@Course_Content", "@Course_Image", "@Course_ImageNote", "@isActive", "@News_ID", "@Status", "@PublicOrder" }, false); } }
public void UpdateThread(int _thread_id, string _thread_title, bool _thread_isfocus, string _thread_logo, string _thread_rt, int _thread_rc, bool _status) { NewsThreadRow objrow; using (MainDB objDb = new MainDB()) { objrow = objDb.NewsThreadCollection.GetByPrimaryKey(_thread_id); } if (objrow != null) { objrow.Title = _thread_title; objrow.Thread_isForcus = _thread_isfocus; objrow.Thread_RT = _thread_rt; objrow.Thread_RC = _thread_rc; if (_thread_logo != "" && _thread_logo != null) { objrow.Thread_Logo = _thread_logo; } if (_status) { objrow.Status = 0; } else { objrow.Status = 1; } using (MainDB objDb = new MainDB()) { DataTable table = objDb.StoredProcedures.vc_NewsThread_CheckExistingTitle(_thread_title, _thread_id); if (table.Rows.Count == 0) { objDb.NewsThreadCollection.Update(objrow); } } } }
public static void UpdateThreadOrder(int Thread_ID, int Order, int CateID, string Logo) { using (MainDB db = new MainDB()) { db.StoredProcedures.Nc_UpdateOrderThread(Thread_ID, Order, CateID, Logo); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null || Session["id"].ToString() == "") { Response.Redirect("/users.aspx", false); return; } Page.RegisterHiddenField("hidIdPrefix", ClientID + "_"); if (!IsPostBack) { //string userID = Request.QueryString["id"]; string userID = Session["id"] != null ? Session["id"].ToString() : ""; string catID = Session["CatID"] != null ? Session["CatID"].ToString() : ""; //người gán string assignUser; ViewState["userid"] = assignUser = Page.User.Identity.Name; CheckPemission(ViewState["userid"].ToString()); using (MainDB db = new MainDB()) { LoadCategory(db); LoadRole(db); //LoadPermission(db , Int32.Parse(lbxRole.SelectedValue)); lblPermission.Visible = false; } //người được gán lblUserName.Text = userID; //RemoveRole(); //khoi tao bien secu de lay toan bo roles cua thang hien tai LoadLtsBox(); } }
public DataTable GetListCateParentPagging(int pageIndex, int pageSize, int imgWidth) { DataTable dt; using (MainDB db = new MainDB()) { dt = db.StoredProcedures.Web_ListProductCatPagging(pageIndex, pageSize); } if (dt != null && dt.Rows.Count > 0) { if (!dt.Columns.Contains("Cat_URL")) { dt.Columns.Add("Cat_URL"); } if (!dt.Columns.Contains("Image")) { dt.Columns.Add("Image"); } for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["Cat_URL"] = Utility.CatLink(dt.Rows[i]["ID"].ToString(), dt.Rows[i]["Product_Category_CatParent_ID"].ToString(), Utility.UnicodeToKoDauAndGach(dt.Rows[i]["Product_Category_Name"].ToString()), "2"); dt.Rows[i]["Image"] = dt.Rows[i]["Product_Category_Image"] != null?Utility.GetThumbNail(dt.Rows[i]["Product_Category_Name"].ToString(), dt.Rows[i]["Cat_URL"].ToString(), dt.Rows[i]["Product_Category_Image"].ToString(), imgWidth) : String.Empty; } dt.AcceptChanges(); } return(dt); }
public int GetCategoryByCatParentID_Count(int catID, int PageSize) { string CachName = "Microf_DanhSachTin_Count" + catID + PageSize; int totalPage = 0; if (totalPage == 0) { DataTable tbl = null; using (MainDB db = new MainDB()) { tbl = db.StoredProcedures.proc_SelectProductCategory_Count(catID); if (tbl != null) { totalPage = Utility.ConvertToInt(tbl.Rows[0][0]); totalPage = (totalPage - 1) / PageSize + 1; } else { totalPage = 1; } } // Utility.SaveToCacheDependency(TableName.DATABASE_NAME, TableName.NEWSPUBLISHED, CachName, totalPage); } return(totalPage); }
/// Update Adv_Position------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_Adv_Position_Update", new object[] { PosID, PosName, Width, Height, ClassName }, new string[] { "@PosID", "@PosName", "@Width", "@Height", "@ClassName" }, false); } }
public void DeleteCategory(string Cat_ID) { using (MainDB db = new MainDB()) { db.StoredProcedures.DeletetblCategory(Cat_ID); } }
/// Update Advertisments------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_Advertisments_Update", new object[] { AdvID, Name, FilePath, StartDate, EndDate, Embed, Description, IsActive, IsRotate, Link, Order, Type, ViewCount, Width, Height }, new string[] { "@AdvID", "@Name", "@FilePath", "@StartDate", "@EndDate", "@Embed", "@Description", "@IsActive", "@IsRotate", "@Link", "@Order", "@Type", "@ViewCount", "@Width", "@Height" }, false); } }
/// Update Adv_Page_Position------------------------------------------------------- public void Update() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_Adv_Page_Position_Update", new object[] { AdvID, CatID, PosID }, new string[] { "@AdvID", "@CatID", "@PosID" }, false); } }
/// Insert Adv_Page_Position------------------------------------------------------- public void Insert() { using (MainDB db = new MainDB()) { db.CallStoredProcedure("CMS_Adv_Page_Position_Insert", new object[] { CatID, PosID }, new string[] { "@CatID", "@PosID" }, false); } }
/// <summary> /// Ham thuc hien check quyen login cua mot user /// </summary> /// <param name="_userName">UserID su dung de dang nhap</param> /// <param name="_pwd">Mat khau dung de dang nhap</param> /// <returns>True nen xac thuc co quyen dang nhap, flase neu khong co quyen dang nhap</returns> public bool Login(string _userName, string _pwd) { bool blnResult = false; UserRow objrow; using (MainDB objDb = new MainDB()) { objrow = objDb.UserCollection.GetByPrimaryKey(_userName); } //Dung giai thuat ma hoa o day de kiem tra pwd if (objrow != null) { if (!objrow.IsUser_isActiveNull && objrow.User_isActive) { string strPass = FormsAuthentication.HashPasswordForStoringInConfigFile(_pwd, "MD5"); if (objrow.User_Pwd.ToLower() == strPass.ToLower()) { blnResult = true; blnAuthenticate = true; UpdateLastAccessTime(_userName); UpdateUserHistory(_userName, strPass); FormsAuthentication.SetAuthCookie(_userName, false); } } } return(blnResult); }
public DBManager(){ mainDB = new MainDB (); supervillainsDB = new SupervillainsDB (); schoolClassDB = new SchoolClassDB (); buildingDB = new BuildingDB (schoolClassDB); researchDB = new ResearchDB (); superHeroesDB = new SuperheroesDB (); superPowersDB = new SuperPowersDB(); eventDB = new EventDB(); }
public static DataTable CafeF_News_Title_Hot_Select(int Cat_ID) { string cacheName = "CafeF_News_Title_Hot_Select_" + Cat_ID; DataTable __result = NewsHelper_NoCached.GetFromCacheDependency<DataTable>(cacheName); if (__result == null) { using (MainDB db = new MainDB()) { __result = db.StoredProcedures.CafeF_News_Title_Hot_Select(Cat_ID); db.Close(); } NewsHelper_NoCached.SaveToCacheDependency(Const.DATABASE_NAME, "News_Title_Hot", cacheName, __result); } return __result; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { MainDB ds = new MainDB(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }