コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                DataRowView newRow = tW_ClientBindingSource.AddNew() as DataRowView;
                newRow["客户名称ID"] = Guid.NewGuid().ToString();
                newRow["修改时间"]   = DateTime.Now;
                newRow["修改人"]    = Tiger.Tools.Security.UserName;
                tW_ClientBindingSource.EndEdit();
                int position = tW_ClientBindingSource.Find("客户名称ID", newRow["客户名称ID"].ToString());
                tW_ClientBindingSource.Position = position;
                FrmClientEdit frmEdit = new FrmClientEdit();
                frmEdit.csDataSet = this.csDataSet;
                frmEdit.tW_ClientBindingSource.DataSource = this.csDataSet;
                frmEdit.tW_ClientBindingSource.DataMember = "TW_Client";
                frmEdit.tW_ClientBindingSource.Position   = position;
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    this.tW_ClientBindingSource.EndEdit();

                    csDataSet.SaveData();
                }
            }
            catch (Exception ex)
            {
                UserMessages.ShowInfoBox(ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
コード例 #2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         int           position = tW_ClientBindingSource.Position;
         FrmClientEdit frmEdit  = new FrmClientEdit();
         frmEdit.csDataSet = this.csDataSet;
         frmEdit.tW_ClientBindingSource.DataSource = this.csDataSet;
         frmEdit.tW_ClientBindingSource.DataMember = "TW_Client";
         frmEdit.tW_ClientBindingSource.Position   = position;
         if (frmEdit.ShowDialog() == DialogResult.OK)
         {
             this.tW_ClientBindingSource.EndEdit();
             csDataSet.SaveData();
             csDataSet.UpdateYWY();
         }
     }
     catch (Exception ex)
     {
         UserMessages.ShowInfoBox(ex.Message);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }