Exemplo n.º 1
0
        public static void ShowAzCustomColumsEdit(BindingSource dataSource, string tablename = "", bool isNew = false)
        {
            AzCustomColumsEdit customColumsEdit = new AzCustomColumsEdit();


            if (isNew)
            {
                var       row  = (dataSource.DataSource as DataTable).NewRow();
                var       c    = AzMetaCustomCloumHandle.Handle().NewAdd(tablename);
                DataTable data = Translator.Translate <AzMetaProfile, AzMetaCustomCloumEntity>(c, "AtkMetaCustomCloum");
                row.ItemArray = data.AsEnumerable().FirstOrDefault().ItemArray;
                (dataSource.DataSource as DataTable).Rows.Add(row);
                dataSource.MoveLast();
                customColumsEdit.IsNew = true;
            }

            customColumsEdit.bindingSource1 = dataSource;

            customColumsEdit.textFldName.DataBindings.Add("Text", dataSource, "FldName", true);
            customColumsEdit.cboBoxFldCodeType.DataBindings.Add("Text", dataSource, "FldCodeType", true);
            customColumsEdit.cboBoxFldType.DataBindings.Add("Text", dataSource, "FldType", true);
            customColumsEdit.textFldDisplay.DataBindings.Add("Text", dataSource, "FldDisplay", true);
            customColumsEdit.textFldLen.DataBindings.Add("Text", dataSource, "FldLen", true);
            customColumsEdit.ckBoxIsIdentity.DataBindings.Add("Checked", dataSource, "IsIdentity", true);
            customColumsEdit.ckBoxIsKeyField.DataBindings.Add("Checked", dataSource, "IsKeyField", true);
            customColumsEdit.ckBoxIsNullable.DataBindings.Add("Checked", dataSource, "IsNullable", true);

            customColumsEdit.ShowDialog();
        }
 private void tspBtnAdd_Click(object sender, System.EventArgs e)
 {
     AzCustomColumsEdit.ShowAzCustomColumsEdit(azMetaCustomCloumListEntityBindingSource, currentSelectObjModeName, true);
 }
 private void tspBtnEdit_Click(object sender, System.EventArgs e)
 {
     AzCustomColumsEdit.ShowAzCustomColumsEdit(azMetaCustomCloumListEntityBindingSource);
 }