コード例 #1
0
        private void confirmGoodButton_Click(object sender, RoutedEventArgs e)
        {
            IWareHouseDao    whd           = new WareHouseDao();
            IProcurementDao  ipd           = new ProcementDao();
            IGoodDao         igd           = new GoodDao();
            Procurement      procurment    = new Procurement();
            List <WareHouse> warehouseList = whd.getWareHouseList();
            int warehouseid = Convert.ToInt32(warehouseBox.Text);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                for (int j = 0; j < warehouseList.Count; j++)
                {
                    if (warehouseid == warehouseList[j].WareHouseID)
                    {
                        procurment.WareHouse = warehouseList[j];
                        Good good = igd.getSingleGood(Convert.ToInt32(dt.Rows[i][0]));
                        Dictionary <Good, int> listgood_number = new Dictionary <Good, int>();
                        listgood_number.Add(good, Convert.ToInt32(dt.Rows[i][3]));
                        //procurment还需要自己添加一个自身employee信息
                        procurment.addGood(good, listgood_number[good]);
                    }
                }
            }
            DateTime now = DateTime.Now;

            procurment.WareHouse.WareHouseID = warehouseid;
            procurment.Employee.EmployeeID   = 0;
            procurment.StorageTime           = now;
            ipd.addProcurement(procurment);
            dt.Clear();
            dataGridDetail.ItemsSource = dt.DefaultView;
        }
コード例 #2
0
        private void Search_Copy_Click(object sender, RoutedEventArgs e)
        {
            IProcurementDao pd = new ProcementDao();
            string          s  = textBox_Copy2.Text;
            DataSet         ds = new DataSet();
            int             i;

            if (int.TryParse(s, out i))
            {
                ds = pd.getMyProcurement(i);
                dataGrid.ItemsSource = ds.Tables[0].DefaultView;
            }
            else
            {
                MessageBox.Show("请输入数字");
            }
        }
コード例 #3
0
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                IProcurementDao pd = new ProcementDao();
                DataRowView     mySelectedElement = (DataRowView)dataGrid.SelectedItem; //获取datagrid选择的对象


                string result = mySelectedElement.Row[0].ToString();
                int    i;
                if (int.TryParse(result, out i))
                {
                    dataGridDetail.ItemsSource = pd.getProcurementInfo(i).Tables[0].DefaultView;
                }
            }
            catch (Exception ex)
            {
                return;
            }
        }