コード例 #1
0
ファイル: FieldConfig.cs プロジェクト: thachgiasoft/abc-erp
        private void SaveFieldConfig( )
        {
            String strTableName = ViewTableList.GetFocusedDisplayText();

            if (String.IsNullOrEmpty(strTableName))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            #region Save
            DialogResult result = DevExpress.XtraEditors.XtraMessageBox.Show(String.Format("Do you want to save FieldConfig of table '{0}' ?", strTableName), "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                STFieldConfigController configCtrl = new STFieldConfigController();
                foreach (DataRow dr in ((DataView)this.ViewFieldConfig.DataSource).Table.Rows)
                {
                    STFieldConfigInfo configInfo = (STFieldConfigInfo)configCtrl.GetObjectFromDataRow(dr);
                    if (configInfo != null)
                    {
                        configCtrl.UpdateObject(configInfo);
                        isModified = true;
                    }
                }
            }
            #endregion

            isNeedSave = false;

            Cursor.Current = Cursors.Default;
        }
コード例 #2
0
ファイル: FieldConfig.cs プロジェクト: thachgiasoft/abc-erp
        void ViewTableList_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (isNeedSave)
            {
                SaveFieldConfig();
            }

            String strTableName = ViewTableList.GetFocusedDisplayText();

            if (String.IsNullOrEmpty(strTableName))
            {
                return;
            }

            DataSet ds = ABCDataLib.ConnectionManager.DatabaseHelper.RunQuery(String.Format("SELECT * FROM  STFieldConfig WHERE TableName='{0}'", strTableName));

            if (ds != null && ds.Tables.Count > 0)
            {
                this.GridFieldConfig.DataSource = ds.Tables[0];
            }
        }