コード例 #1
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public override void RefreshData()
        {
            try
            {
                List <ConfigParaServiceMap> serviceList  = this._configLogic.GetAllConfigParaServiceMap();
                ConfigParaServiceMap        selectedItem = null;
                if (pgServiceList.SelectedRows.Length > 0)
                {
                    var oldSelectedItem = ((DataGridViewRow)pgServiceList.SelectedRows[0]).DataBoundItem as ConfigParaServiceMap;
                    if (oldSelectedItem != null)
                    {
                        var ret = (from tmpItem in serviceList where oldSelectedItem.ID == tmpItem.ID select tmpItem).ToList();
                        if (ret.Count > 0)
                        {
                            selectedItem = ret[0];
                        }
                    }
                }

                this.pgServiceList.DataRowSelectionChanged -= this.pgServiceList_SelectionChanged;
                try
                {
                    this._serviceList.Clear();
                    this._serviceList.AddRange(serviceList);
                }
                finally
                {
                    DataGridView dgv = (DataGridView)pgServiceList.GridControl;
                    foreach (DataGridViewRow selectedRow in dgv.SelectedRows)
                    {
                        selectedRow.Selected = false;
                    }

                    this.pgServiceList.DataRowSelectionChanged += this.pgServiceList_SelectionChanged;
                    if (selectedItem != null)
                    {
                        foreach (DataGridViewRow row in dgv.Rows)
                        {
                            if (row.DataBoundItem == selectedItem)
                            {
                                row.Selected = true;
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
コード例 #2
0
        private void pgServiceList_DataRowDoubleClick(object sender, DataRowClickArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            ConfigParaServiceMap serviceMap = (ConfigParaServiceMap)e.Row;
            var frm = new FServiceConfigParaKeyValueEdit(this._configLogic, serviceMap);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                this.pgServiceList_SelectionChanged(sender, new DataRowSelectionChangedArgs(-1, -1, e.Row, null, null));
            }
        }
コード例 #3
0
ファイル: ConfigBLL.cs プロジェクト: windygu/UtilZ.DotnetEx
        public void ModifyValidDomain(List <int> addIDs, List <int> delIDs, ConfigParaServiceMap serviceMap)
        {
            using (var dbcon = this._dbAccess.CreateConnection(DBIBase.Model.DBVisitType.W))
            {
                IDbConnection  con         = dbcon.DbConnection;
                IDbTransaction transaction = con.BeginTransaction();
                var            paraSign    = this._dbAccess.ParaSign;

                if (delIDs.Count > 0)
                {
                    var cmdDel = this._dbAccess.CreateCommand(con);
                    cmdDel.Transaction = transaction;
                    cmdDel.CommandText = string.Format("delete from ConfigParaValidDomain where SID={0}SID AND CID={0}CID", paraSign);
                    DBAccessEx.AddParameter(cmdDel, "SID", serviceMap.ID);
                    IDbDataParameter delParameter = DBAccessEx.CreateParameter(cmdDel, "CID");

                    foreach (var delID in delIDs)
                    {
                        delParameter.Value = delID;
                        cmdDel.ExecuteNonQuery();
                    }
                }

                if (addIDs.Count > 0)
                {
                    var cmdInsert = this._dbAccess.CreateCommand(con);
                    cmdInsert.Transaction = transaction;
                    cmdInsert.CommandText = string.Format("INSERT INTO ConfigParaValidDomain (SID, CID) VALUES ({0}SID, {0}CID)", paraSign);
                    IDbDataParameter insertSIDParameter = DBAccessEx.CreateParameter(cmdInsert, "SID");
                    IDbDataParameter insertCIDParameter = DBAccessEx.CreateParameter(cmdInsert, "CID");

                    foreach (var addID in addIDs)
                    {
                        insertSIDParameter.Value = serviceMap.ID;
                        insertCIDParameter.Value = addID;
                        cmdInsert.ExecuteNonQuery();
                    }
                }
            }
        }
コード例 #4
0
 public FServiceConfigParaKeyValueEdit(ConfigBLL configLogic, ConfigParaServiceMap serviceMap) : this()
 {
     this._configLogic = configLogic;
     this._serviceMap  = serviceMap;
 }