Exemplo n.º 1
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();
        }