Example #1
0
        //�ƿ���ҵ
        public void TaskBillMove(string billNo, string userID, string date)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();
                TaskDao taskDao = new TaskDao();
                CellDao cellDao = new CellDao();

                try
                {
                    pm.BeginTransaction();
                    DataTable masterTable = billDao.FindMaster(billNo);
                    if (masterTable.Rows.Count != 0)
                    {
                        string taskType = masterTable.Rows[0]["TTYPE"].ToString();
                        string taskLevel = masterTable.Rows[0]["TASKLEVEL"].ToString();
                        string target = masterTable.Rows[0]["TARGET"].ToString();

                        int taskCount = stateDao.FindCount(billNo);

                        //���Ļ�λ����״̬
                        int cellCount = cellDao.Update(billNo, taskType);
                        int newCellCount = cellDao.Update2(billNo, taskType);

                        if (taskCount != cellCount || taskCount != newCellCount)
                            throw new Exception("��ҵ������ɲ�����λ������һ��");

                        //����task��ҵ��
                        taskDao.Insert(billNo, taskType, taskLevel, target);

                        ////����billmaster״̬
                        billDao.UpdateMasterState(billNo, "3", "TASKER", userID, "TASKDATE", date);

                    }
                    else
                        throw new Exception(string.Format("δ�ҵ����ݺ�Ϊ'{0}'�ĵ��ݡ�", billNo));
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }