public SpecificationView(Specification spec)
 {
     this.Id = spec.Id;
     this.Barcode = spec.Barcode;
     if (spec.Unit != null)
     {
         this.UnitId = spec.Unit.Id;
     }
     this.UnitPrice = spec.UnitPrice;
     this.SpecifiText = spec.SpecifiText;
 }
 public ProductView(Specification spec)
 {
     this.ProductId = spec.Product.Id;
     this.ProductName = spec.Product.ProductName;
     this.ProductNumber = spec.Product.ProductNumber;
     this.Category = spec.Product.Category.CategoryName;
     this.TaxRate = spec.Product.TaxRate;
     this.Barcode = spec.Barcode ;
     this.Unit = spec.Unit.DicName;
     this.UnitPrice = spec.UnitPrice;
     this.SpecifiText = spec.SpecifiText;
 }
 public SpecificationView Translate(Specification spec)
 {
     SpecificationView view = new SpecificationView(spec);
     return view;
 }
 public Specification Translate(SpecificationView view)
 {
     Specification spec = new Specification();
     spec.Id = view.Id;
     spec.UnitPrice = view.UnitPrice;
     spec.SpecifiText = view.SpecifiText;
     spec.Barcode = view.Barcode;
     spec.Unit = UnitDao.Get(view.UnitId);
     spec.IsDel = view.IsDel;
     return spec;
 }
        public void SaveOrUpdateSpecification(Specification spec)
        {
            try
            {
                NHinbernateSessionFactory.OpenSession();
                SpecificationDao.SaveOrUpdate(spec);

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                NHinbernateSessionFactory.Commit();
            }
        }
 private void AsoSearchProductPanelShowSpec(Specification spec)
 {
     if (spec == null)
     {
         return;
     }
     this.AsoStorageOutSpeciText.SelectedValue = spec.Id;
     AsoStorageOutUnit.Text = spec.Unit.DicName;
     AsoStorageOutBarcode.Text = spec.Barcode;
     AsoStorageOutUnitPrice.Text = spec.UnitPrice.ToString();
     if (string.IsNullOrEmpty(AsoStorageOutAmount.Text))
     {
         AsoStorageOutAmount.Text = "1";
     }
 }
 private void AsoSearchProductPanelShowProduct(Specification spec)
 {
     if (spec == null)
     {
         return;
     }
     this.AsoStorageOutBarcode.Tag = spec;
     AsoStorageOutProductName.Text = spec.Product.ProductName;
     AsoStorageOutProductNumber.Text = spec.Product.ProductNumber;
     this.AsoStorageOutSpeciText.DataSource = spec.Product.SpecList;
     AsoStorageOutSpeciText.DisplayMember = "SpecifiText";
     AsoStorageOutSpeciText.ValueMember = "Id";
     AsoSearchProductPanelShowSpec(spec);
     AsoStorageOutSpeciText.Enabled = false;
 }
 private void UsSearchProductPanelShowSpec(Specification spec)
 {
     if (spec == null)
     {
         return;
     }
     this.UsSearchSpeciText .SelectedValue = spec.Id;
     UsSearchUnit.Text = spec.Unit.DicName;
     UsSearchBarcode.Text = spec.Barcode;
     UsSearchUnitPrice.Text = spec.UnitPrice.ToString();
     if (string.IsNullOrEmpty(UsSearchAmount.Text))
     {
         UsSearchAmount.Text = "1";
     }
 }
 private void UsSearchProductPanelShowProduct(Specification spec)
 {
     if (spec == null)
     {
         return;
     }
     UsSearchBarcode.Tag = spec;
     UsSearchProductName.Text = spec.Product.ProductName;
     UsSearchProductNumber.Text = spec.Product.ProductNumber;
     UsSearchSpeciText.DataSource = spec.Product.SpecList;
     UsSearchSpeciText.DisplayMember = "SpecifiText";
     UsSearchSpeciText.ValueMember = "Id";
     UsSearchProductPanelShowSpec(spec);
     UsSearchSpeciText.Enabled = false;
 }