private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txt_AppIdentifier.Text))
     {
         MessageBoxEx.Show("该程序唯一标识不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (string.IsNullOrWhiteSpace(txt_ConfigName.Text))
     {
         MessageBoxEx.Show("该配置名称不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if ((cmcsAppletConfig == null || cmcsAppletConfig.AppIdentifier != txt_AppIdentifier.Text || cmcsAppletConfig.ConfigName != txt_ConfigName.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsAppletConfig>(" where appIdentifier=:appIdentifier and ConfigName=:ConfigName", new { appIdentifier = txt_AppIdentifier.Text, ConfigName = txt_ConfigName.Text }).Count > 0)
     {
         MessageBoxEx.Show("该程序唯一标识中配置名称不可重复!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.EditMode == eEditMode.修改)
     {
         cmcsAppletConfig.AppIdentifier = txt_AppIdentifier.Text;
         cmcsAppletConfig.ConfigName    = txt_ConfigName.Text;
         cmcsAppletConfig.ConfigValue   = txt_ConfigValue.Text;
         Dbers.GetInstance().SelfDber.Update(cmcsAppletConfig);
     }
     else if (this.EditMode == eEditMode.新增)
     {
         cmcsAppletConfig = new CmcsAppletConfig();
         cmcsAppletConfig.AppIdentifier = txt_AppIdentifier.Text;
         cmcsAppletConfig.ConfigName    = txt_ConfigName.Text;
         cmcsAppletConfig.ConfigValue   = txt_ConfigValue.Text;
         Dbers.GetInstance().SelfDber.Insert(cmcsAppletConfig);
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
示例#2
0
        public string GetCommonAppletConfig(string configName)
        {
            CmcsAppletConfig config = selfDber.Entity <CmcsAppletConfig>("where AppIdentifier=:AppIdentifier and ConfigName=:ConfigName ", new { AppIdentifier = "公共配置", ConfigName = configName });

            if (config != null)
            {
                return(config.ConfigValue);
            }
            return(string.Empty);
        }
示例#3
0
 private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e)
 {
     foreach (GridRow gridRow in e.GridPanel.Rows)
     {
         CmcsAppletConfig entity = gridRow.DataItem as CmcsAppletConfig;
         if (entity == null)
         {
             return;
         }
     }
 }
示例#4
0
        /// <summary>
        /// 获取程序配置
        /// </summary>
        /// <param name="appIdentifier">程序唯一标识</param>
        /// <param name="configName">配置名称</param>
        /// <returns></returns>
        public string GetAppletConfigString(string appIdentifier, string configName)
        {
            CmcsAppletConfig appletConfig = SelfDber.Entity <CmcsAppletConfig>("where AppIdentifier=:AppIdentifier and ConfigName=:ConfigName", new { AppIdentifier = appIdentifier, ConfigName = configName });

            if (appletConfig != null)
            {
                return(appletConfig.ConfigValue);
            }

            return(string.Empty);
        }
        private void FrmAppletConfig_Oper_Load(object sender, EventArgs e)
        {
            this.cmcsAppletConfig = Dbers.GetInstance().SelfDber.Get <CmcsAppletConfig>(this.PId);
            if (this.cmcsAppletConfig != null)
            {
                txt_AppIdentifier.Text = cmcsAppletConfig.AppIdentifier;
                txt_ConfigName.Text    = cmcsAppletConfig.ConfigName;
                txt_ConfigValue.Text   = cmcsAppletConfig.ConfigValue;
            }

            if (this.EditMode == eEditMode.查看)
            {
                btnSubmit.Enabled = false;
                HelperUtil.ControlReadOnly(panelEx2, true);
            }
        }
示例#6
0
        /// <summary>
        /// 设置程序配置
        /// </summary>
        /// <param name="appIdentifier">程序唯一标识</param>
        /// <param name="configName">配置名称</param>
        /// <param name="configValue">值</param>
        /// <returns></returns>
        public bool SetAppletConfig(string appIdentifier, string configName, string configValue)
        {
            CmcsAppletConfig appletConfig = SelfDber.Entity <CmcsAppletConfig>("where AppIdentifier=:AppIdentifier and ConfigName=:ConfigName", new { AppIdentifier = appIdentifier, ConfigName = configName });

            if (appletConfig != null)
            {
                appletConfig.ConfigValue = configValue;
                return(SelfDber.Update(appletConfig) > 0);
            }
            else
            {
                return(SelfDber.Insert(new CmcsAppletConfig()
                {
                    AppIdentifier = appIdentifier,
                    ConfigName = configName,
                    ConfigValue = configValue
                }) > 0);
            }
        }
示例#7
0
        private void superGridControl1_CellMouseDown(object sender, GridCellMouseEventArgs e)
        {
            CmcsAppletConfig entity = Dbers.GetInstance().SelfDber.Get <CmcsAppletConfig>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmAppletConfig_Oper frmShow = new FrmAppletConfig_Oper(entity.Id, eEditMode.查看);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmAppletConfig_Oper frmEdit = new FrmAppletConfig_Oper(entity.Id, eEditMode.修改);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                // 查询正在使用该供应商的车数
                if (MessageBoxEx.Show("确定要删除该配置信息?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    try
                    {
                        Dbers.GetInstance().SelfDber.Delete <CmcsAppletConfig>(entity.Id);
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该配置信息正在使用中,禁止删除!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;
            }
        }