예제 #1
0
        private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0 || dataGridView1.Rows.Count <= 0)
            {
                return;
            }
            DataGridView dataGridView = sender as DataGridView;
            CostumePrice detail       = (CostumePrice)dataGridView.Rows[e.RowIndex].DataBoundItem;

            try
            {
                if (e.ColumnIndex == SalePriceColumn.Index || e.ColumnIndex == priceDataGridViewTextBoxColumn1.Index)
                {
                    decimal newCount = 0;
                    if (!String.IsNullOrEmpty(e.FormattedValue.ToString()))
                    {
                        newCount = Decimal.Parse(e.FormattedValue.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalMessageBox.Show("输入格式错误!");
                dataGridView.CancelEdit();
            }
        }
 public UpdateShopPriceAndSalePriceForm(CostumePrice item)
 {
     InitializeComponent();
     if (item != null)
     {
         curItem = item;
         this.skinLabelCustomer.Text = item.CostumeID;
         skinTextBoxPrice.Text       = item.Price.ToString();
         skinTextBoxSalePrice.Text   = item.SalePrice.ToString();
     }
 }
예제 #3
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0)
                {
                    return;
                }
                DataGridView dataGridView       = sender as DataGridView;
                CostumePrice costumePrice       = dataGridView.Rows[e.RowIndex].DataBoundItem as CostumePrice;
                UpdateShopCostumePricePara para = new UpdateShopCostumePricePara()
                {
                    ShopId    = costumePrice.ShopId,
                    CostumeID = costumePrice.CostumeID,
                    Price     = costumePrice.Price,
                    SalePrice = costumePrice.SalePrice,
                };
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                InteractResult result = GlobalCache.ServerProxy.UpdateShopCostumePrice(para);
                switch (result.ExeResult)
                {
                case ExeResult.Success:
                    break;

                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
예제 #4
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
         {
             return;
         }
         if (e.RowIndex > -1 && e.ColumnIndex > -1)
         {
             List <CostumePrice> list = DataGridViewUtil.BindingListToList <CostumePrice>(dataGridView1.DataSource);
             CostumePrice        item = (CostumePrice)list[e.RowIndex];
             if (e.ColumnIndex == ColumnUpdate.Index)
             {
                 //  this.AddClick(item, this);
                 Edit(item);
             }
         }
     }
     catch (Exception ex)
     {
         GlobalUtil.ShowError(ex);
     }
 }
예제 #5
0
        private void Edit(CostumePrice item)
        {
            UpdateShopPriceAndSalePriceForm form = new UpdateShopPriceAndSalePriceForm(item);

            form.ShowDialog();
        }