コード例 #1
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDERP
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     Model.InvoiceBYDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoiceBYDetail;
     if (e.Column == this.colProductId)
     {
         if (detail != null)
         {
             Model.Product p = productManager.Get(e.Value.ToString());
             detail.InvoiceBYDetailId       = Guid.NewGuid().ToString();
             detail.Invoice                 = this.invoice;
             detail.InvoiceBYDetailNote     = "";
             detail.InvoiceBYDetailQuantity = 1;
             detail.Product                 = p;
             detail.ProductId               = p.ProductId;
             //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit;
             this.bindingSource1.Position = this.bindingSource1.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;
             if (position != null)
             {
                 detail.DepotPositionId = position.DepotPositionId;
             }
         }
         this.gridControl1.RefreshDataSource();
     }
 }
コード例 #2
0
 /// <summary>
 /// Update a InvoiceBYDetail.
 /// </summary>
 public void Update(Model.InvoiceBYDetail invoiceBYDetail)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(invoiceBYDetail);
 }
コード例 #3
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDERP
 private void gridView1_KeyDown(object sender, KeyEventArgs e)
 {
     if (this.action == "insert" || this.action == "update")
     {
         if (this.CanAdd(this.invoice.Details))
         {
             if (e.KeyData == Keys.Enter)
             {
                 Model.InvoiceBYDetail detail = new Model.InvoiceBYDetail();
                 detail.InvoiceBYDetailId       = Guid.NewGuid().ToString();
                 detail.InvoiceBYDetailNote     = "";
                 detail.InvoiceBYDetailQuantity = 0;
                 detail.InvoiceProductUnit      = "";
                 detail.Product = new Book.Model.Product();
                 this.invoice.Details.Add(detail);
                 this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
             }
         }
         if (e.KeyData == Keys.Delete)
         {
             this.simpleButtonRemove.PerformClick();
         }
         this.gridControl1.RefreshDataSource();
     }
 }
コード例 #4
0
 /// <summary>
 /// Insert a InvoiceBYDetail.
 /// </summary>
 public void Insert(Model.InvoiceBYDetail invoiceBYDetail)
 {
     //
     // todo:add other logic here
     //
     accessor.Insert(invoiceBYDetail);
 }
コード例 #5
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDERP
 private void simpleButtonRemove_Click(object sender, EventArgs e)
 {
     if (this.bindingSource1.Current != null)
     {
         this.invoice.Details.Remove(this.bindingSource1.Current as Book.Model.InvoiceBYDetail);
         if (this.invoice.Details.Count == 0)
         {
             Model.InvoiceBYDetail detail = new Model.InvoiceBYDetail();
             detail.InvoiceBYDetailId       = Guid.NewGuid().ToString();
             detail.InvoiceBYDetailNote     = "";
             detail.InvoiceBYDetailQuantity = 0;
             detail.InvoiceProductUnit      = "";
             detail.Product = new Book.Model.Product();
             this.invoice.Details.Add(detail);
             this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
         }
         this.gridControl1.RefreshDataSource();
     }
 }
コード例 #6
0
ファイル: EditForm.cs プロジェクト: daobataotie/EDERP
        protected override void AddNew()
        {
            this.bindingSource3.DataSource = null;
            this.invoice             = new Model.InvoiceBY();
            this.invoice.InvoiceId   = this.invoiceManager.GetNewId();
            this.invoice.InvoiceDate = DateTime.Now;
            this.invoice.Details     = new List <Model.InvoiceBYDetail>();

            if (this.action == "insert")
            {
                Model.InvoiceBYDetail detail = new Model.InvoiceBYDetail();
                detail.InvoiceBYDetailId       = Guid.NewGuid().ToString();
                detail.InvoiceBYDetailNote     = "";
                detail.InvoiceBYDetailQuantity = 0;
                detail.InvoiceProductUnit      = "";
                detail.Product = new Book.Model.Product();
                this.invoice.Details.Add(detail);
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
            }
        }
コード例 #7
0
 public void Update(Model.InvoiceBYDetail e)
 {
     this.Update <Model.InvoiceBYDetail>(e);
 }
コード例 #8
0
 public void Insert(Model.InvoiceBYDetail e)
 {
     this.Insert <Model.InvoiceBYDetail>(e);
 }