Ejemplo n.º 1
0
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     Model.InvoiceBSDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoiceBSDetail;
     if (e.Column == this.colproductId)
     {
         if (detail != null)
         {
             Model.Product p = productManager.Get(e.Value.ToString());
             detail.InvoiceBSDetailId       = Guid.NewGuid().ToString();
             detail.Invoice                 = this.invoice;
             detail.InvoiceBSDetailNote     = "";
             detail.InvoiceBSDetailQuantity = 0;
             detail.Product                 = p;
             detail.ProductId               = p.ProductId;
             //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit;
             this.bindingSourceInvoiceBSDetail.Position = this.bindingSourceInvoiceBSDetail.IndexOf(detail);
             this.gridControl1.RefreshDataSource();
         }
     }
     if (e.Column == this.gridColumnPositionId)
     {
         if (detail != null)
         {
             Model.DepotPosition position = new BL.DepotPositionManager().Get(e.Value.ToString());
             detail.DepotPosition   = position;
             detail.DepotPositionId = position.DepotPositionId;
         }
         this.gridControl1.RefreshDataSource();
     }
 }
Ejemplo n.º 2
0
        private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            Model.InvoiceHZDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoiceHZDetail;
            if (e.Column == this.colProductId)
            {
                if (detail != null)
                {
                    Model.Product p = productManager.Get(e.Value.ToString());
                    detail.InvoiceHZDetailId       = Guid.NewGuid().ToString();
                    detail.InvoiceHZDetailMoney    = 0;
                    detail.InvoiceHZDetailNote     = "";
                    detail.InvoiceHZDetailPrice    = 0;
                    detail.InvoiceHZDetailQuantity = 0;
                    detail.Product   = p;
                    detail.ProductId = p.ProductId;
                    //detail.InvoiceCGDetailPrice = detail.Product.ProductCurrentCGPrice == null ? 0 : detail.Product.ProductCurrentCGPrice.Value;
                    //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit;
                    //detail.InvoiceCGDetailMoney0 = Convert.ToDecimal(detail.InvoiceCGDetailQuantity.Value) * detail.InvoiceCGDetailPrice;
                    //detail.InvoiceCGDetailMoney1 = detail.InvoiceCGDetailMoney0;
                    this.bindingSourceInvoiceHZDetail.Position = this.bindingSourceInvoiceHZDetail.IndexOf(detail);
                }
                this.gridControl1.RefreshDataSource();
            }
            if (e.Column == this.DepotPositionId)
            {
                if (detail != null)
                {
                    Model.DepotPosition position = new BL.DepotPositionManager().Get(e.Value.ToString());
                    detail.DepotPosition = position;

                    if (position != null)
                    {
                        detail.DepotPositionId = position.DepotPositionId;
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }