Esempio n. 1
0
        protected void btSearch_Click(object sender, EventArgs e)
        {
            this.ClearCtrlInfo();
            String  _FKey = txtKey.Text.Trim();
            DataSet _DS   = new ResxManagerInfo().GetDetailWordInfo(_FKey, "en-US");

            if (_DS != null && _DS.Tables.Count > 0 && _DS.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow _Row in _DS.Tables[0].Rows)
                {
                    String _Type = _Row["Resx_Type"].ToString().Trim();
                    if (String.Equals(_Type, CultureType.ZH_CN, StringComparison.CurrentCultureIgnoreCase))
                    {
                        txtCN.Value = _Row["Resx_Text"].ToString().Trim();
                    }
                    if (String.Equals(_Type, CultureType.ZH_TW, StringComparison.CurrentCultureIgnoreCase))
                    {
                        txtTW.Value = _Row["Resx_Text"].ToString().Trim();
                    }
                    if (String.Equals(_Type, CultureType.EN_US, StringComparison.CurrentCultureIgnoreCase))
                    {
                        txtEN.Value = _Row["Resx_Text"].ToString().Trim();
                    }
                }
            }
        }
Esempio n. 2
0
        private void GetDetailWordInfo()
        {
            _ClientInfo = new ClientInfo();
            Hashtable _MetaHash = new Hashtable();
            Hashtable _Detail   = new Hashtable();

            try
            {
                String _FKey     = base.GetQueryValue("FKey");
                String _ResxType = base.GetQueryValue("CultureType");

                ResxManagerInfo _ResxCtrl = new ResxManagerInfo();
                DataSet         _DS       = _ResxCtrl.GetDetailWordInfo(_FKey, _ResxType);
                _MetaHash.Add("DetailInfo", MetaDataInfo.GetListHashData(_DS));
                _ClientInfo.Status = true;
            }
            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();
        }
Esempio n. 3
0
        private void LoadWaitWordInfo(String _CultureType)
        {
            _ClientInfo = new ClientInfo();
            Hashtable _MetaHash = new Hashtable();
            Hashtable _Detail   = new Hashtable();

            try
            {
                String _SysName     = base.GetQueryValue("SysName");
                String _strPage     = base.GetQueryValue("PageNum");
                String _strPageSize = base.GetQueryValue("PageSize");
                String _strTrans    = base.GetQueryValue("IsTrans");
                int    _Page        = 1;
                int    _PageSize    = 10;

                int.TryParse(_strPage, out _Page);
                int.TryParse(_strPageSize, out _PageSize);

                Boolean _IsTrans = true;
                if (String.IsNullOrEmpty(_strTrans) || _strTrans == "0")
                {
                    _IsTrans = false;
                }

                ResxManagerInfo _ResxCtrl = new ResxManagerInfo();
                DataSet         _DS       = null;


                _DS = _ResxCtrl.GetWaitWordInfo(_SysName, _Page, _PageSize, _CultureType, _IsTrans);

                _MetaHash.Add("WordInfo", MetaDataInfo.GetListHashData(_DS));
                _ClientInfo.Status = true;
            }
            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();
        }
Esempio n. 4
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);
                    }
                }
            }
        }
Esempio n. 5
0
        private void CheckItemInfo()
        {
            _ClientInfo = new ClientInfo();
            Hashtable _MetaHash = new Hashtable();
            Hashtable _Detail   = new Hashtable();

            String  _SysName = base.GetQueryValue("SysName");
            String  _Word    = base.GetQueryValue("Word").Trim();
            DataSet _DS      = new ResxManagerInfo().CheckItemInfo(_SysName, _Word);

            _MetaHash.Add("WordInfo", MetaDataInfo.GetListHashData(_DS));

            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();
        }
Esempio n. 6
0
        protected void btSearch_Click(object sender, EventArgs e)
        {
            this.ClearCtrlInfo();

            String _Word = String.Empty;
            String _FKey = String.Empty;

            String          _sysName        = sltSysName.Value;
            String          _sltSearchField = sltSearchField.Value;
            String          _txtSearch      = txtSearch.Text.Trim();
            ResxManagerInfo _ResxCtrl       = new ResxManagerInfo();

            DataSet _DSInfo = _ResxCtrl.GetWordInfo(_sysName, String.Format(" {0}=N'{1}'",
                                                                            _sltSearchField, _txtSearch));

            if (_DSInfo != null && _DSInfo.Tables.Count > 0 && _DSInfo.Tables[0].Rows.Count > 0)
            {
                _FKey = _DSInfo.Tables[0].Rows[0]["FKey"].ToString().Trim();
                _Word = _DSInfo.Tables[0].Rows[0]["FValue"].ToString().Trim();
            }

            if (String.IsNullOrEmpty(_FKey))
            {
                return;
            }


            txtFkey.Value = _FKey;
            txtWord.Value = _Word;


            DataSet _DS = _ResxCtrl.GetDetailWordInfo(_FKey, "");

            if (_DS != null && _DS.Tables.Count > 0 && _DS.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow _Row in _DS.Tables[0].Rows)
                {
                    String _Type = _Row["Resx_Type"].ToString().Trim();

                    if (String.Equals(_Type, CultureType.ZH_CN, StringComparison.CurrentCultureIgnoreCase))
                    {
                        txtCN.Value = _Row["Resx_Text"].ToString().Trim();
                    }

                    if (String.Equals(_Type, CultureType.ZH_TW, StringComparison.CurrentCultureIgnoreCase))
                    {
                        txtTW.Value = _Row["Resx_Text"].ToString().Trim();
                    }
                    if (String.Equals(_Type, CultureType.EN_US, StringComparison.CurrentCultureIgnoreCase))
                    {
                        txtEN.Value = _Row["Resx_Text"].ToString().Trim();
                    }
                }
            }

            CreateResx _CreateResx = new CreateResx();

            txtCSharp.Value  = _CreateResx.GetCSharpCode(_FKey, _Word);
            txtJScript.Value = _CreateResx.GetJScriptCode(_FKey, _Word);
            sltSysName.Value = _sysName;
        }
Esempio n. 7
0
        private void CreatResxFile()
        {
            _ClientInfo = new ClientInfo();
            Hashtable _MetaHash = new Hashtable();

            try
            {
                String          _SysName  = base.GetQueryValue("SysName");
                ResxManagerInfo _ResxCtrl = new ResxManagerInfo();
                DataSet         _DS       = _ResxCtrl.GetWaitWordInfo(_SysName);
                DataSet         _Detail   = _ResxCtrl.GetDetailWordInfoBySysName(_SysName);

                String _SavePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resource\\" + _SysName);
                if (!Directory.Exists(_SavePath))
                {
                    Directory.CreateDirectory(_SavePath);
                }

                foreach (String _item in Directory.GetFiles(_SavePath))
                {
                    if (File.Exists(_item))
                    {
                        File.Delete(_item);
                    }
                }

                CreateResx _CreateResx = new CreateResx();
                _CreateResx.SavePath = _SavePath;

                _CreateResx.CreateResxInfo(_DS, _Detail);


                DataTable _Table = new DataTable();
                _Table.Columns.Add("Number");
                _Table.Columns.Add("FileName");
                _Table.Columns.Add("SysName");
                _Table.Columns.Add("CUser");
                _Table.Columns.Add("CTime");
                _Table.Columns.Add("Size");
                DataRow  _NewRow   = null;
                int      _ICount   = 0;
                FileInfo _FileInfo = null;

                foreach (String _File in Directory.GetFiles(_SavePath))
                {
                    _NewRow             = _Table.NewRow();
                    _FileInfo           = new FileInfo(_File);
                    _NewRow["Number"]   = Convert.ToString(++_ICount);
                    _NewRow["FileName"] = _FileInfo.Name;
                    _NewRow["SysName"]  = _SysName;
                    _NewRow["Size"]     = this.GetSize(_FileInfo.Length);
                    _NewRow["CUser"]    = "";
                    _NewRow["CTime"]    = _FileInfo.LastWriteTime.ToString();
                    _Table.Rows.Add(_NewRow);
                    _Table.AcceptChanges();
                }

                _MetaHash.Add("FileInfo", MetaDataInfo.GetListHashData(_Table));
                _ClientInfo.Status = true;
            }
            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();
        }
Esempio n. 8
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();
        }