示例#1
0
        public bool DeletePlan(ArrayList arr)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                PlanProduceDAL produceDAL = new PlanProduceDAL();
                PlanPurchaseDAL purchaseDAL = new PlanPurchaseDAL();
                PlanReceiveDAL receiveDAL = new PlanReceiveDAL();
                PlanRemainDAL remainDAL = new PlanRemainDAL();
                PlanSaleDAL saleDAL = new PlanSaleDAL();
                PlanUseDAL useDAL = new PlanUseDAL();
                PlanReceiveItemDAL receiveItemDAL = new PlanReceiveItemDAL();

                for (int i = 0; i < arr.Count; ++i)
                {
                    DALObj.OnDB = false;
                    double plan = Convert.ToDouble(arr[i]);
                    if (DALObj.GetDataByLOID(plan, obj.zTrans))
                    {
                        if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                        {
                            produceDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);
                            purchaseDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);
                            receiveDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);
                            receiveItemDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);
                            remainDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);
                            saleDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);
                            useDAL.DeleteDataByPlan(DALObj.LOID, obj.zTrans);

                            ret = DALObj.DeleteCurrentData(obj.zTrans);
                            if (!ret) throw new ApplicationException(DALObj.ErrorMessage);
                        }

                    }
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }