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; }
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(); }