private void LoadSpecialData(int pID) { txtSystem.Text = ContentDAO.Find(pID).Title; txten.Text = LocalizedPropertyDAO.Find(pID, 1, "Content", "Title") == null ? "" : LocalizedPropertyDAO.Find(pID, 1, "Content", "Title").LocaleValue; txtjp.Text = LocalizedPropertyDAO.Find(pID, 2, "Content", "Title") == null ? "" : LocalizedPropertyDAO.Find(pID, 2, "Content", "Title").LocaleValue; txtvi.Text = LocalizedPropertyDAO.Find(pID, 3, "Content", "Title") == null ? "" : LocalizedPropertyDAO.Find(pID, 3, "Content", "Title").LocaleValue; ckFullen.Text = LocalizedPropertyDAO.Find(pID, 1, "Content", "Body").LocaleValue; ckFulljp.Text = LocalizedPropertyDAO.Find(pID, 2, "Content", "Body").LocaleValue; ckFullvn.Text = LocalizedPropertyDAO.Find(pID, 3, "Content", "Body").LocaleValue; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int l; if (Request.Cookies["l"] != null) { l = int.Parse(Request.Cookies["l"].Value); } else { HttpContext.Current.Response.Cookies.Add(new HttpCookie("l", "1")); l = 1; } string cate = Common.RequestID("cate"); if (Common.RequestID("id") != "") { var id = Common.RequestID("id"); switch (cate) { case "c": var x = ContentDAO.Find(id); var y = LocalizedPropertyDAO.Find(x.Id, l, "Content", "Body"); var t = LocalizedPropertyDAO.Find(x.Id, l, "Content", "Title").LocaleValue; Page.Title = t + Resources.language.title_separator + Resources.language.website_name; Literal1.Text = y.LocaleValue; break; case "s": var z = ServiceDAO.Find(id); Literal1.Text = LocalizedPropertyDAO.Find(z.Id, l, "Service", "Body") == null ? "":LocalizedPropertyDAO.Find(z.Id, l, "Service", "Body").LocaleValue; var title = LocalizedPropertyDAO.Find(z.Id, l, "Service", "Title").LocaleValue; Page.Title = title + Resources.language.title_separator + Resources.language.website_name; break; } } else { var z = ContentDAO.Find("default"); Literal1.Text = LocalizedPropertyDAO.Find(z.Id, l, "Content", "Body") == null ? "" : LocalizedPropertyDAO.Find(z.Id, l, "Content", "Body").LocaleValue; var t = LocalizedPropertyDAO.Find(z.Id, l, "Content", "Title").LocaleValue; Page.Title = t + Resources.language.title_separator + Resources.language.website_name; content.Controls.AddAt(0, LoadControl(NivoSliderControl)); } } }
private void Save(string type) { if (Validate()) { #region Insert SanPham if (_id != 0) { ContentDAO.Find(_id).Title = txtSystem.Text; if (LocalizedPropertyDAO.Find(_id, 1, "Content", "Title") == null) { LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = _id, LanguageId = 1, LocaleKeyGroup = "Content", LocaleKey = "Title", LocaleValue = txten.Text }); } else { LocalizedPropertyDAO.Find(_id, 1, "Content", "Title").LocaleValue = txten.Text; } if (LocalizedPropertyDAO.Find(_id, 2, "Content", "Title") == null) { LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = _id, LanguageId = 2, LocaleKeyGroup = "Content", LocaleKey = "Title", LocaleValue = txtjp.Text }); } else { LocalizedPropertyDAO.Find(_id, 2, "Content", "Title").LocaleValue = txtjp.Text; } if (LocalizedPropertyDAO.Find(_id, 3, "Content", "Title") == null) { LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = _id, LanguageId = 3, LocaleKeyGroup = "Content", LocaleKey = "Title", LocaleValue = txtvi.Text }); } else { LocalizedPropertyDAO.Find(_id, 3, "Content", "Title").LocaleValue = txtvi.Text; } LocalizedPropertyDAO.Find(_id, 1, "Content", "Body").LocaleValue = ckFullen.Text; LocalizedPropertyDAO.Find(_id, 2, "Content", "Body").LocaleValue = ckFulljp.Text; LocalizedPropertyDAO.Find(_id, 3, "Content", "Body").LocaleValue = ckFullvn.Text; ContentDAO.Update(); } else { var x = new DAO.Content { Title = txtSystem.Text }; ContentDAO.Insert(x); LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = x.Id, LanguageId = 1, LocaleKeyGroup = "Content", LocaleKey = "Title", LocaleValue = txten.Text }); LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = x.Id, LanguageId = 2, LocaleKeyGroup = "Content", LocaleKey = "Title", LocaleValue = txtjp.Text }); LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = x.Id, LanguageId = 3, LocaleKeyGroup = "Content", LocaleKey = "Title", LocaleValue = txtvi.Text }); LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = x.Id, LanguageId = 1, LocaleKeyGroup = "Content", LocaleKey = "Body", LocaleValue = ckFullen.Text }); LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = x.Id, LanguageId = 2, LocaleKeyGroup = "Content", LocaleKey = "Body", LocaleValue = ckFulljp.Text }); LocalizedPropertyDAO.Insert(new LocalizedProperty { EntityId = x.Id, LanguageId = 3, LocaleKeyGroup = "Content", LocaleKey = "Body", LocaleValue = ckFullvn.Text }); } #endregion if (type == "Publish") { Response.Redirect("/AppAdmin/Content/Index.aspx"); } else if (type == "Save") { Response.Redirect("/AppAdmin/Content/Index.aspx"); } } else { iRightAccess.Visible = false; ObjControl.LoadMyControl(idNotPermissionAccess, NotPermissControl); } }