コード例 #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 confirmGoodButton_Click(object sender, RoutedEventArgs e)
        {
            IWareHouseDao    whd           = new WareHouseDao();
            IMoveRecordDao   mrd           = new MoveRecordDao();
            IGoodDao         igd           = new GoodDao();
            MoveRecord       moverecord    = new MoveRecord();
            List <WareHouse> warehouseList = whd.getWareHouseList();
            Good             good          = new Good();
            bool             find          = false;

            for (int j = 0; j < warehouseList.Count; j++)
            {
                if (Convert.ToInt32(warehouseIdBox.Text) == warehouseList[j].WareHouseID)
                {
                    find = true;
                    moverecord.WareHouse = warehouseList[j];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //遍历查询仓库
                        good = igd.getSingleGood(Convert.ToInt32(dt.Rows[i][0]));
                        moverecord.addGood(good, Convert.ToInt32(dt.Rows[i][2]));
                    }
                }
            }
            if (!find)
            {
                MessageBox.Show("仓库不存在!");
            }
            else
            {
                DateTime now = DateTime.Now;
                moverecord.RemoveTime = now;
                mrd.addmove(moverecord);
            }
            //提交采购单后清空
            dt.Clear();
            dataGridDetail.ItemsSource = dt.DefaultView;
        }