/// <summary> /// Insert a CustomerPackageDetail. /// </summary> public void Insert(Model.CustomerPackageDetail customerPackageDetail) { // // todo:add other logic here // accessor.Insert(customerPackageDetail); }
/// <summary> /// Update a CustomerPackageDetail. /// </summary> public void Update(Model.CustomerPackageDetail customerPackageDetail) { // // todo: add other logic here. // accessor.Update(customerPackageDetail); }
//public EidtForm(Model.CustomerPackage CustomerPackage):this() //{ // // this =CustomerPackage; // //this.CustomerPackage.detail = this.proceduresManager.Select(this.CustomerPackage); // //this.bindingSourceProcedures.DataSource = this.proceduresManager.Select(); // // this.action = "update"; //} //public EidtForm(Model.CustomerPackage CustomerPackage, string action):this() //{ // //this.CustomerPackage = CustomerPackage; // //this.CustomerPackage.detail = this.proceduresManager.Select(this.CustomerPackage); // //this.bindingSourceProcedures.DataSource = this.proceduresManager.Select(); // //this.action = action; //} #region Override // int flag1 = 0; protected override void AddNew() { //flag1 = 1; this._customerPackage = new Model.CustomerPackage(); if (customer != null) { this._customerPackage.Customer = customer; } this._customerPackage.CustomerPackageId = Guid.NewGuid().ToString(); this._customerPackage.detail = new List <Model.CustomerPackageDetail>(); // if (this.action == "insert") { Model.CustomerPackageDetail detail = new Model.CustomerPackageDetail(); detail.CustomerPackageDetailId = Guid.NewGuid().ToString(); detail.Product = new Book.Model.Product(); this._customerPackage.detail.Add(detail); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } }
private void gridView1_CellValueChanging_1(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column == this.gridColumnProductId || e.Column == this.gridColumn2) { Model.CustomerPackageDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.CustomerPackageDetail; if (detail != null) { Model.Product p = productManager.Get(e.Value.ToString()); if (p != null) { detail.CustomerPackageDetailId = Guid.NewGuid().ToString(); detail.ConsumeRate = 0; detail.Quantity = 1; detail.CustomerPackage = this._customerPackage; if (this._customerPackage != null) { detail.CustomerPackageId = this._customerPackage.CustomerPackageId; } detail.Description = ""; detail.ExpiringDate = global::Helper.DateTimeParse.EndDate; detail.EffectsDate = DateTime.Now;; detail.Product = p; detail.ProductId = p.ProductId; // detail.InvoiceProductUnit = p.DepotUnit == null ? "" : p.DepotUnit.CnName; } this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }
public override void Refresh() { //flag = 0; if (this._customerPackage == null) { //this._customerPackage = new Book.Model.CustomerPackage(); //this.action = "insert"; this.AddNew(); } if (this.action != "insert") { this._customerPackage.detail = this.CustomerPackageDetailManager.GetByPackageId(this._customerPackage.CustomerPackageId); } if (this.action == "update") { if (this._customerPackage.detail.Count == 0) { Model.CustomerPackageDetail detail = new Model.CustomerPackageDetail(); detail.CustomerPackageDetailId = Guid.NewGuid().ToString(); this._customerPackage.detail.Add(detail); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } } this.textEditCustomerPackageId.Text = this._customerPackage.Id; this.newChooseCustomer.EditValue = this._customerPackage.Customer; this.bindingSource1.DataSource = this._customerPackage.detail; base.Refresh(); }
private void simpleButtonAppend_Click(object sender, EventArgs e) { if (this.action == "insert" || this.action == "update") { Model.CustomerPackageDetail detail = new Model.CustomerPackageDetail(); detail.CustomerPackageDetailId = Guid.NewGuid().ToString(); this._customerPackage.detail.Add(detail); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); this.gridControl1.RefreshDataSource(); } }
private void simpleButtonRemover_Click(object sender, EventArgs e) { if (this.bindingSource1.Current != null) { this._customerPackage.detail.Remove(this.bindingSource1.Current as Book.Model.CustomerPackageDetail); if (this._customerPackage.detail.Count == 0) { Model.CustomerPackageDetail detail = new Model.CustomerPackageDetail(); detail.CustomerPackageDetailId = Guid.NewGuid().ToString(); detail.Product = new Book.Model.Product(); this._customerPackage.detail.Add(detail); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }