/// <summary> /// 行数据更改 /// </summary> private void RowUpdate() { int id = GetModelID(); if (id >= 0) { FrmCustomerCard frmCustomerCard = new FrmCustomerCard(); frmCustomerCard.Model = bll.GetModel(id); frmCustomerCard.Status = CardEnum.UPDATE; frmCustomerCard.ShowDialog(); if (frmCustomerCard.DialogResult == System.Windows.Forms.DialogResult.OK) { if (bll.Update(frmCustomerCard.Model)) { BindData(); } else { QQMessageBox.Show( this, string.Format(MessageText.SQL_ERROR_CUSTOMER_UPDATE, frmCustomerCard.Model.CustomerName), MessageText.MESSAGEBOX_CAPTION_WARN, QQMessageBoxIcon.Warning, QQMessageBoxButtons.OK); } } } }
/// <summary> /// 行数据查看 /// </summary> private void RowLook() { if (dataGridView1.SelectedCells.Count == 1 || dataGridView1.SelectedRows.Count == 1) { int rowIndex = dataGridView1.SelectedCells[0].RowIndex; int id = PhysicalConstants.ERROR_ID; try { id = Convert.ToInt32(dataGridView1.Rows[rowIndex].Cells[ColID.Name].Value); } catch (Exception ex) { QQMessageBox.Show( this, string.Format(MessageText.TIP_ERROR_ID, ex.Message), MessageText.MESSAGEBOX_CAPTION_ERROR, QQMessageBoxIcon.Error, QQMessageBoxButtons.OK); return; } FrmCustomerCard frmCustomerCard = new FrmCustomerCard(); frmCustomerCard.Model = bll.GetModel(id); frmCustomerCard.Status = CardEnum.LOOK; frmCustomerCard.ShowDialog(); } else { QQMessageBox.Show( this, MessageText.TIP_ERROR_SELECTCOUNT_ONE, MessageText.MESSAGEBOX_CAPTION_TIP, QQMessageBoxIcon.Information, QQMessageBoxButtons.OK); } }
/// <summary> /// 行数据增加 /// </summary> private void RowAdd() { FrmCustomerCard frmCustomerCard = new FrmCustomerCard(); frmCustomerCard.Status = CardEnum.ADD; frmCustomerCard.ShowDialog(); if (frmCustomerCard.DialogResult == System.Windows.Forms.DialogResult.OK) { int ret = bll.Add(frmCustomerCard.Model); if (ret == PhysicalConstants.SQL_Existed) { QQMessageBox.Show( this, string.Format(MessageText.SQL_ERROR_CUSTOMER_ADD, frmCustomerCard.Model.CustomerName), MessageText.MESSAGEBOX_CAPTION_TIP, QQMessageBoxIcon.Information, QQMessageBoxButtons.OK); } else { BindData(); } } }