public void UpdateConfig(Config config) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_ConfigUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Titleweb", config.Titleweb); command.Parameters.AddWithValue("@Google", config.Google); command.Parameters.AddWithValue("@Introduction", config.Introduction); command.Parameters.AddWithValue("@Infocompany", config.Infocompany); command.Parameters.AddWithValue("@New_icon_w", config.New_icon_w); command.Parameters.AddWithValue("@New_icon_h", config.New_icon_h); command.Parameters.AddWithValue("@New_thumb_w", config.New_thumb_w); command.Parameters.AddWithValue("@New_thumb_h", config.New_thumb_h); command.Parameters.AddWithValue("@New_large_w", config.New_large_w); command.Parameters.AddWithValue("@New_large_h", config.New_large_h); command.Parameters.AddWithValue("@Product_icon_w", config.Product_icon_w); command.Parameters.AddWithValue("@Product_icon_h", config.Product_icon_h); command.Parameters.AddWithValue("@Product_thumb_w", config.Product_thumb_w); command.Parameters.AddWithValue("@Product_thumb_h", config.Product_thumb_h); command.Parameters.AddWithValue("@Product_large_w", config.Product_large_w); command.Parameters.AddWithValue("@Product_large_h", config.Product_large_h); command.Parameters.AddWithValue("@ProductNo", config.ProductNo); command.Parameters.AddWithValue("@ProductNoPage", config.ProductNoPage); command.Parameters.AddWithValue("@Currency", config.Currency); command.Parameters.AddWithValue("@Status", config.Status); command.Parameters.AddWithValue("@Closecomment", config.Closecomment); command.Parameters.AddWithValue("@Language", config.Language); command.Parameters.AddWithValue("@Support", config.Support); command.Parameters.AddWithValue("@Contact", config.Contact); command.Parameters.AddWithValue("@Intro_desc", config.Intro_desc); command.Parameters.AddWithValue("@email_from", config.Email_from); command.Parameters.AddWithValue("@email_to", config.Email_to); command.Parameters.AddWithValue("@counter", config.Counter); command.Parameters.AddWithValue("@info1", config.Info1); command.Parameters.AddWithValue("@info2", config.Info2); command.Parameters.AddWithValue("@WebName", config.WebName); command.Parameters.AddWithValue("@WebServerIP", config.WebServerIP); command.Parameters.AddWithValue("@WebMailServer", config.WebMailServer); command.Parameters.AddWithValue("@WebDomain", config.WebDomain); command.Parameters.AddWithValue("@IsPopup", config.IsPopup); command.Parameters.AddWithValue("@Popup", config.Popup); command.Parameters.AddWithValue("@Popup2", config.Popup2); connection.Open(); if (command.ExecuteNonQuery() <= 0) { throw new DataAccessException("Loi cap nhat config"); } command.Dispose(); } }
protected Config ReceiveHtml() { Config config = new Config(); int Ngon_Ngu = Convert.ToInt32(ViewState["CauHinh_Viet"]); if (Ngon_Ngu == 1) { config.Language = Language.language; } else { config.Language = Language.language_Eng; } config.Titleweb = txttitleweb.Text; config.Google = txtgoogle.Text; config.Intro_desc = txtIntro_desc.Html; config.Introduction = txtIntroduction.Html; config.Infocompany = txtInfocompany.Html; config.New_icon_w = new_icon_w.Text; config.New_icon_h = new_icon_h.Text; config.New_thumb_w = new_thumb_w.Text; config.New_thumb_h = new_thumb_h.Text; config.New_large_w = new_large_w.Text; config.New_large_h = new_large_h.Text; config.Product_icon_w = product_icon_w.Text; config.Product_icon_h = product_icon_h.Text; config.Product_thumb_w = product_thumb_w.Text; config.Product_thumb_h = product_thumb_h.Text; config.Product_large_w = product_large_w.Text; config.Product_large_h = product_large_h.Text; config.ProductNo = txtNoproduct.Text; config.ProductNoPage = txtNoPage.Text; config.Currency = txtCurrency.Text; config.Status = Convert.ToBoolean(rdblistClose.SelectedItem.Value); config.Closecomment = txtCloseComment.Text; config.Support = txtRadSupport.Html; config.Contact = txtRadContact.Html; config.Email_from = txtEmailFrom.Text; config.Email_to = txtEmailTo.Text; config.Counter = RadCounter.Html; config.Info1 = RadInfo1.Html; config.Info2 = RadInfo2.Html; config.WebDomain = txtWebDomain.Text; config.WebMailServer = txtWebMailServer.Text; config.WebName = txtWebName.Text; config.WebServerIP = txtWebServerIP.Text; config.IsPopup = Convert.ToBoolean(rdbPopup.SelectedValue); config.Popup = radPopup.Html; config.Popup2 = radPopup2.Html; return config; }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie_lang = Request.Cookies["LangInfo_CMS"]; if (cookie_lang == null || cookie_lang["Lang"] == null || cookie_lang["Lang"] == string.Empty) { cookie_lang = new HttpCookie("LangInfo_CMS"); cookie_lang["Lang"] = "vi-VN"; cookie_lang.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie_lang); } Language.language = cookie_lang["Lang"].ToString(); Session["Lang"] = cookie_lang["Lang"].ToString(); ETO.Config config = new ETO.Config(); if (AspNetCache.CheckCache("Config_" + Language.language) == false) { ConfigBSO configBSO = new ConfigBSO(); config = configBSO.GetAllConfig(Language.language); AspNetCache.SetCacheWithTime("Config_" + Language.language, config, 150); } else { config = (ETO.Config)AspNetCache.GetCache("Config_" + Language.language); } Page.Title = config.Titleweb; ModulesBSO _moduleBSO = new ModulesBSO(); Modules _module = new Modules(); //string _userName = ""; //HttpCookie cookie = Request.Cookies["UserInfor_EVNTIT"]; //if (cookie != null && cookie["UserName"] != null && cookie["UserName"].Trim() != string.Empty) //{ // _userName = cookie["UserName"]; //} //_userName = //(string)AspNetCache.GetCache(GetIpAddress()); //Session["Admin_Username"] = _userName; //if (Session["Admin_Username"] == null) //{ // if (!string.IsNullOrEmpty(Request["dll"])) // { // if (Request["dll"].Equals("login")) // Response.Redirect("~/Admin/Login.aspx"); // // PlaceHolder1.Controls.Add(LoadControl("Client/Admin/Login.ascx")); // else // Response.Redirect("~/Default.aspx"); // } // else // Response.Redirect("~/Default.aspx"); //} if (!this.m_UserValidation.IsSigned()) { if (!string.IsNullOrEmpty(Request["dll"]) && Request["dll"].Equals("login")) { Response.Redirect("~/Admin/Login.aspx"); } else { Response.Redirect("~/Default.aspx"); } } else { Session["Admin_Username"] = m_UserValidation.UserName; if (!string.IsNullOrEmpty(Request["dll"])) { if (CheckExit(Request["dll"].ToString())) { bool levelAdmin = CheckLevelAdmin(Request["dll"].ToString(), Session["Admin_UserName"].ToString()); if (levelAdmin == true) { _module = _moduleBSO.GetModulesBySlug(Request["dll"].ToString()); PlaceHolder1.Controls.Add(LoadControl("Client/Admin/" + _module.ModulesDir + "/" + _module.ModulesUrl + ".ascx")); } else if (Request["dll"].Equals("login")) { // PlaceHolder1.Controls.Add(LoadControl("Client/Admin/Login.ascx")); Response.Redirect("~/Admin/Login.aspx"); } else { Response.Redirect("~/Default.aspx"); } } else { if (Request["dll"].Equals("login")) { // PlaceHolder1.Controls.Add(LoadControl("Client/Admin/Login.ascx")); Response.Redirect("~/Admin/Login.aspx"); } else { Response.Redirect("~/Admin/home/Default.aspx"); } } } else { Response.Redirect("~/Default.aspx"); } } }
public void UpdateConfig(Config config) { new ConfigDAO().UpdateConfig(config); }