Example #1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (gvPowerSet.FocusedRowHandle < 0 || gvPowerSet.RowCount < 1)
            {
                MessageService.ShowMessage("请选择编辑的数据!", "提示");
                return;
            }

            DataTable dtEditPowerSet = ((DataView)gvPowerSet.DataSource).Table;
            string    pk             = gvPowerSet.GetRowCellValue(gvPowerSet.FocusedRowHandle, BASE_POWERSET.FIELDS_POWERSET_KEY).ToString();

            this._loadKey = pk;
            DataRow[] drEditPowerSets = dtEditPowerSet.Select(string.Format(BASE_POWERSET.FIELDS_POWERSET_KEY + "='{0}'", pk));

            if (drEditPowerSets.Length > 0)
            {
                PowerSetForm psf = new PowerSetForm();
                psf.isEdit   = true;
                psf.drCommon = drEditPowerSets[0];
                if (DialogResult.OK == psf.ShowDialog())
                {
                    InitDataBind();
                }
            }
        }
Example #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DataTable dtEditPowerSet = ((DataView)gvPowerSet.DataSource).Table;
            DataRow   drNew          = dtEditPowerSet.NewRow();

            this._loadKey = FanHai.Hemera.Share.Common.CommonUtils.GenerateNewKey(0);
            drNew[BASE_POWERSET.FIELDS_POWERSET_KEY] = this._loadKey;
            drNew[BASE_POWERSET.FIELDS_CREATER]      = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            PowerSetForm psf = new PowerSetForm();

            psf.isEdit   = false;
            psf.drCommon = drNew;
            if (DialogResult.OK == psf.ShowDialog())
            {
                InitDataBind();
            }
        }