protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { int Id = 0; if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { Id = Convert.ToInt32(e.CommandArgument.ToString()); } string nName = e.CommandName.ToLower(); switch (nName) { case "_edit": Response.Redirect("~/Client/Admin/AdminPopup.aspx?dll=EditWidgetPageLayoutbyPage&group=" + hddPageLayout.Value + "&id=" + Id); break; case "_delete": SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); _widgetPageLayoutBSO.DeleteSYS_WidgetPageLayout(Id); AspNetCache.Reset(); ViewWidgetAll(Convert.ToInt32(hddPageLayout.Value)); break; case "_config": break; case "_preview": break; } }
protected void btn_copy_Click(object sender, EventArgs e) { DataTable datatable = WidgetID(); SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widget = new SYS_WidgetPageLayout(); try { if (datatable.Rows.Count > 0) { foreach (DataRow subrow in datatable.Rows) { _widget = _widgetBSO.GetSYS_WidgetPageLayoutById(Convert.ToInt32(subrow["Id"].ToString())); if (ddlPageLayout2.SelectedIndex > 0) { _widget.PageLayoutId = Convert.ToInt32(ddlPageLayout2.SelectedValue); _widget.RegionId = ddlRegion2.SelectedValue; _widgetBSO.CreateSYS_WidgetPageLayoutGet(_widget); } } error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật Thành công !</div>"; ViewWidgetAll2(Convert.ToInt32(ddlPageLayout2.SelectedValue), ddlRegion2.SelectedValue); } } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
private void ViewWidgetAll2(int _pagelayout, string regionId) { SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); DataTable table = _widgetBSO.GetSYS_WidgetPageLayoutByAllRegionId(regionId, _pagelayout, Language.language); RadGrid2.DataSource = table; RadGrid2.DataBind(); }
protected void ddlRegion2_SelectedIndexChanged(object sender, EventArgs e) { SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); DataTable table = _widgetBSO.GetSYS_WidgetPageLayoutByAllRegionId(ddlRegion2.SelectedValue, Convert.ToInt32(ddlPageLayout2.SelectedValue), Language.language); RadGrid2.DataSource = table; RadGrid2.DataBind(); }
private void ViewWidgetAll() { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); DataTable table = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutFullAll(Language.language); RadGrid1.DataSource = table; RadGrid1.DataBind(); }
protected void initControl(int ID) { if (ID > 0) { txtID.Value = Convert.ToString(ID); //btn_add.Visible = false; btn_edit.Visible = true; //btn_add1.Visible = false; //btn_add2.Visible = false; btn_edit1.Visible = true; try { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(ID); Bind_ddlPageLayout(); ddlPageLayout.SelectedValue = Convert.ToString(_widgetPageLayout.PageLayoutId); //Bind_ddlWidgetType(); Bind_ddlWidget(0); ddlWidget.SelectedValue = Convert.ToString(_widgetPageLayout.WidgetId); GetRegion(); ddlRegion.SelectedValue = _widgetPageLayout.RegionId; txtWidgetTitle.Text = _widgetPageLayout.Title; hddIcon.Value = _widgetPageLayout.Icon; //if (_widgetPageLayout.Icon != "") // ltl_icon.Text = "<img src='" + ResolveUrl("~/") + "Upload/Widgets/Icons/" + _widgetPageLayout.Icon + "' width='48px'>"; chkStatus.Checked = _widgetPageLayout.Status; hddRadInfo.Value = _widgetPageLayout.Info; hddRadHTML.Value = _widgetPageLayout.HTML; BindListCate(_widgetPageLayout.Value); BindToCateNewsGroup(); BindToCateNews(Convert.ToInt32(lboGroupCate.SelectedValue)); txtRecord.Text = _widgetPageLayout.Record.ToString();//sửa hddRecord2.Value = _widgetPageLayout.Record2.ToString(); //lboGallary.SelectedValue = _widgetPageLayout.Value; //sửa hddValue2.Value = _widgetPageLayout.Value2; hddOrders.Value = _widgetPageLayout.Orders.ToString(); } catch (Exception ex) { error.Text = ex.Message.ToString(); } } else { Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();"); } }
protected void btn_Del_Click(object sender, EventArgs e) { if (WidgetPageLayoutID() != "") { SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); _widgetBSO.DeleteSYS_WidgetPageLayout(WidgetPageLayoutID()); } AspNetCache.Reset(); ViewWidgetAll(Convert.ToInt32(hddPageLayout.Value)); }
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(); Config config = new 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 = (Config)AspNetCache.GetCache("Config_" + Language.language); } Page.Title = config.Titleweb; if (!string.IsNullOrEmpty(Request["id"])) { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(Convert.ToInt32(Request["id"].ToString())); if (_widgetPageLayout != null) { SYS_WidgetBSO _widgetBSO = new SYS_WidgetBSO(); SYS_Widget _widget = _widgetBSO.GetSYS_WidgetById(_widgetPageLayout.WidgetId); if (_widget != null) { if (_widget.WidgetControl != "") { Control objControl1 = (Control)this.Page.LoadControl(ResolveUrl("~") + "Client/Modules/" + _widget.WidgetDir + "/" + _widget.WidgetControl + ".ascx"); objControl1.ID = _widgetPageLayout.Id.ToString(); PlaceHolder1.Controls.Add(objControl1); // PlaceHolder1.Controls.Add(LoadControl(ResolveUrl("~") + _widget.WidgetDir + "/" + _widget.WidgetControl)); ControlAddParameter(objControl1, _widgetPageLayout.Title, _widgetPageLayout.Icon, _widgetPageLayout.Value, Convert.ToInt32(_widgetPageLayout.Record), _widgetPageLayout.Info, _widgetPageLayout.Value2, Convert.ToInt32(_widgetPageLayout.Record2), _widgetPageLayout.HTML); } } } } }
private void ViewWidgetAll(int _pageLayout) { SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); DataTable table = new DataTable(); if (_pageLayout != 0) { table = _widgetBSO.GetSYS_WidgetPageLayoutFullAll(_pageLayout, Language.language); } RadGrid1.DataSource = table; RadGrid1.DataBind(); }
protected void btn_Order_Click(object sender, EventArgs e) { foreach (GridItem row in RadGrid1.Items) { TextBox textOrder = (TextBox)row.FindControl("txtOrder"); int cOrder = Convert.ToInt32(textOrder.Text); int ID = Convert.ToInt32(row.Cells[4].Text); SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); _widgetBSO.SYS_WidgetPageLayoutUpOrder(ID, cOrder); } ViewWidgetAll1(Convert.ToInt32(ddlPageLayout.SelectedValue), ddlRegion.SelectedValue); error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật Thành công !</div>"; AspNetCache.Reset(); }
protected void btn_add_Click_more(object sender, EventArgs e) { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = ReceiveHtml(); try { int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout); error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>"; AspNetCache.Reset(); } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
protected void Edit() { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = ReceiveHtml(); try { _widgetPageLayoutBSO.UpdateSYS_WidgetPageLayout(_widgetPageLayout); error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>"; initControl(_widgetPageLayout.Id); } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
protected void Add() { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = ReceiveHtml(); try { int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout); error.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>"; initControl(id); } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
protected void btn_add_Click_more(object sender, EventArgs e) { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = ReceiveHtml(); try { int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout); error.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Thêm mới thành công !</div>"; AspNetCache.Reset(); } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
protected void Edit() { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = ReceiveHtml(); try { _widgetPageLayoutBSO.UpdateSYS_WidgetPageLayout(_widgetPageLayout); error.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Cập nhật thành công !</div>"; initControl(_widgetPageLayout.Id); } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
protected void Add() { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = ReceiveHtml(); try { int id = _widgetPageLayoutBSO.CreateSYS_WidgetPageLayoutGet(_widgetPageLayout); error.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Thêm mới thành công !</div>"; initControl(id); } catch (Exception ex) { error.Text = ex.Message.ToString(); } }
protected void btn_PageLayout_Click(object sender, EventArgs e) { SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); DataTable table = new DataTable(); if (ddlPageLayout.SelectedValue == "0") { table = _widgetBSO.GetSYS_WidgetPageLayoutFullAll(Language.language); } else { table = _widgetBSO.GetSYS_WidgetPageLayoutFullAll(Convert.ToInt32(ddlPageLayout.SelectedValue), Language.language); } RadGrid1.DataSource = table; RadGrid1.DataBind(); }
protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); string nName = e.CommandName.ToLower(); switch (nName) { case "_edit": Response.Redirect("~/Homepage.aspx?dll=EditWidgetPageLayout&id=" + Id); break; case "_delete": SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); _widgetBSO.DeleteSYS_WidgetPageLayout(Id); ViewWidgetAll2(Convert.ToInt32(ddlPageLayout.SelectedValue), ddlRegion2.SelectedValue); AspNetCache.Reset(); break; case "_config": break; } }
private static void AddWidgetPageLayout(Control objControl, int PagelayoutId, string urlRoot, Page pageContainer) { ControlCollection _controls = objControl.Controls; SYS_WidgetPageLayoutBSO _widgetBSO = new SYS_WidgetPageLayoutBSO(); DataTable tblWidget = new DataTable(); foreach (Control obj1 in _controls) { if (obj1 != null && obj1.ID != null) { if (!AspNetCache.CheckCache("Widget_" + PagelayoutId + "_" + obj1.ID)) { tblWidget = _widgetBSO.GetSYS_WidgetPageLayoutByRegionId(obj1.ID, PagelayoutId, true, Language.language); AspNetCache.SetCache("Widget_" + PagelayoutId + "_" + obj1.ID, tblWidget); } else { tblWidget = (DataTable)AspNetCache.GetCache("Widget_" + PagelayoutId + "_" + obj1.ID); } if (tblWidget != null && tblWidget.Rows.Count > 0) { for (int i = 0; i < tblWidget.Rows.Count; i++) { DataRow row = tblWidget.Rows[i]; string _path2 = urlRoot + "Client/Modules/" + row["WidgetDir"].ToString() + "/" + row["WidgetControl"].ToString() + ".ascx"; Control objControl1 = (Control)pageContainer.LoadControl(_path2); objControl1.ID = row["Id"].ToString(); obj1.Controls.Add(objControl1); ControlAddParameter(objControl1, row["Title"].ToString(), row["Icon"].ToString(), row["Value"].ToString(), Convert.ToInt32(row["Record"].ToString()), row["Info"].ToString(), row["Value2"].ToString(), Convert.ToInt32(row["Record2"].ToString()), row["HTML"].ToString()); } } } } }
protected void initControl(int ID) { if (ID > 0) { txtID.Value = Convert.ToString(ID); btn_add.Visible = false; btn_edit.Visible = true; btn_add1.Visible = false; btn_add2.Visible = false; btn_edit1.Visible = true; try { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(ID); // Bind_ddlPageLayout(); // ddlPageLayout.SelectedValue = Convert.ToString(_widgetPageLayout.PageLayoutId); hddPageLayout.Value = Convert.ToString(_widgetPageLayout.PageLayoutId); GetRegion(_widgetPageLayout.PageLayoutId); ddlRegion.SelectedValue = _widgetPageLayout.RegionId; Bind_ddlWidgetType(); Bind_ddlWidget(0); ddlWidget.SelectedValue = Convert.ToString(_widgetPageLayout.WidgetId); txtWidgetTitle.Text = _widgetPageLayout.Title; hddIcon.Value = _widgetPageLayout.Icon; //if (_widgetPageLayout.Icon != "") // ltl_icon.Text = "<img src='" + ResolveUrl("~/") + "Upload/Widgets/Icons/" + _widgetPageLayout.Icon + "' width='48px'>"; chkStatus.Checked = _widgetPageLayout.Status; hddRadInfo.Value = _widgetPageLayout.Info; hddRadHTML.Value = _widgetPageLayout.HTML; hddRecord.Value = _widgetPageLayout.Record.ToString(); hddRecord2.Value = _widgetPageLayout.Record2.ToString(); hddValue.Value = _widgetPageLayout.Value; hddValue2.Value = _widgetPageLayout.Value2; hddOrders.Value = _widgetPageLayout.Orders.ToString(); } catch (Exception ex) { error.Text = ex.Message.ToString(); } } else { // Bind_ddlPageLayout(); Bind_ddlWidgetType(); Bind_ddlWidget(0); txtID.Value = ""; GetRegion(Convert.ToInt32(hddPageLayout.Value)); // ddlPageLayout.SelectedIndex = 0; btn_add.Visible = true; btn_edit.Visible = false; btn_add1.Visible = true; btn_add2.Visible = true; btn_edit1.Visible = false; } }