private void btn_Save_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txt_LayoutName.Text))
            {
                txt_LayoutName.ErrorText = "布局名称不能为空!";
                return;
            }

            DataTable dt = dsData.Tables[sys_GridViewLayout._TableName];

            dt.Rows[0][sys_GridViewLayout.HorzLineColor] = txt_HorzLineColor.Color.ToArgb();
            dt.Rows[0][sys_GridViewLayout.VertLineColor] = txt_VertLineColor.Color.ToArgb();

            dsData.Tables[0].Rows[0].EndEdit();

            bool success = bll.Update(dsData);

            DataRowView dv = lue_LayoutName.Properties.GetDataSourceRowByKeyValue(lue_LayoutName.EditValue) as DataRowView;

            if (dv.Row.RowState == DataRowState.Added)
            {
                dv.Row[sys_GridViewLayout.LayoutName] = txt_LayoutName.EditValue;
                dv.Row.Table.AcceptChanges();
            }

            this.DialogResult = DialogResult.OK;
        }
Esempio n. 2
0
        private void RefreshLayout()
        {
            DataSet ds = bll.GetViewLayoutUser(ViewCode);

            if (ds.Tables[0].Rows.Count == 0)
            {
                LayoutHelper.GenerateData(View, ds, ViewCode);

                bll.Update(ds);
            }
            else
            {
                LayoutHelper.LoadData(View, ds);
            }
        }