private void toolStripButton_Add_Click(object sender, EventArgs e) { FrmBaseSaleItem saleItem = new FrmBaseSaleItem(); saleItem.ItemSaleProperty = 1; if (saleItem.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SaleItem item = new SaleItem(); item.getSaleItemByID(saleItem.saleItemID); int index = this.dataGridView_SaleItem.Rows.Add(); dataGridView_SaleItem.Rows[index].Cells["ColItemID"].Value = item.ItemID; dataGridView_SaleItem.Rows[index].Cells["ColItemType"].Value = item.ItemTypeCode; dataGridView_SaleItem.Rows[index].Cells["ColTypeName"].Value = item.ItemTypeName; dataGridView_SaleItem.Rows[index].Cells["ColBuilding"].Value = item.Building; dataGridView_SaleItem.Rows[index].Cells["ColUnit"].Value = item.Unit; dataGridView_SaleItem.Rows[index].Cells["ColItemNum"].Value = item.ItemNum; dataGridView_SaleItem.Rows[index].Cells["ColArea"].Value = item.Area; dataGridView_SaleItem.Rows[index].Cells["ColPrice"].Value = item.Price.ToString(); dataGridView_SaleItem.Rows[index].Cells["ColAmout"].Value = Math.Round((double.Parse(item.Area) * double.Parse(item.Price)), 0, MidpointRounding.AwayFromZero).ToString("F0"); getRowsTotalAmount(); } }
/// <summary> /// 向dataGridView添加销售房产信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton_Add_Click(object sender, EventArgs e) { FrmBaseSaleItem frmSaleItem = new FrmBaseSaleItem(); if (frmSaleItem.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (isExist(frmSaleItem.saleItemID)) { return; } SaleItem item = new SaleItem(); item.getSaleItemByID(frmSaleItem.saleItemID); bool isBind = Convert.ToBoolean(item.IsBind); if (!isBind) { if (isHavMain()) { Prompt.Information("仅允许添加一个主售房源!"); return; } } int index = 0; if (isBind) { index = dataGridView_SaleItem.Rows.Add(); } else { dataGridView_SaleItem.Rows.Insert(0, 1); } dataGridView_SaleItem.Rows[index].Cells["ColItemID"].Value = item.ItemID; dataGridView_SaleItem.Rows[index].Cells["ColItemTypeCode"].Value = item.ItemTypeCode; dataGridView_SaleItem.Rows[index].Cells["ColItemTypeName"].Value = item.ItemTypeName; dataGridView_SaleItem.Rows[index].Cells["ColIsBind"].Value = item.IsBind; dataGridView_SaleItem.Rows[index].Cells["ColBuilding"].Value = item.Building; dataGridView_SaleItem.Rows[index].Cells["ColUnit"].Value = item.Unit; dataGridView_SaleItem.Rows[index].Cells["ColItemNum"].Value = item.ItemNum; dataGridView_SaleItem.Rows[index].Cells["ColSubscribeArea"].Value = item.Area; dataGridView_SaleItem.Rows[index].Cells["ColSubscribePrice"].Value = item.Price; dataGridView_SaleItem.Rows[index].Cells["ColSubscribeAmout"].Value = Math.Round((double.Parse(item.Area) * double.Parse(item.Price)), 0, MidpointRounding.AwayFromZero).ToString(); dataGridView_SaleItem.Rows[index].Cells["ColIsBind"].Value = item.IsBind; if (!bool.Parse(item.IsBind)) { GetLastContractDate(item.ItemID); } getRowsTotalAmount(); } }