Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            new ResxManagerInfo().UpdateResxInfo();
            return;

            strDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Template");
            string strExcelFile = Path.Combine(strDir, "140517-2013DM0038-TAOS1.0多語言词语汇总-V1r00-mingzhu.xls");

            DataSet ds = this.GetExcelData(strExcelFile, "", 1);

            bool            _IsJScript = true;
            ResxManagerInfo _ResxCtrl  = new ResxManagerInfo();
            string          _SysName   = "TAOS";

            return;

            //String _txtWordCN = ChineseConverter.Convert(_Word, ChineseConversionDirection.TraditionalToSimplified);
            //String _txtWordTW = ChineseConverter.Convert(_Word, ChineseConversionDirection.SimplifiedToTraditional);
            //String _txtWordEN = "";
            String _txtWordCN = string.Empty;
            string _txtWordTW = string.Empty;
            string _txtWordEN = string.Empty;

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                string _Word = row["中文繁体"].ToString().Trim();
                //if (string.IsNullOrEmpty(_Word))
                //{
                //    continue;
                //}
                _txtWordCN = ChineseConverter.Convert(_Word, ChineseConversionDirection.TraditionalToSimplified);
                _txtWordTW = ChineseConverter.Convert(_Word, ChineseConversionDirection.SimplifiedToTraditional);
                _txtWordEN = string.Empty;

                string _Key = string.Empty;
                _ResxCtrl.AddResx(out _Key, _Word, _IsJScript, _SysName, "Admin");

                if (!string.IsNullOrEmpty(_Key))
                {
                    bool blnStatus = _ResxCtrl.IsAddResxDetailInfo(_Word, _SysName);
                    if (blnStatus)
                    {
                        _ResxCtrl.AddResxInfo(_Key, _txtWordCN, _txtWordTW, _txtWordEN, "admin", _SysName, String.Empty);
                    }
                }
            }
        }
Exemple #2
0
        private void CreateWordItem()
        {
            _ClientInfo = new ClientInfo();
            Hashtable _MetaHash = new Hashtable();
            Hashtable _Detail   = new Hashtable();

            try
            {
                ResxManagerInfo _ResxCtrl = new ResxManagerInfo();

                String  _SysName   = base.GetQueryValue("sltSysName");
                String  _Word      = base.GetQueryValue("txtWord");
                Boolean _IsJScript = Convert.ToInt16(base.GetQueryValue("chkJScript")) == 1 ? true : false;
                String  _Key       = String.Empty;

                Boolean _IsExists = _ResxCtrl.IsExists(_SysName, _Word, out _Key);
                if (_IsExists)
                {
                    _ClientInfo.Status = _IsExists;
                }
                else
                {
                    _ResxCtrl.AddResx(out _Key, _Word, _IsJScript, _SysName, "Admin");
                    _ClientInfo.Status = string.IsNullOrEmpty(_Key) ? false : true;
                    if (_ClientInfo.Status)
                    {
                        String _txtWordCN = ChineseConverter.Convert(_Word, ChineseConversionDirection.TraditionalToSimplified);
                        String _txtWordTW = ChineseConverter.Convert(_Word, ChineseConversionDirection.SimplifiedToTraditional);
                        String _txtWordEN = "";
                        _ResxCtrl.AddResxInfo(_Key, _txtWordCN, _txtWordTW, _txtWordEN, "admin", _SysName, String.Empty);
                    }
                }

                if (_ClientInfo.Status)
                {
                    CreateResx _CreateResx = new CreateResx();

                    _Detail.Add("Key", _Key);
                    _Detail.Add("Value", _Word);
                    _Detail.Add("CSharp", _CreateResx.GetCSharpCode(_Key, _Word));
                    _Detail.Add("JScript", _CreateResx.GetJScriptCode(_Key, _Word));
                    _MetaHash.Add("WordInfo", _Detail);
                    _ClientInfo.Message = "词条添加成功!";
                }
                else
                {
                    _ClientInfo.Message = "词条添加失败,请稍候再试!";
                }
            }
            catch (Exception ex)
            {
                _ClientInfo.Status  = false;
                _ClientInfo.Message = "数据访问失败,请稍候再试!";
            }
            Hashtable _Hash = new Hashtable();

            _Hash.Add(CONST_COMMON.ClientInfo, _ClientInfo);
            _Hash.Add(CONST_COMMON.Meta, _MetaHash);
            String _Context = MetaDataInfo.GetClientMetaData <Hashtable>(_Hash);

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(_Context);
            HttpContext.Current.Response.End();
        }