Ejemplo n.º 1
0
        /*-------------------------------------- Fields ----------------------------------------*/

        /*-------------------------------------Properties --------------------------------------*/

        /*------------------------------- Dependency Properties --------------------------------*/

        /*----------------------------------- Constructors -------------------------------------*/

        /*---------------------------------- Public Methods ------------------------------------*/

        /// <summary>
        /// 读取接口并统计数量
        /// </summary>
        /// <param name="vm"></param>
        /// <param name="productPorts"></param>
        /// <returns></returns>
        public static ObservableCollection <PortInputModel> LoadPortInputs(
            Model.ProductModel vm,
            ObservableCollection <ProductPortModel> productPorts)
        {
            var portInputs = new ObservableCollection <PortInputModel>();


            var groups = productPorts.GroupBy(x => x
                                              .PortCateory.Code)
                         .ToList();


            foreach (var g in groups)
            {
                var cateory = GetPortCateories().First(x => x.Code == g.Key);
                var count   = g.Count();

                portInputs.Add(new PortInputModel(vm)
                {
                    PortCateory = cateory,
                    PortCount   = count
                });
            }


            return(portInputs);
        }
 private void DataGridCheckBox_Click(object sender, RoutedEventArgs e)
 {
     if (this.DataGrid_Product.SelectedCells.Count > 0)
     {
         Model.ProductModel TempD = this.DataGrid_Product.SelectedCells[0].Item as Model.ProductModel;
         TempD.IsShow = !TempD.IsShow;
     }
 }
Ejemplo n.º 3
0
 private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
 {
     viewmodel = this.DataContext as Model.ProductModel;
     if (viewmodel.Id != 0)
     {
         title.Text = "修改产品";
     }
     else
     {
         title.Text = "新产品";
     }
 }
Ejemplo n.º 4
0
 private void InitializeData(Model.ProductModel d)
 {
     InitializeData();
     this.d  = d;
     OldGuid = d.Guid;
     this.TextBox_Number.Text        = d.Number;
     this.TextBox_Name.Text          = d.Name;
     this.ComboBox_Material.Text     = d.Material;
     this.ComboBox_Type.Text         = d.Type;
     this.TextBox_Specification.Text = d.Specification;
     this.ComboBox_P1.Text           = d.P1;
     this.ComboBox_P2.Text           = d.P2;
     this.ComboBox_P3.Text           = d.P3;
     this.ComboBox_P4.Text           = d.P4;
     this.ComboBox_P5.Text           = d.P5;
     this.ComboBox_P6.Text           = d.P6;
     this.TextBox_PackageNumber.Text = d.PackageNumber.ToString();
     this.TextBox_Remark.Text        = d.Remark;
     OldAddTime = d.AddTime.ToString();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 弹出编辑框
 /// </summary>
 /// <param name="vm"></param>
 public static void ShowEditProduct(Model.ProductModel vm)
 {
     GlobalViewHelper.ShowDialog(
         new Views.AddDeviceItemView(),
         vm);
 }