Esempio n. 1
0
    //cau hinh trang hien thi
    public void SetDynamic()
    {
        nav = (XPathNavigator)HttpContext.Current.Application[HttpContext.Current.Session["namePath_file_language_content"].ToString()];
        XPathNodeIterator nodes = nav.Select("/langs/lang");
        CDynamicviewHelperXmlLanguageContent dynamic = new CDynamicviewHelperXmlLanguageContent();

        if (HttpContext.Current.Session["language_content_dynamic"] == null)
        {
            int numCode = nodes.Count;
            dynamic.SetNumberRecord(numCode);
            dynamic.SetPageSize(10);
            dynamic.SetCurrentPage();
            dynamic.SetNavigator(nav);
            HttpContext.Current.Session["language_content_dynamic"] = dynamic;
        }
        else
        {
            dynamic = (CDynamicviewHelperXmlLanguageContent)HttpContext.Current.Session["language_content_dynamic"];
            int numCode = nodes.Count;
            dynamic.SetNumberRecord(numCode);
            dynamic.SetNavigator(nav);
            dynamic.ReSetCurrentPage();
            HttpContext.Current.Session["language_content_dynamic"] = dynamic;
        }
    }
Esempio n. 2
0
    public string[] ShowData_Search(int action)
    {
        //cau hinh trang hien thi
        string           err = "";
        Language_content language_content = new Language_content();

        language_content.SetFile(HttpContext.Current.Session["namePath_file_language_content"].ToString());
        if (language_content.IsExitsFile())
        {
            if (HttpContext.Current.Session["language_content_dynamic_search"] != null)
            {
                try
                {
                    string keysearch = HttpContext.Current.Session["keysearch"].ToString();
                    CDynamicviewHelperXmlLanguageContent dynamic = (CDynamicviewHelperXmlLanguageContent)HttpContext.Current.Session["language_content_dynamic_search"];
                    nav = (XPathNavigator)HttpContext.Current.Application[HttpContext.Current.Session["namePath_file_language_content"].ToString()];
                    XPathNodeIterator nodes = nav.Select("/langs/lang[contains(key,'" + keysearch + "')]");
                    dynamic.SetNumberRecord(nodes.Count);
                    dynamic.SetNavigator(nav);
                    dynamic.SetStringSeach(keysearch);
                }
                catch (Exception ex) { Response.Write(ex.ToString()); }
            }
        }
        else
        {
            CDynamicviewHelperXmlLanguageContent dynamic = new CDynamicviewHelperXmlLanguageContent();
            dynamic.SetNumberRecord(0);
            dynamic.SetStringSeach("");
            dynamic.ReSetCurrentPage();
            HttpContext.Current.Session["language_content_dynamic_search"] = dynamic;
            err = "File ngôn ngữ đã bị xóa. Không tìm kiếm nội dung.";
        }

        string[] arrStr = new string[6];
        string   str    = "";

        if (HttpContext.Current.Session["language_content_dynamic_search"] != null)
        {
            CDynamicviewHelperXmlLanguageContent dynamic = (CDynamicviewHelperXmlLanguageContent)HttpContext.Current.Session["language_content_dynamic_search"];
            if (action == 1)
            {
                dynamic.FirstPage();
            }
            else if (action == 2)
            {
                dynamic.PreviousPage();
            }
            else if (action == 3)
            {
                dynamic.NextPage();
            }
            else if (action == 4)
            {
                dynamic.LastPage();
            }
            else
            {
                dynamic.ReSetCurrentPage();
            }
            string page = "Trang:" + dynamic.GetCurrentPage().ToString() + "/" + dynamic.GetPages().ToString();
            arrStr[0] = page;
            arrStr[2] = dynamic.GetIsFirstPage().ToString();
            arrStr[3] = dynamic.GetIsLastPage().ToString();
            arrStr[4] = dynamic.GetNumberRecord().ToString();
            ArrayList list  = dynamic.GetNodeShow(Edit_language_content);
            int       count = list.Count;
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    str = list[i].ToString();
                }
            }
        }
        arrStr[1] = str;
        arrStr[5] = err;
        return(arrStr);
    }