private void EditAction(object sender, RoutedEventArgs e) { var index = Chargo_DataGrid.SelectedIndex; Console.WriteLine(list[index]); MyDialog dialog = new MyDialog(list[index], false, "修改货物信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } //list[index] = dialog.getObjResult() as EmpObj; var item = dialog.getObjResult() as CarObj; var key = list[index].货物号; if (item.货物号 != key) { helper.Cargo_alter(key, 6, item.货物号, 0); key = item.货物号; } helper.Cargo_alter(key, 1, item.称, 0); helper.Cargo_alter(key, 2, item.进价.ToString(), 1); helper.Cargo_alter(key, 3, item.售价.ToString(), 1); helper.Cargo_alter(key, 5, item.库存量.ToString(), 1); resetList(); }
private void editOrder(object sender, RoutedEventArgs e) { var index = Order_DataGrid.SelectedIndex; Console.WriteLine(list[index]); MyDialog dialog = new MyDialog(list[index], false, "修改订单信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } var item = dialog.getObjResult() as OrderObj; var key = list[index].订单号; if (item.订单号 != key) { helper.ManOrder_alter(key, 8, item.订单号, 0); key = item.订单号; } int operatorCode = helper.ManOrder_alter(key, 1, item.销售日期, 0); if (operatorCode != 0) { MessageBox.Show(item.订单号 + " : " + Sql.ErrorCodeToString(operatorCode)); } helper.ManOrder_alter(key, 2, item.货物编号, 0); helper.ManOrder_alter(key, 3, item.客户编号, 0); helper.ManOrder_alter(key, 4, item.员工编号, 0); helper.ManOrder_alter(key, 5, item.货物数量.ToString().Trim(), 1); resetList(); }
private void EditAction(object sender, RoutedEventArgs e) { var index = Emp_DataGrid.SelectedIndex; Console.WriteLine(list[index]); MyDialog dialog = new MyDialog(list[index], false, "修改员工信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } Console.WriteLine(dialog.DialogResult); if (dialog.DialogResult == true) { //list[index] = dialog.getObjResult() as EmpObj; var item = dialog.getObjResult() as EmpObj; var key = list[index].工号; int operatorCode; if (item.工号 != key) { operatorCode = helper.ManEmp_alter(key, 8, item.工号, 0); if (operatorCode != 0) { return; } key = item.工号; } helper.ManEmp_alter(key, 1, item.姓名, 0); helper.ManEmp_alter(key, 2, item.性别.ToString(), 0); helper.ManEmp_alter(key, 3, item.年龄.ToString(), 1); helper.ManEmp_alter(key, 5, item.基本工资.ToString(), 1); helper.ManEmp_alter(key, 7, ((int)item.用户类型).ToString(), 1); resetList(); } }