Exemplo n.º 1
0
        public static void BindSerie(MetroSearchComboBox combox, int subCateId, List <Series> lstBound = null)
        {
            IList <Series> lstSerie;

            if (lstBound != null)
            {
                lstSerie = lstBound;
            }
            else
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    lstSerie = subCateId > 0 ? uow.SeriesRepository.FindByCategory(subCateId) : uow.SeriesRepository.All();
                    uow.Commit();
                }
            }
            if (lstSerie == null)
            {
                lstSerie = new List <Series>();
            }

            combox.DataSource    = null;
            combox.DataSource    = lstSerie;
            combox.DisplayMember = "SerieName";
            combox.ValueMember   = "SerieId";
        }
Exemplo n.º 2
0
        public static void BindParttWidthALl(MetroSearchComboBox cbb, string SeriesPartID)
        {
            IList <Part> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                if (SeriesPartID == "0")
                {
                    lstSupplier = uow.PartBaseRepository.All();
                }
                else
                {
                    lstSupplier = uow.PartBaseRepository.FindBySeriesPartID(int.Parse(SeriesPartID));
                }

                uow.Commit();
            }
            if (lstSupplier == null)
            {
                return;
            }
            cbb.DataSource = null;
            Part objAll = new Part {
                PartName = "Tất cả", PartID = 0
            };

            lstSupplier.Add(objAll);
            cbb.DataSource    = lstSupplier;
            cbb.DisplayMember = "PartName";
            cbb.ValueMember   = "PartID";
        }
Exemplo n.º 3
0
 public static void BindData <T>(MetroSearchComboBox combobox, List <T> lstSoucre, string displayMember, string valueMember) where T : class
 {
     if (string.IsNullOrEmpty(displayMember) || string.IsNullOrWhiteSpace(displayMember))
     {
         return;
     }
     combobox.DataSource    = null;
     combobox.DataSource    = lstSoucre;
     combobox.DisplayMember = displayMember;
     combobox.ValueMember   = valueMember;
 }
Exemplo n.º 4
0
        private void frmEditProductProperty_Load(object sender, EventArgs e)
        {
            InititalizeForm(m_QuotationDetail);
            using (IUnitOfWork uow = new UnitOfWork())
            {
                List <ProductPicture> lstPicture = uow.ProductPictureRepository.FindByProduct(m_Product);
                m_Company = uow.CompanyRepository.Find(m_Company.CompanyId);
                InititalizeForm(m_Company);
                InititalizeForm(m_Product);

                displayMultiplePicture1.ImgList = new string[5];
                displayMultiplePicture1.Show(lstPicture);
                foreach (Control c in Controls)
                {
                    if (c is MetroSearchComboBox)
                    {
                        MetroSearchComboBox cbb = c as MetroSearchComboBox;
                        if (cbb.Tag != null)
                        {
                            IList <CustomModel.ProductProperty> lstProperty = uow.ProductRepository.getProperty(cbb.Tag.ToString(), m_Product);
                            ComboboxUtility.BindData <CustomModel.ProductProperty>(cbb, lstProperty, "Value", "Id");
                            cbb.SelectedValue = 0;
                        }
                    }
                }
                metroSearchComboBox2.SelectedValueChanged  += metroSearchComboBox2_SelectedValueChanged;
                metroSearchComboBox3.SelectedValueChanged  += metroSearchComboBox3_SelectedValueChanged;
                metroSearchComboBox4.SelectedValueChanged  += metroSearchComboBox4_SelectedValueChanged;
                metroSearchComboBox5.SelectedValueChanged  += metroSearchComboBox5_SelectedValueChanged;
                metroSearchComboBox6.SelectedValueChanged  += metroSearchComboBox6_SelectedValueChanged;
                metroSearchComboBox7.SelectedValueChanged  += metroSearchComboBox7_SelectedValueChanged;
                metroSearchComboBox8.SelectedValueChanged  += metroSearchComboBox8_SelectedValueChanged;
                metroSearchComboBox9.SelectedValueChanged  += metroSearchComboBox9_SelectedValueChanged;
                metroSearchComboBox10.SelectedValueChanged += metroSearchComboBox10_SelectedValueChanged;
                metroSearchComboBox11.SelectedValueChanged += metroSearchComboBox11_SelectedValueChanged;
                metroSearchComboBox12.SelectedValueChanged += metroSearchComboBox12_SelectedValueChanged;
                metroSearchComboBox13.SelectedValueChanged += metroSearchComboBox13_SelectedValueChanged;
                metroSearchComboBox14.SelectedValueChanged += metroSearchComboBox14_SelectedValueChanged;
                metroSearchComboBox15.SelectedValueChanged += metroSearchComboBox15_SelectedValueChanged;
                metroSearchComboBox17.SelectedValueChanged += metroSearchComboBox17_SelectedValueChanged;
                metroSearchComboBox18.SelectedValueChanged += metroSearchComboBox18_SelectedValueChanged;
                metroSearchComboBox20.SelectedValueChanged += metroSearchComboBox20_SelectedValueChanged;
                metroSearchComboBox21.SelectedValueChanged += metroSearchComboBox21_SelectedValueChanged;
                //metroSearchComboBox2.Text = m_QuotationDetail.ClassSafety;
                CoverObjectUtility.SetAutoBindingData(this, m_QuotationDetail);
            }
        }
Exemplo n.º 5
0
        public static void BindLampType(MetroSearchComboBox cbb)
        {
            IList <LampTypes> lstLampType;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstLampType = uow.LampTypeRepository.All();
                uow.Commit();
            }
            if (lstLampType != null)
            {
                cbb.DataSource    = null;
                cbb.DataSource    = lstLampType;
                cbb.DisplayMember = "LampTypeName";
                cbb.ValueMember   = "LampTypeId";
            }
        }
Exemplo n.º 6
0
        public static void BindSupplier(MetroSearchComboBox cbb)
        {
            IList <Supplier> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSupplier = uow.SupplierRepository.All();
                uow.Commit();
            }
            if (lstSupplier != null)
            {
                cbb.DataSource    = null;
                cbb.DataSource    = lstSupplier;
                cbb.DisplayMember = "SupplierName";
                cbb.ValueMember   = "SupplierId";
            }
        }
Exemplo n.º 7
0
        public static void BindStandard(MetroSearchComboBox cbb)
        {
            IList <ProductStandard> lstStandard;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstStandard = uow.ProductStandardRepository.All();
                uow.Commit();
            }
            if (lstStandard != null)
            {
                cbb.DataSource    = null;
                cbb.DataSource    = lstStandard;
                cbb.DisplayMember = "StandardName";
                cbb.ValueMember   = "StandardId";
            }
        }
Exemplo n.º 8
0
        public static void BindClassProduct(MetroSearchComboBox cbb)
        {
            IList <ClassProduct> lstClassProduct;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstClassProduct = uow.ClassProductRepository.All();
                uow.Commit();
            }
            if (lstClassProduct != null)
            {
                cbb.DataSource    = null;
                cbb.DataSource    = lstClassProduct;
                cbb.DisplayMember = "ClassProductName";
                cbb.ValueMember   = "ClassProductId";
            }
        }
Exemplo n.º 9
0
        public static void BindOrigin(MetroSearchComboBox combobox)
        {
            IList <Origin> lstOrigin;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstOrigin = uow.OriginRepository.All();
                uow.Commit();
            }
            if (lstOrigin != null)
            {
                combobox.DataSource    = null;
                combobox.DataSource    = lstOrigin;
                combobox.DisplayMember = "OriginName";
                combobox.ValueMember   = "OriginId";
            }
        }
Exemplo n.º 10
0
 private void frmSelectProperty_Load(object sender, EventArgs e)
 {
     InititalizeForm(m_Company);
     InititalizeForm(m_Product);
     //PictureUtility.BindImage(ptPicture, m_Product.PhotoPath);
     using (IUnitOfWork uow = new UnitOfWork())
     {
         List <ProductPicture> lstPicture = uow.ProductPictureRepository.FindByProduct(m_Product);
         displayMultiplePicture1.ImgList = new string[5];
         displayMultiplePicture1.Show(lstPicture);
         foreach (Control c in Controls)
         {
             if (c is MetroSearchComboBox)
             {
                 MetroSearchComboBox cbb = c as MetroSearchComboBox;
                 if (cbb.Tag != null)
                 {
                     IList <CustomModel.ProductProperty> lstProperty = uow.ProductRepository.getProperty(cbb.Tag.ToString(), m_Product);
                     ComboboxUtility.BindData <CustomModel.ProductProperty>(cbb, lstProperty, "Value", "Id");
                     cbb.SelectedValue = 0;
                 }
             }
         }
         //if (m_Product != null && m_Quotation != null)
         //{
         //    m_Product = uow.ProductRepository.Find(m_Product.ProductId);
         //    m_QuotationDetail = uow.QuotationDetailRepository.Find(m_Quotation, m_Product);
         //    IList<Model.QuotationDetail> lstQuotationDetail = new List<Model.QuotationDetail>();
         //    if (m_QuotationDetail == null)
         //    {
         //        m_QuotationDetail = new Model.QuotationDetail();
         //    }
         //    m_QuotationDetail.Product = m_Product;
         //    InitializeForm(m_QuotationDetail);
         //    lstQuotationDetail.Add(m_QuotationDetail);
         //    richTextBox1.Text = ProductUtility.ConvertToDescription<Model.QuotationDetail>(m_QuotationDetail,UtilityFunction.objectToDescriptionIgnore);
         //    //GridUtility.BindingData<Model.QuotationDetail>( lstQuotationDetail);
         //    if (m_Quotation.Company.Class == null) m_Quotation.Company.Class = new Model.CustomerClass();
         //    txtPrice.Text = CurrencyUtility.DecimalToString(m_Product.Price);
         //    txtRate.Text = m_Quotation.Company.Class!=null?m_Quotation.Company.Class.ClassRate.ToString():"0";
         //    txtQuotationPrice.Text = CurrencyUtility.DecimalToString(m_Product.Price * (decimal)m_Quotation.Company.Class.ClassRate);
         //    txtThanhtien.Text = CurrencyUtility.DecimalToString(Convert.ToInt32(txtQuantity.Text) * CurrencyUtility.ToDecimal(txtQuotationPrice.Text));
         //}
     }
 }
Exemplo n.º 11
0
        public static void BindCategory(MetroSearchComboBox combox, int selectvalue = 0)
        {
            IList <Category> lstCate;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstCate = uow.CategoryRepository.All();
                uow.Commit();
            }
            if (lstCate != null)
            {
                combox.DataSource    = null;
                combox.DataSource    = lstCate;
                combox.DisplayMember = "CategoryName";
                combox.ValueMember   = "CategoryId";
                combox.SelectedValue = selectvalue;
            }
        }
Exemplo n.º 12
0
        public static void BindSafety(MetroSearchComboBox cbb)
        {
            IList <ClassSafety> lstSafety;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSafety = uow.ClassSafetyRepository.All();
                uow.Commit();
            }
            if (lstSafety == null)
            {
                return;
            }
            cbb.DataSource    = null;
            cbb.DataSource    = lstSafety;
            cbb.DisplayMember = "ClassSafetyName";
            cbb.ValueMember   = "ClassSafetyId";
        }
Exemplo n.º 13
0
        public static void BindGroupPart(MetroSearchComboBox combox)
        {
            IList <GroupPart> lstCate;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstCate = uow.GroupPartBaseRepository.All();
                uow.Commit();
            }
            if (lstCate != null)
            {
                combox.DataSource = null;
                lstCate.Add(new GroupPart {
                    GroupPartId = 0, GroupPartName = ""
                });
                combox.DataSource    = lstCate;
                combox.DisplayMember = "GroupPartName";
                combox.ValueMember   = "GroupPartId";
            }
        }
Exemplo n.º 14
0
 private void BindCbbData(IUnitOfWork uow, Control ctrols)
 {
     foreach (Control c in ctrols.Controls)
     {
         if (c is MetroSearchComboBox)
         {
             MetroSearchComboBox cbb = c as MetroSearchComboBox;
             if (cbb.Tag != null)
             {
                 IList <CustomModel.ProductProperty> lstProperty = uow.ProductRepository.getProperty(cbb.Tag.ToString(), m_Product);
                 ComboboxUtility.BindData <CustomModel.ProductProperty>(cbb, lstProperty, "Value", "Id");
                 cbb.SelectedValue = 0;
             }
         }
         if (c.HasChildren)
         {
             BindCbbData(uow, c);
         }
     }
 }
Exemplo n.º 15
0
        public static void BindGroupPartWidthALl(MetroSearchComboBox cbb)
        {
            IList <GroupPart> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSupplier = uow.GroupPartBaseRepository.All();
                uow.Commit();
            }
            if (lstSupplier != null)
            {
                cbb.DataSource = null;
                GroupPart objAll = new GroupPart {
                    GroupPartName = "Tất cả", GroupPartId = 0
                };
                lstSupplier.Add(objAll);
                cbb.DataSource    = lstSupplier;
                cbb.DisplayMember = "GroupPartName";
                cbb.ValueMember   = "GroupPartId";
            }
        }
Exemplo n.º 16
0
        public static void BindSupplierWidthALl(MetroSearchComboBox cbb)
        {
            IList <Supplier> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSupplier = uow.SupplierRepository.All();
                uow.Commit();
            }
            if (lstSupplier != null)
            {
                cbb.DataSource = null;
                Supplier objAll = new Supplier {
                    SupplierName = "Tất cả", SupplierId = 100
                };
                lstSupplier.Add(objAll);
                cbb.DataSource    = lstSupplier;
                cbb.DisplayMember = "SupplierName";
                cbb.ValueMember   = "SupplierId";
            }
        }
Exemplo n.º 17
0
        public static void BindTypePartWidthALl(MetroSearchComboBox cbb, string groupPartId)
        {
            IList <TypePart> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSupplier = groupPartId != "0" ? uow.TypePartBaseRepository.FindByGroupID(int.Parse(groupPartId)) : uow.TypePartBaseRepository.All();
                uow.Commit();
            }
            if (lstSupplier == null)
            {
                return;
            }
            cbb.DataSource = null;
            cbb.DataSource = lstSupplier;
            TypePart objAll = new TypePart {
                TypePartName = "Tất cả", TypePartID = 0
            };

            lstSupplier.Add(objAll);
            cbb.DisplayMember = "TypePartName";
            cbb.ValueMember   = "TypePartID";
        }
Exemplo n.º 18
0
        public static void BindSeriesParttWidthALl(MetroSearchComboBox cbb, string typePartID)
        {
            IList <SeriesPart> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSupplier = typePartID == "0" ? uow.SeriesPartBaseRepository.All() : uow.SeriesPartBaseRepository.FindByTypeID(int.Parse(typePartID));

                uow.Commit();
            }
            if (lstSupplier == null)
            {
                return;
            }
            cbb.DataSource = null;
            SeriesPart objAll = new SeriesPart {
                SeriesPartName = "Tất cả", SeriesPartId = 0
            };

            lstSupplier.Add(objAll);
            cbb.DataSource    = lstSupplier;
            cbb.DisplayMember = "SeriesPartName";
            cbb.ValueMember   = "SeriesPartId";
        }