public void Add(ProductInfo product, IList<SpecificationView> list)
        {
            try
            {
                NHinbernateSessionFactory.OpenSession();
                //List<Specification> spList = new List<Specification>();
                for (int i = 0; i < list.Count; i++)
                {
                    ProductDao.SaveOrUpdate(product);

                    SpecificationView view = list[i];
                    Specification spec = Translate(view);
                    SpecificationDao.Save(spec);
                    spec.Product = product;

                    //spList.Add();
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                NHinbernateSessionFactory.Commit();
            }
        }
 private void AssignUpdateProduct(ProductInfo product)
 {
     product.ProductName = UpProductName.Text;
     product.ProductNumber = UpProductNumber.Text;
     product.TaxRate = Convert.ToDouble(UpTaxRate.Text);
 }
        public void Update(ProductInfo product, IList<SpecificationView> list)
        {
            try
            {
                NHinbernateSessionFactory.OpenSession();
                ProductDao.Update(product);

                for (int i = 0; i < list.Count; i++)
                {
                    var spec = SystemVariable.ProductService.Translate(list[i]);
                    spec.Product = product;
                    SpecificationDao.SaveOrUpdate(spec);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                NHinbernateSessionFactory.Commit();
            }
        }
 private void AssignAddProduct(ProductInfo product)
 {
     product.ProductName = ApProductName.Text;
     product.ProductNumber = ApProductNumber.Text;
     product.TaxRate =Convert.ToDouble( ApTaxRate.Text);
 }
 //SearchProductPanelShowProduct
 private void AsoSearchProductPanelShowProduct(ProductInfo product)
 {
     if (product == null)
     {
         return;
     }
     this.AsoStorageOutProductName.Text = product.ProductName;
     AsoStorageOutProductNumber.Text = product.ProductNumber;
     if (product.SpecList.Count > 0)
     {
         AsoStorageOutSpeciText.DataSource = product.SpecList;
         AsoStorageOutSpeciText.DisplayMember = "SpecifiText";
         AsoStorageOutSpeciText.ValueMember = "Id";
         AsoSearchProductPanelShowSpec(product.SpecList[0]);
         AsoStorageOutSpeciText.Enabled = true;
     }
 }
 private void UsSearchProductPanelShowProduct(ProductInfo product)
 {
     if (product == null)
     {
         return;
     }
     UsSearchProductName.Text = product.ProductName;
     UsSearchProductNumber.Text = product.ProductNumber;
     if (product.SpecList.Count > 0)
     {
         UsSearchSpeciText.DataSource = product.SpecList;
         UsSearchSpeciText.DisplayMember = "SpecifiText";
         UsSearchSpeciText.ValueMember = "Id";
         UsSearchProductPanelShowSpec(product.SpecList[0]);
         UsSearchSpeciText.Enabled = true;
     }
 }
        private void LoadProductSpecData(ProductInfo product)
        {
            try
            {

            }catch(Exception ex)
            {
                Toast.Show(ex.Message);
            }
        }
        private void AddProductPage_Enter(object sender, EventArgs e)
        {
            try
            {
                List<SpecificationView> list = new List<SpecificationView>();
                DataGridViewManager.RebindListDataSource<SpecificationView>(ApSpecDataGridView, list);
                ApSpecDataGridView.Tag = list;
                if (AddProductPage.Tag == null)
                {
                    ProductInfo product = new ProductInfo();
                    AddProductPage.Tag = product;
                }
                //cbbSpecDataGridViewUnit.DataSource = SystemVariable.SystemDictionarySet[EnumDictionary.Unit];
                //cbbSpecDataGridViewUnit.ValueMember = "Id";
                //cbbSpecDataGridViewUnit.DisplayMember = "DicName";

                SLShowUnit.DataSource = SystemVariable.SystemDictionarySet[EnumDictionary.Unit];
                SLShowUnit.ValueMember = "Id";
                SLShowUnit.DisplayMember = "DicName";

                this.ApUnit.DataSource = SystemVariable.SystemDictionarySet[EnumDictionary.Unit];
                this.ApUnit.ValueMember = "Id";
                this.ApUnit.DisplayMember = "DicName";
                //SLUnit.DataSource = SystemVariable.SystemDictionarySet[EnumDictionary.Unit];
                //SLUnit.DisplayMember = "DicName";
                //SLUnit.ValueMember = "Id";
                //SLUnit.Items.AddRange(SystemVariable.SystemDictionarySet[EnumDictionary.Unit]);
                //SLUnit.Items.Add(SystemVariable.SystemDictionarySet[EnumDictionary.Unit][0].Id);
            }
            catch (Exception ex)
            {
                Toast.Show(ex.Message);
            }
        }