コード例 #1
0
 private void DeleteSelectedHangedOrder()
 {
     //if (this.orderAggregate.HangedOrderList.Count == 1)
     //{
     this.dataGridView_HangedOrder.DataSource = null;
     // }
     this.orderAggregate.HangedOrderList.Remove(this.selectedHangedOrder);
     this.orderAggregate.Save(GlobalUtil.HangedOrderBagPath);
     this.selectedHangedOrder = null;
     this.InitializeDataGridView();
 }
コード例 #2
0
        private void dataGridView_HangedOrder_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)
                    {
                        DialogResult dialogResult = GlobalMessageBox.Show("确定删除该条数据?", "提示", MessageBoxButtons.OKCancel);
                        if (dialogResult != DialogResult.OK)
                        {
                            return;
                        }
                        this.selectedHangedOrder = this.orderAggregate.HangedOrderList[e.RowIndex];
                        this.DeleteSelectedHangedOrder();
                        GlobalMessageBox.Show("删除成功!");
                    }
                    else
                    {
                        if (this.orderAggregate == null || this.orderAggregate.HangedOrderList == null || this.orderAggregate.HangedOrderList.Count == 0)
                        {
                            return;
                        }
                        this.selectedHangedOrder = this.orderAggregate.HangedOrderList[e.RowIndex];
                        if (this.selectedHangedOrder.DetailList != null && this.selectedHangedOrder.DetailList.Count > 0)
                        {
                            foreach (var item in this.selectedHangedOrder.DetailList)
                            {
                                item.SizeDisplayName = CommonGlobalUtil.GetCostumeSizeName(item.CostumeID, item.SizeName);
                            }

                            this.dataGridView_Detail.DataSource = this.selectedHangedOrder?.DetailList;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
        }
コード例 #3
0
 //点击选择按钮
 private void BaseButton_Select_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.HangedOrderSelected != null)
         {
             //如果未选择一行,默认为第一行被选中
             if (this.selectedHangedOrder == null && this.orderAggregate.HangedOrderList != null && this.orderAggregate.HangedOrderList.Count > 0)
             {
                 this.selectedHangedOrder = this.orderAggregate.HangedOrderList[0];
             }
             this.HangedOrderSelected(this.selectedHangedOrder);
         }
         this.DeleteSelectedHangedOrder();
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ee)
     {
         ShowError(ee);
     }
 }