Esempio n. 1
0
        /// <summary>
        /// Update a PackageType.
        /// </summary>


        /// <summary>
        /// Update a PackageDetails.
        /// </summary>
        public void Update(Model.PackageDetails packageDetails)
        {
            //
            // todo: add other logic here.
            //
            accessor.Update(packageDetails);
        }
Esempio n. 2
0
 public void Delete(Model.PackageDetails packagedetails)
 {
     //
     // todo:add other logic here
     //
     accessor.Delete(packagedetails.PackageDetailsId);
 }
Esempio n. 3
0
        public PackageEditForm(Book.Model.PackageDetails packageDetails, string action)
            : this()
        {
            //if(cmpy == null)
            //    throw new ArithmeticException();
            this._packageDetails = packageDetails;

            this.action = action;
        }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        /// <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;
            }
        }
Esempio n. 6
0
 protected override void AddNew()
 {
     this._packageDetails = new Book.Model.PackageDetails();
 }
Esempio n. 7
0
 public PackageEditForm(Book.Model.PackageDetails packageDetails) : this()
 {
     this._packageDetails = packageDetails;
     this.action          = "update";
 }