Exemplo n.º 1
0
 private void btn_Edit_Click(object sender, RoutedEventArgs e)
 {
     if (dgv_1.SelectedItem == null)
     {
         MessageBox.Show("请选择一条数据");
     }
     else
     {
         PortSRMStationRelative         temp = (PortSRMStationRelative)dgv_1.SelectedItem;
         WinPortStockerStationAddOrEdit win  = new WinPortStockerStationAddOrEdit(temp.Id);
         win.ShowDialog();
         Query();
     }
 }
Exemplo n.º 2
0
        public WinPortStockerStationAddOrEdit(int?id = null)
        {
            InitializeComponent();
            if (id.HasValue)
            {
                var result = AppSession.Dal.GetCommonModelByCondition <PortSRMStationRelative>($"where id = {id.Value}");
                if (!result.Success)
                {
                    MessageBox.Show("没有获取到数据");
                    BtnComfrim.IsEnabled = false;
                }
                this.Title             = this.Title + "- 编辑";
                PortSRMStationRelative = result.Data[0];
            }
            else
            {
                this.Title = this.Title + "- 新增";
            }
            var warehouseResult = AppSession.Dal.GetCommonModelByCondition <Warehouse>("");

            if (!warehouseResult.Success)
            {
                MessageBox.Show($"未能获取到仓库列表:{warehouseResult.Msg}");
                BtnComfrim.IsEnabled = false;
            }
            CbxWarehouse.ItemsSource       = warehouseResult.Data;
            CbxWarehouse.DisplayMemberPath = "Name";
            CbxWarehouse.SelectedValuePath = "Code";

            var dict = CommonHelper.EnumListDic <InOutFlag>("");

            CbxInOut.ItemsSource       = dict;
            CbxInOut.DisplayMemberPath = "Key";
            CbxInOut.SelectedValuePath = "Value";
            GridMain.DataContext       = PortSRMStationRelative;
        }