Exemple #1
0
        private void CommitPlan(string userID, double plan, OracleTransaction trans)
        {
            bool ret = true;
            DALObj.OnDB = false;
            DALObj.GetDataByLOID(plan, trans);
            if (DALItemObj.GetDataByPlan(plan, trans).Rows.Count == 0)
                throw new ApplicationException("¡ÃسÒÃкØÃÒÂÅÐàÍÕ´Ἱ¡ÒüÅÔµ»Õ " + DALObj.YEAR);
            else if (SaleDAL.HasUnplanedProduct(plan, trans))
                throw new ApplicationException("ÊÔ¹¤éÒºÒ§ÃÒ¡ÒÃäÁèä´é»ÃÐÁÒ³¡ÒèÓ˹èÒÂ");
            else
            {

                PlanOrderSaleDAL orderSaleDAL = new PlanOrderSaleDAL();
                if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                {
                    DALObj.STATUS = Constz.Requisition.Status.Approved.Code;
                    DALObj.ACTIVE = Constz.ActiveStatus.Active;
                    DALObj.CONFIRMDATE = DateTime.Today;
                    ret = DALObj.UpdateCurrentData(userID, trans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    ret = DALItemObj.UpdateStatusByPlan(plan, DALObj.STATUS, userID, trans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    ret = orderSaleDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, trans);
                    if (!ret) throw new ApplicationException(orderSaleDAL.ErrorMessage);
                }
            }
        }
Exemple #2
0
        public bool DeletePlanOrder(ArrayList arr)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                PlanOrderSaleDAL sDAL = new PlanOrderSaleDAL();
                for (int i = 0; i < arr.Count; ++i)
                {
                    DALItemObj.OnDB = false;
                    double planOrder = Convert.ToDouble(arr[i]);
                    if (DALItemObj.GetDataByLOID(planOrder, obj.zTrans))
                    {
                        if (DALItemObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                            ret = DALItemObj.DeleteCurrentData(obj.zTrans);

                        if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                        sDAL.DeleteDataByPlanAndProduct(DALItemObj.PLAN, DALItemObj.PRODUCT, obj.zTrans);
                    }
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
Exemple #3
0
        public bool CancelPlan(string userID, double plan)
        {
            bool ret = true;

            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                PlanOrderSaleDAL orderSaleDAL = new PlanOrderSaleDAL();
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(plan, obj.zTrans);
                if (DALObj.STATUS == Constz.Requisition.Status.Approved.Code)
                {
                    DALObj.CancelPlanSale(userID, DALObj.LOID, 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;
        }