Exemplo n.º 1
0
        private void FormArvInfo_Load(object sender, EventArgs e)
        {
            devices = CallerFactory.Instance.GetService <ISystemConfigService>().GetAllDevices();//所有设备

            // 设置文本框输入提示
            FieldCfgDto t        = PropertyHelper.FieldCfgItems.Find(q => q.FieldName == "ArvBoxID");
            string      nullText = string.Format("请输入或双击选择{0}", t == null ? "ArvBoxID" : t.FieldShowName);

            txtArvBoxID.SetWatermark(nullText);

            // 设置UI控件的属性
            ConfigControlProperty(this.Tag.ToString());

            // 获得所有档案盒信息
            GetArvBoxs();

            // “编辑”界面下显示档案信息
            if (this.Tag.ToString() == "EDIT")
            {
                // 当前选中的档案信息
                arvCurrent = arvInfoList[0];
                // 加载档案信息
                LoadArvInfo(arvCurrent);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 配置文本框的属性
        /// </summary>
        /// <param name="cn"></param>
        private void ConfigTextBoxProperty(TextEdit cn, string field)
        {
            // 查找文本框的显示名称
            FieldCfgDto arvField = PropertyHelper.FieldCfgItems.Find(item => item.FieldName == field);

            if (arvField != null)
            {
                cn.Enabled = arvField.IsFieldUsable;  // 字段是否可编辑
            }
            //cn.Enabled = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 配置界面标签的属性
        /// </summary>
        private void ConfigLabelProperty(LayoutControlItem cn)
        {
            // 查找标签的显示名称
            FieldCfgDto arvField = PropertyHelper.FieldCfgItems.Find(item => item.FieldName == cn.Text);

            if (arvField != null)
            {
                cn.Text    = arvField.FieldShowName;  // 显示名称
                cn.Enabled = arvField.IsFieldUsable;  // 是否可用
            }
            //cn.Enabled = true;
        }
Exemplo n.º 4
0
        private void FormOPArvInput_Load(object sender, EventArgs e)
        {
            panelSearch.Visible = false;
            FieldCfgDto cfg = PropertyHelper.FieldCfgItems.Find(q => q.FieldName == "ArvID");

            txtArvId.SetWatermark("请输入" + cfg == null?"ArvID":cfg.FieldShowName);
            //InitPager();
            BindData();
            GridControlHelper.Instance.AddControlButton(gvArvInfo, controlButtons);
            // 配置表格列标题和可见性
            GridControlHelper.Instance.ConfigGridViewColumns(gvArvInfo);
            gvArvInfo.BestFitColumns();
        }
Exemplo n.º 5
0
 /// <summary>
 /// 树形结构的节点显示中文字段名
 /// </summary>
 private void ConvertToShowName()
 {
     // 遍历树形节点
     foreach (TreeNode node in tvType.Nodes[0].Nodes)
     {
         if (node.Tag != null)
         {
             // 查找字段的中文显示名
             FieldCfgDto cfg = PropertyHelper.FieldCfgItems.Find(q => q.FieldName == node.Tag.ToString());
             if (cfg != null)
             {
                 // 显示中文字段名
                 node.Text = cfg.FieldShowName;
             }
         }
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// 重置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolReset_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // 利用Linq to XML从XNL文件中读取字段配置信息
            XElement root = XElement.Load(Application.StartupPath + "\\XML\\FieldToShowConfig.xml");

            // 读取XML树中所有的“Field”属性及其子元素的值
            var fieldList = from ele in root.Elements("Field") select ele;

            List <FieldCfgDto> items = new List <FieldCfgDto>();

            // 从XML文件中读取字段信息
            foreach (var item in fieldList)
            {
                // 提取字段信息
                string[]    arr      = item.Value.Split(',');
                FieldCfgDto dictItem = new FieldCfgDto();

                dictItem.FieldName      = item.Attribute("Name").Value.ToString(); // 字段名(对应数据库)
                dictItem.FieldShowName  = arr[0];                                  // 字段UI显示名
                dictItem.IsFieldVisible = arr[2] == "1" ? true : false;            // 是否显示
                dictItem.IsFieldUsable  = arr[1] == "1" ? true : false;            // 是否能用
                dictItem.IsKeyWord      = arr[3] == "1" ? true : false;            // 是否主键
                dictItem.FieldType      = arr[4];                                  // 字段类型
                dictItem.Remark         = arr[5];                                  // 备注
                dictItem.SerialNo       = Convert.ToInt32(arr[6]);                 // 序号

                items.Add(dictItem);
            }

            try
            {
                // 更新数据库
                CallerFactory.Instance.GetService <ISystemConfigService>().Add(items);
                // 更新当前字段配置
                PropertyHelper.FieldCfgItems.AddRange(items);

                MessageUtil.ShowError("字段配置信息恢复到默认值");
            }
            catch (Exception ex)
            {
                MessageUtil.ShowError(ex.Message);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 设置缺省的字段配置信息
        /// </summary>
        private void SetDefaultFieldInfoCfg()
        {
            // 利用Linq to XML从XNL文件中读取字段配置信息
            string   path = Application.StartupPath + "\\XML\\FieldToShowConfig.xml";
            XElement root = XElement.Load(path);

            // 读取XML树中所有的“Field”属性及其子元素的值
            var fieldList = from ele in root.Elements("Field") select ele;

            List <FieldCfgDto> items = new List <FieldCfgDto>();

            // 写入数据库
            foreach (var item in fieldList)
            {
                // 提取字段信息
                string[]    arr      = item.Value.Split(',');
                FieldCfgDto dictItem = new FieldCfgDto();

                dictItem.FieldName      = item.Attribute("Name").Value.ToString(); // 字段名(对应数据库)
                dictItem.FieldShowName  = arr[0];                                  // 字段UI显示名
                dictItem.IsFieldVisible = arr[2] == "1" ? true : false;            // 是否显示
                dictItem.IsFieldUsable  = arr[1] == "1" ? true : false;            // 是否能用
                dictItem.IsKeyWord      = arr[3] == "1" ? true : false;            // 是否主键

                // 将档案字段映射信息保存进属性类
                //PropertyHelper.DataDictItems.Add(arvItem);
                // 同步写进数据库
                //ArvFieldCfgBLL.Instance.Insert(arvItem);
                items.Add(dictItem);
            }
            try
            {
                CallerFactory.Instance.GetService <ISystemConfigService>().Add(items);
                PropertyHelper.FieldCfgItems.AddRange(items);
            }
            catch (Exception)
            {
                MessageUtil.ShowError("添加字典项目失败!");
            }
        }
Exemplo n.º 8
0
        private void FrmArvBox_Load(object sender, EventArgs e)
        {
            try
            {
                // 查询设备信息
                listDeviceInfo = new List <DeviceDto>(CallerFactory.Instance.GetService <ISystemConfigService>().GetAllDevices());

                if (listDeviceInfo.Count > 0)
                {
                    // 初始化下拉框
                    foreach (DeviceDto item in listDeviceInfo)
                    {
                        cbxGroupNo.Properties.Items.Add(item.CabinetNo);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageUtil.ShowError(ex.Message);
                return;
            }

            toolOK.Enabled      = true;
            panelSearch.Visible = false;

            // 高级搜索面板标签的显示名称
            foreach (Control cn in panelSearch.Controls)
            {
                if (cn is Label)
                {
                    FieldCfgDto arvField = PropertyHelper.FieldCfgItems.Find(item => item.FieldName == (cn as Label).Text);
                    (cn as Label).Text = arvField.FieldShowName;
                }
            }

            // 检索当前所有档案盒信息
            arvBoxs = new BindingList <ArvBoxDto>(CallerFactory.Instance.GetService <IArvOpService>().FindArvBoxes(null));
            // 表格数据源关联
            gcArvBox.DataSource = arvBoxs;
        }
Exemplo n.º 9
0
        /// <summary>
        /// 配置下拉列表框的属性
        /// </summary>
        /// <param name="cn"></param>
        private void ConfigComboBoxProperty(DevExpress.XtraEditors.ComboBoxEdit cn, string field)
        {
            // 查找ComboBox控件匹配的字段信息
            FieldCfgDto arvField = PropertyHelper.FieldCfgItems.Find(item => item.FieldName == field);

            if (arvField != null)
            {
                // ComboBox控件是否可用
                cn.Enabled = arvField.IsFieldUsable;

                if (cn.Enabled)
                {
                    // 查找ComboBox是否对应可配置字段
                    //        List<DataDictDto> Items = PropertyHelper.DataDictItems.Where<DataDictDto>(item => item.FieldTypeName == field).OrderBy(item => item.FieldTypeSerialNo) .ToList<DataDictDto>();

                    // 加入配置信息到ComboBox下拉框
                    //     if (Items.Count != 0)
                    {
                        // cn.Properties.Items.AddRange(Items.Select(q=>q.FieldTypeValue).ToList());
                    }
                }
            }
        }
 /// <summary>
 /// 更新字段条目
 /// </summary>
 /// <param name="item">实体</param>
 /// <returns></returns>
 public int UpdateFieldCfg(FieldCfgDto fieldDto)
 {
     return(baseSytemConfigService.UpdateFieldCfg(fieldDto.MapTo <FieldCfg>()));
 }
 /// <summary>
 /// 删除字段条目
 /// </summary>
 /// <param name="item">实体</param>
 /// <returns></returns>
 public int Delete(FieldCfgDto fieldDto)
 {
     return(baseSytemConfigService.Delete(fieldDto.MapTo <FieldCfg>()));
 }
 /// <summary>
 /// 加入字段条目
 /// </summary>
 /// <param name="item">实体</param>
 /// <returns></returns>
 public int Add(FieldCfgDto fieldDto)
 {
     return(baseSytemConfigService.Add(fieldDto.MapTo <FieldCfg>()));
 }