private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (CommonGlobalUtil.ConvertToString(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) == "删除") { //DialogResult dialogResult = GlobalMessageBox.Show("确定删除该条数据?", "提示", MessageBoxButtons.OKCancel); //if (dialogResult != DialogResult.OK) //{ // return; //} PfCustomerRetailDetail detail = this.PfCustomerRetailDetailList[e.RowIndex]; this.PfCustomerRetailDetailList.RemoveAt(e.RowIndex); dataGridViewPagingSumCtrl.BindingDataSource(this.PfCustomerRetailDetailList); } } } catch (Exception ee) { GlobalUtil.WriteLog(ee); } }
private void BaseButton_AddCostume_Click(object sender, EventArgs e) { try { int buyCount = int.Parse(this.skinTextBox_bugCount.SkinTxt.Text); //if (buyCount <= 0) //{ // GlobalMessageBox.Show("退货数量必须大于0!"); // return; //} PfCustomerRetailDetail detail = new PfCustomerRetailDetail() { CostumeID = this.currentSelectedItem.Costume.ID, CostumeName = this.currentSelectedItem.Costume.Name, ColorName = this.skinComboBox_Color.Text, SizeName = ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), // 显示自己设置的尺码组和对应的尺码列表 SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), CommonGlobalCache.GetSizeGroup(this.currentSelectedItem.Costume.SizeGroupName)), BuyCount = buyCount, }; if (!this.AddSelectedCostumeToList(detail)) { return; } dataGridViewPagingSumCtrl.BindingDataSource(this.PfCustomerRetailDetailList); this.skinTextBox_bugCount.SkinTxt.Text = "1"; } catch (Exception ee) { CommonGlobalUtil.WriteLog(ee); GlobalMessageBox.Show("添加失败!"); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (e.ColumnIndex == Column1.Index) { PfCustomerRetailDetail detail = this.PfCustomerRetailDetailList[e.RowIndex]; this.PfCustomerRetailDetailList.RemoveAt(e.RowIndex); if (PfCustomerRetailDetailList != null && PfCustomerRetailDetailList.Count == 0) { // 删除判断是否整个清空了,如果清空了,则清空客户信息 lastAddCustomer = null; } dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(this.PfCustomerRetailDetailList)); } } } catch (Exception ee) { GlobalUtil.WriteLog(ee); } }
//将绑定的PfCustomerRetailDetail源转换成RefundDetail private PfCustomerRetailDetail PfCustomerRetailDetailToRefundDetail(PfCustomerRetailDetail PfCustomerRetailDetail, string orderID) { return(new PfCustomerRetailDetail() { CostumeID = PfCustomerRetailDetail.CostumeID, CostumeName = GlobalCache.GetCostumeName(PfCustomerRetailDetail.CostumeID), ColorName = PfCustomerRetailDetail.ColorName, SizeName = PfCustomerRetailDetail.SizeName, BuyCount = PfCustomerRetailDetail.BuyCount, SizeDisplayName = PfCustomerRetailDetail.SizeDisplayName, }); }
//当单元格中的金额或折扣值发生变化时,对应修改另一项的值 private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > -1) { try { PfCustomerRetailDetail detail = this.PfCustomerRetailDetailList[e.RowIndex]; this.dataGridView1.Refresh(); } catch (Exception ex) { GlobalUtil.WriteLog(ex); } } }
public override void HighlightCostume() { if (dataGridView_RetailDetail.DataSource != null) { if (!String.IsNullOrEmpty(BaseModifyCostumeID)) { foreach (DataGridViewRow row in dataGridView_RetailDetail.Rows) { PfCustomerRetailDetail detail = row.DataBoundItem as PfCustomerRetailDetail; HighlightCostume(row, detail?.CostumeID); } } dataGridView_RetailDetail.Refresh(); } }
private bool AddSelectedCostumeToList(PfCustomerRetailDetail detail) { foreach (PfCustomerRetailDetail PfCustomerRetailDetail in this.PfCustomerRetailDetailList) { if (PfCustomerRetailDetail.CostumeID == detail.CostumeID && PfCustomerRetailDetail.ColorName == detail.ColorName && PfCustomerRetailDetail.SizeName == detail.SizeName) { GlobalMessageBox.Show("列表中已存在该款商品!"); int rowIndex = this.PfCustomerRetailDetailList.IndexOf(PfCustomerRetailDetail); this.dataGridView1.ClearSelection(); this.dataGridView1.Rows[rowIndex].Selected = true; return(false); } } this.PfCustomerRetailDetailList.Add(detail); return(true); }