コード例 #1
0
        private void btnAddDtl_Click(object sender, EventArgs e)
        {
            if (gvPowerSetDtl.DataSource == null)
            {
                return;
            }
            DataTable dtEditPowerSetDtl = ((DataView)gvPowerSetDtl.DataSource).Table;
            DataRow   drNew             = dtEditPowerSetDtl.NewRow();

            drNew[BASE_POWERSET_DETAIL.FIELDS_POWERSET_KEY_DTL] = FanHai.Hemera.Share.Common.CommonUtils.GenerateNewKey(0);
            drNew[BASE_POWERSET_DETAIL.FIELDS_POWERSET_KEY]     = _powerSet_Key;
            PowerSetDtlForm psdf = new PowerSetDtlForm();

            psdf.isEdit   = false;
            psdf.drCommon = drNew;
            if (DialogResult.OK == psdf.ShowDialog())
            {
                InitDataBind();
            }
        }
コード例 #2
0
        private void btnModifyDtl_Click(object sender, EventArgs e)
        {
            if (gvPowerSetDtl.FocusedRowHandle < 0 || gvPowerSetDtl.RowCount < 1)
            {
                MessageService.ShowMessage("请选择编辑的子分档数据!", "提示");
                return;
            }

            DataTable dtEditPowerSetDtl = ((DataView)gvPowerSetDtl.DataSource).Table;
            string    pk = gvPowerSetDtl.GetRowCellValue(gvPowerSetDtl.FocusedRowHandle, BASE_POWERSET_DETAIL.FIELDS_POWERSET_KEY_DTL).ToString();

            DataRow[] drEditPowerSetDtls = dtEditPowerSetDtl.Select(string.Format(BASE_POWERSET_DETAIL.FIELDS_POWERSET_KEY_DTL + "='{0}'", pk));

            if (drEditPowerSetDtls.Length > 0)
            {
                PowerSetDtlForm psdf = new PowerSetDtlForm();
                psdf.isEdit   = true;
                psdf.drCommon = drEditPowerSetDtls[0];
                if (DialogResult.OK == psdf.ShowDialog())
                {
                    InitDataBind();
                }
            }
        }