/// <summary> /// Update a PackageType. /// </summary> /// <summary> /// Update a PackageDetails. /// </summary> public void Update(Model.PackageDetails packageDetails) { // // todo: add other logic here. // accessor.Update(packageDetails); }
public void Delete(Model.PackageDetails packagedetails) { // // todo:add other logic here // accessor.Delete(packagedetails.PackageDetailsId); }
public PackageEditForm(Book.Model.PackageDetails packageDetails, string action) : this() { //if(cmpy == null) // throw new ArithmeticException(); this._packageDetails = packageDetails; this.action = action; }
public override void Refresh() { if (this._packageDetails == null) { this._packageDetails = new Book.Model.PackageDetails(); this.action = "insert"; } //this.textEditId.Text = string.IsNullOrEmpty(this.duty.Id) ? this.duty.DutyId : this.duty.Id; //this.textEditDutyName.Text = this.duty.DutyName; //this.memoEditDutyNote.Text = this.duty.DutyNote; this.buttonEditProduct.EditValue = this._packageDetails.Product; this.calcEditCount.EditValue = this._packageDetails.Quantity; this.CalsumeRate.EditValue = this._packageDetails.ConsumeRate; this.memoEditDescription.EditValue = this._packageDetails.Description; switch (this.action) { case "insert": this.buttonEditProduct.Properties.Buttons[0].Enabled = true; this.buttonEditProduct.Properties.ReadOnly = false; this.calcEditCount.Properties.ReadOnly = false; this.CalsumeRate.Properties.ReadOnly = false; this.memoEditDescription.Properties.ReadOnly = false; break; case "update": this.buttonEditProduct.Properties.Buttons[0].Enabled = true; this.buttonEditProduct.Properties.ReadOnly = false; this.calcEditCount.Properties.ReadOnly = false; this.CalsumeRate.Properties.ReadOnly = false; this.memoEditDescription.Properties.ReadOnly = false; break; case "view": this.buttonEditProduct.Properties.Buttons[0].Enabled = false; this.buttonEditProduct.Properties.ReadOnly = true; this.calcEditCount.Properties.ReadOnly = true; this.CalsumeRate.Properties.ReadOnly = true; this.memoEditDescription.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
/// <summary> /// Insert a PackageDetails. /// </summary> public void Insert(Model.PackageDetails packageDetails) { // // todo:add other logic here // try { V.BeginTransaction(); packageDetails.PackageDetailsId = Guid.NewGuid().ToString(); accessor.Insert(packageDetails); //packageType.CreateDate = DateTime.Now; //packageType.InsertTime = DateTime.Now; //packageType.PackageTypeId = Guid.NewGuid().ToString(); //accessor.Insert(packageType); //foreach (Model.PackageDetails details in packageType.PruoductsDetails) //{ // if (string.IsNullOrEmpty(details.PackageDetailsId)) // { // details.PackageDetailsId = Guid.NewGuid().ToString(); // } // details.PackageTypeId = packageType.PackageTypeId; // details.ProductId = details.Product.ProductId; // packageDetailsAccessor.Insert(details); //} //foreach (Model.PackageTypeCustomer packageCustomer in packageType.CustomerDetails) //{ // if (string.IsNullOrEmpty(packageCustomer.PrimaryKey)) // { // packageCustomer.PrimaryKey = Guid.NewGuid().ToString(); // } // packageCustomer.CustomerId = packageCustomer.Customer.CustomerId; // packageCustomer.PackageTypeId = packageType.PackageTypeId; // packageTypeCustomerAccessor.Insert(packageCustomer); //} V.CommitTransaction(); } catch { V.RollbackTransaction(); throw; } }
protected override void AddNew() { this._packageDetails = new Book.Model.PackageDetails(); }
public PackageEditForm(Book.Model.PackageDetails packageDetails) : this() { this._packageDetails = packageDetails; this.action = "update"; }