Example #1
0
        private void Del_ByID(HttpContext context)
        {
            String jSonString = "";

            try {
                int         languagesId = Convert.ToInt32(context.Request.QueryString["ID"]);
                LanguagesBO languagesBO = new LanguagesBO();

                int ret = languagesBO.Del_ByID(languagesId);

                if (ret != 0)
                {
                    jSonString = "{\"status\": \"success\"}";
                }
                if (ret == 0)
                {
                    jSonString = "{\"status\":\"error|" + ret + "\"}";
                }
            }
            catch (Exception ex) {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}";
            }
            finally {
                context.Response.Write(jSonString);
            }
        }
Example #2
0
        private void Upd_Disable_ByID(HttpContext context)
        {
            String jSonString = "";

            try {
                LanguagesBO languagesBO = new LanguagesBO();
                int         id          = Convert.ToInt32(context.Request.QueryString["ID"]);
                bool        disable     = Convert.ToBoolean(context.Request.QueryString["Disable"]);
                int         ret         = languagesBO.Upd_Disable(id, disable);
                if (ret == 0)
                {
                    jSonString = "{\"status\":\"error|" + ret + "\"}";
                }
                if (ret != 0)
                {
                    jSonString = "{\"status\": \"success\"}";
                }
            }
            catch (Exception ex) {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}";
            }
            finally {
                context.Response.Write(jSonString);
            }
        }
Example #3
0
        private void Upd_ByID(HttpContext context)
        {
            LanguagesBO languagesBO = new LanguagesBO();
            String      jSonString  = "";

            try {
                int languagesId = Convert.ToInt32(context.Request.Form["txtID"]);
                var aLanguages  = languagesBO.Sel_ByID(languagesId);

                aLanguages.NameLang = !String.IsNullOrEmpty(context.Request.Form["txtNameLang"])
                    ? Convert.ToString(context.Request.Form["txtNameLang"])
                    : aLanguages.NameLang;
                aLanguages.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"])
                    ? Convert.ToString(context.Request.Form["txtImage_1"])
                    : aLanguages.Image;
                aLanguages.Directory = !String.IsNullOrEmpty(context.Request.Form["txtDirectory"])
                    ? Convert.ToString(context.Request.Form["txtDirectory"])
                    : aLanguages.Directory;
                aLanguages.Filename = !String.IsNullOrEmpty(context.Request.Form["txtFilename"])
                    ? Convert.ToString(context.Request.Form["txtFilename"])
                    : aLanguages.Filename;
                aLanguages.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"])
                    ? Convert.ToInt32(context.Request.Form["cbbStatus"])
                    : aLanguages.Status;
                aLanguages.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"])
                    ? Convert.ToInt32(context.Request.Form["cbbType"])
                    : aLanguages.Type;
                aLanguages.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"])
                    ? Convert.ToBoolean(context.Request.Form["cbbDisable"])
                    : aLanguages.Disable;
                int ret = languagesBO.Upd(aLanguages);

                if (ret != 0)
                {
                    jSonString = "{\"status\": \"success\"}";
                }
                if (ret == 0)
                {
                    jSonString = "{\"status\":\"error|" + ret + "\"}";
                }
            }
            catch (Exception ex) {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}";
            }
            finally {
                context.Response.Write(jSonString);
            }
        }
Example #4
0
        private void Sel_ByID(HttpContext context)
        {
            string      jSonString  = string.Empty;
            LanguagesBO languagesBO = new LanguagesBO();

            int  id      = Convert.ToInt32(context.Request.QueryString["ID"]);
            bool disable = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? Convert.ToBoolean(context.Request.QueryString["Disable"])
                : false;
            Languages languages = String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? languagesBO.Sel_ByID(id)
                : languagesBO.Sel_ByID(id, disable);

            if (!languages.Equals(null))
            {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(languages, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";
            context.Response.Write(jSonString);
        }
Example #5
0
        private void Sel(HttpContext context)
        {
            string      jSonString  = string.Empty;
            LanguagesBO languagesBO = new LanguagesBO();
            bool        disable     = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? Convert.ToBoolean(context.Request.QueryString["Disable"])
                : false;
            List <Languages> listLanguages =
                String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                    ? languagesBO.Sel()
                    : languagesBO.Sel(disable);

            if (listLanguages.Any())
            {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(listLanguages, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";

            context.Response.Write(jSonString);
        }
Example #6
0
        //


        //-------- Danh cho phuong phap lay ngon ngu moi -------------
        public static void Load_Language(string SYSTEM)
        {
            LanguagesBO    aLanguagesBO   = new LanguagesBO();
            ConfigsBO      aConfigsBO     = new ConfigsBO();
            List <Configs> ListConfigsCMS = new List <Configs>();
            List <string>  ListCodeCMS    = new List <string>();

            ListConfigsCMS = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_CMS);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeCMS.Add(ListConfigsCMS[i].Value.ToString());
            }
            string         ListCodeTemptCMS = String.Join(",", ListCodeCMS);
            List <Configs> ListConfigsWEB   = new List <Configs>();
            List <string>  ListCodeWEB      = new List <string>();

            ListConfigsWEB = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_WEB);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeWEB.Add(ListConfigsWEB[i].Value.ToString());
            }
            string ListCodeTemptWEB = String.Join(",", ListCodeWEB);

            sys_NUM_LANG = aLanguagesBO.Sel().ToList().Count;

            if (SYSTEM == "CMS")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptCMS);
                sys_CUR_LANG = int.Parse(ListCodeTemptCMS);
            }
            else if (SYSTEM == "WEB")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptWEB);
                sys_CUR_LANG = int.Parse(ListCodeTemptWEB);
            }
        }
Example #7
0
        public static string Load_StaticDataLanguage_Page(HttpContext Context, string SYSTEM)
        {
            LanguagesBO aLanguagesBO = new LanguagesBO();

            ConfigsBO      aConfigsBO     = new ConfigsBO();
            List <Configs> ListConfigsCMS = new List <Configs>();
            List <string>  ListCodeCMS    = new List <string>();

            ListConfigsCMS = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_CMS);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeCMS.Add(ListConfigsCMS[i].Value.ToString());
            }
            string         ListCodeTemptCMS = String.Join(",", ListCodeCMS);
            List <Configs> ListConfigsWEB   = new List <Configs>();
            List <string>  ListCodeWEB      = new List <string>();

            ListConfigsWEB = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_WEB);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeWEB.Add(ListConfigsWEB[i].Value.ToString());
            }
            string ListCodeTemptWEB = String.Join(",", ListCodeWEB);

            sys_NUM_LANG = aLanguagesBO.Sel().ToList().Count;
            if (SYSTEM == "CMS")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptCMS);
            }
            else if (SYSTEM == "WEB")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptWEB);
            }

            if (!string.IsNullOrEmpty(Context.Request.QueryString["IDLang"]))
            {
                sys_CUR_LANG = Convert.ToInt32(Context.Request.QueryString["IDLang"]);
            }
            else
            {
                if (Context.GetSection(key_CUR_LANG) != null)
                {
                    sys_CUR_LANG = Convert.ToInt32(Context.GetSection(key_CUR_LANG).ToString());
                }
                // Cuoi cung moi lay den ngon ngu mac dinh
                else
                {
                    sys_CUR_LANG = int.Parse(ListCodeTemptCMS);
                }
            }


            string      PhysicalPath = Context.Server.MapPath(@"\\Languages\\" + aLanguagesBO.Sel_ByID(sys_CUR_LANG).NameLang + "\\FRAMEWORK\\StaticLanguage.xml");
            XmlDocument doc          = new XmlDocument();

            doc.Load(PhysicalPath);

            XmlElement  element   = doc.DocumentElement;
            XmlNodeList attr_coll = doc.SelectNodes("//item");

            List <LanguagesItem> List_ItemLang = new List <LanguagesItem>();

            LanguagesItem Item;

            foreach (XmlNode node in attr_coll)
            {
                Item      = new LanguagesItem();
                Item.Text = node.InnerText;
                Item.Key  = node.Attributes["Index"].Value;

                List_ItemLang.Add(Item);
            }

            String jSonString = "";

            InfoLang aInfoLang = new InfoLang();

            aInfoLang.DATA_LANG    = List_ItemLang;
            aInfoLang.sys_CUR_LANG = sys_CUR_LANG;
            aInfoLang.sys_DEF_LANG = sys_DEF_LANG;
            aInfoLang.sys_NUM_LANG = sys_NUM_LANG;

            _converter.DateTimeFormat = "dd/MM/yyyy";

            jSonString = JsonConvert.SerializeObject(aInfoLang, _converter);

            //  CORE_Language.CurrentPage.Session[key_LANG_DATA] = List_ItemLang;  // Ngôn ngữ dành cho trang ASPX
            return(jSonString);
        }