Exemplo n.º 1
0
        public void SaveBill3(DataRow masterRow, DataTable stateTable)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    string billNo = masterRow["BILLNO"].ToString();

                    pm.BeginTransaction();

                    //���뵥������
                    billDao.UpdateMaster(masterRow);

                    //���뵥����ϸ��
                    stateDao.Delete(billNo);
                    stateDao.Insert(billNo, stateTable);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Exemplo n.º 2
0
        public void SaveBill(DataRow masterRow, DataTable detailTable, Dictionary<string, DataTable> productState)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();
                    ScheduleDao scheduleDao = new ScheduleDao();
                    string billNo = masterRow["BILLNO"].ToString();

                    pm.BeginTransaction();

                    //���뵥������
                    billDao.UpdateMaster(masterRow);

                    //���뵥����ϸ��
                    billDao.DeleteDetail(billNo);
                    billDao.InsertDetail(billNo, detailTable);

                    //����ProductState��
                    if (productState != null)
                    {
                        stateDao.Delete(billNo);
                        int itemNo = 1;
                        foreach (DataTable stateTable in productState.Values)
                        {
                            stateDao.Insert(masterRow["SCHEDULENO"].ToString(),
                                        billNo,
                                        stateTable,
                                        ref itemNo);
                        }
                    }
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }