Beispiel #1
0
        /// <summary>
        /// 新增紗規格
        /// </summary>
        /// <param name="yarnSpecification"></param>
        /// <returns></returns>
        public int AddYarnSpecification(YarnSpecification yarnSpecification)
        {
            string sqlCmd = @"INSERT INTO [dbo].[YarnSpecification]
            ([Ingredient],[YarnCount],[Color])
            VALUES
            (@Ingredient,@YarnCount,@Color)";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Ingredient", SqlDbType.NVarChar)
                {
                    Value = yarnSpecification.Ingredient
                },
                new SqlParameter("@YarnCount", SqlDbType.NVarChar)
                {
                    Value = yarnSpecification.YarnCount
                },
                new SqlParameter("@Color", SqlDbType.NVarChar)
                {
                    Value = yarnSpecification.Color
                }
            };
            var result = DapperHelper.ExecuteParameter(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameters);

            return(result);
        }
Beispiel #2
0
        private void DataGridYarnSpecification_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid          dataGrid          = sender as DataGrid;
            YarnSpecification yarnSpecification = dataGrid.SelectedItem as YarnSpecification;
            IEnumerable <MerchantYarnPrice> merchantYarnPrices = FabricModule.GetYarnPriceByYarnSpecificationNo(yarnSpecification.YarnSpecificationNo);

            DataGridMerchantYarnPrice.ItemsSource = merchantYarnPrices;
        }
Beispiel #3
0
        private void ButtonChangeYarn_Click(object sender, RoutedEventArgs e)
        {
            YarnSpecification      yarnSpecification      = DataGridYarnSpecification.SelectedItem as YarnSpecification;
            MerchantYarnPrice      merchantYarnPrice      = DataGridMerchantYarnPrice.SelectedItem as MerchantYarnPrice;
            SpecificationYarnPrice specificationYarnPrice = new SpecificationYarnPrice
            {
                YarnPriceNo  = merchantYarnPrice.YarnPriceNo,
                Ingredient   = yarnSpecification.Ingredient,
                Name         = merchantYarnPrice.Name,
                Color        = yarnSpecification.Color,
                YarnCount    = yarnSpecification.YarnCount,
                YarnMerchant = merchantYarnPrice.YarnMerchant,
                Price        = merchantYarnPrice.Price
            };

            ChangeYarnExecute(specificationYarnPrice);
        }
Beispiel #4
0
        private void SearchIngredientChangedExecute()
        {
            string          filterText = SearchIngredient;
            ICollectionView cv         = CollectionViewSource.GetDefaultView(YarnSpecificationList);

            if (!string.IsNullOrEmpty(filterText))
            {
                var splitText = filterText.Split(' ');
                cv.Filter = o =>
                {
                    /* change to get data row value */
                    YarnSpecification p    = o as YarnSpecification;
                    string            spec = p.Ingredient ?? "";

                    bool isContains = true;
                    foreach (var item in splitText)
                    {
                        if (!spec.ToUpper().Contains(item.ToUpper()))
                        {
                            isContains = false;
                            break;
                        }
                    }
                    //isContains = p.I_03.ToUpper().Contains(filterText.ToUpper());
                    return(isContains);
                    /* end change to get data row value */
                };
            }
            else
            {
                cv.Filter = o =>
                {
                    return(true);
                };
            };
        }
Beispiel #5
0
        /// <summary>
        /// 新增紗規格
        /// </summary>
        /// <param name="yarnSpecification"></param>
        /// <returns></returns>
        public bool AddYarnSpecification(YarnSpecification yarnSpecification)
        {
            int count = FabricAdapter.AddYarnSpecification(yarnSpecification);

            return(count == 1);
        }