예제 #1
0
파일: BillFlow.cs 프로젝트: SoftSuite/ABB
 public bool SetInvoiceCode(string userID, double requisition)
 {
     bool ret = true;
     OracleDBObj obj = new OracleDBObj();
     obj.CreateConnection();
     obj.CreateTransaction();
     try
     {
         RequisitionDAL reqDAL = new RequisitionDAL();
         reqDAL.GetDataByLOID(requisition, obj.zTrans);
         if (reqDAL.INVCODE == "")
         {
             reqDAL.INVCODE = OracleDB.GetRunningCode("REQUISITION_INVCODE", reqDAL.REQUISITIONTYPE.ToString(), obj.zTrans);
             ret = reqDAL.UpdateCurrentData(userID, obj.zTrans);
             if (!ret) throw new ApplicationException(reqDAL.ErrorMessage);
         }
         obj.zTrans.Commit();
         obj.CloseConnection();
     }
     catch (Exception ex)
     {
         obj.zTrans.Rollback();
         obj.CloseConnection();
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
예제 #2
0
        public bool SubmitReturnRequisition(ArrayList arrData, string userID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                for (int i = 0; i < arrData.Count; ++i)
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans);
                    if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                    {
                        DALObj.STATUS = Constz.Requisition.Status.Approved.Code;
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                        ret = DALObj.CutStockRequisition(Convert.ToDouble(arrData[i]), userID, 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;
        }
예제 #3
0
파일: BomFlow.cs 프로젝트: SoftSuite/ABB
        public bool DeleteBomData(ArrayList arr)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateTransaction();
            try
            {
                for (int i = 0; i < arr.Count; ++i)
                {
                    double product = Convert.ToDouble(arr[i]);
                    if (BarcodeDAL.GetDataByLOID(product, obj.zTrans))
                    {
                        ret = BomItem.DeleteDataByMainProduct(product, obj.zTrans);
                        if (!ret) throw new ApplicationException(BomItem.ErrorMessage);

                        if (ProcessItem.GetDataList("WHERE PRODUCT = " + BarcodeDAL.PRODUCTMASTER.ToString(), obj.zTrans).Rows.Count == 1)
                        {
                            ret = ProcessItem.DeleteDataByProduct(BarcodeDAL.PRODUCTMASTER, obj.zTrans);
                            if (!ret) throw new ApplicationException(ProcessItem.ErrorMessage);
                        }
                    }
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                ret = false;
                obj.zTrans.Rollback();
                obj.CloseConnection();
            }
            return ret;
        }
예제 #4
0
        public bool DeleteData(ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj objDB = new OracleDBObj();

            objDB.CreateConnection();
            objDB.CreateTransaction();

            try
            {
                foreach (double LOID in arrLOID)
                {
                    SupplierDAL oDAL = new SupplierDAL();
                    oDAL.GetDataByLOID(LOID, objDB.zTrans);
                    oDAL.DeleteCurrentData(objDB.zTrans);
                }
                objDB.zTrans.Commit();
                ret = true;
            }
            catch (Exception ex)
            {
                objDB.zTrans.Rollback();
                _error = ex.Message;
                ret = false;
            }

            objDB.CloseConnection();
            return ret;
        }
예제 #5
0
        public bool DeleteStockIn_StockInitemData(string userID, ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj DBObj = new OracleDBObj();
            DBObj.CreateConnection();
            DBObj.CreateTransaction();

            try
            {
                foreach (string loid in arrLOID)
                {

                    string sqlStockInItem = "DELETE FROM STOCKINITEM WHERE STOCKIN = " + loid;
                    OracleDB.ExecNonQueryCmd(sqlStockInItem, DBObj.zTrans);

                    string sqlStockIn = "DELETE FROM STOCKIN  WHERE LOID = " + loid;
                    OracleDB.ExecNonQueryCmd(sqlStockIn, DBObj.zTrans);
                }
                ret = true;
                DBObj.zTrans.Commit();
            }
            catch (Exception ex)
            {
                ret = false;
                DBObj.zTrans.Rollback();
                _error = ex.Message;
            }

            DBObj.CloseConnection();
            return ret;
        }
예제 #6
0
        public bool UpdateStockInData(string userID, ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj DBObj = new OracleDBObj();
            DBObj.CreateConnection();
            DBObj.CreateTransaction();

            try
            {
                foreach (string loid in arrLOID)
                {
                    string sqlStockIn = "UPDATE STOCKIN SET STATUS = 'AP', APPROVEDATE = TO_DATE(SYSDATE,'DD/MM/YYYY') "; 
                           sqlStockIn += " WHERE LOID = " + loid;
                    OracleDB.ExecNonQueryCmd(sqlStockIn, DBObj.zTrans);

                    string sqlStockInItem = "UPDATE STOCKINITEM SET STATUS = 'AP' WHERE STOCKIN = " + loid;
                    OracleDB.ExecNonQueryCmd(sqlStockInItem, DBObj.zTrans);
                }
                ret = true;
                DBObj.zTrans.Commit();
            }
            catch (Exception ex)
            {
                ret = false;
                DBObj.zTrans.Rollback();
                _error = ex.Message;
            }

            DBObj.CloseConnection();
            return ret;
        }
예제 #7
0
        public bool UpdateData(string userID, DivisionData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    SearchDAL.GetDataByLOID(data.LOID, obj.zTrans);
                    SearchDAL.LOID = data.LOID;
                    SearchDAL.TNAME = data.TNAME.Trim();
                    SearchDAL.CODE = data.CODE.Trim();
                    SearchDAL.EFDATE = data.EFDATE;
                    SearchDAL.EPDATE = data.EPDATE;
                    SearchDAL.ABBNAME = data.ABBNAME;
                    SearchDAL.DEPARTMENT = data.DEPARTMENT;

                    if (SearchDAL.OnDB)
                        ret = SearchDAL.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = SearchDAL.InsertCurrentData(userID, obj.zTrans);

                    _LOID = SearchDAL.LOID;

                    if (ret)
                    {
                        obj.zTrans.Commit();
                        obj.CloseConnection();
                    }
                    else
                    {
                        _error = SearchDAL.ErrorMessage;
                    }
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    throw new ApplicationException(ex.Message);
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #8
0
        public bool CancelPlan(string userID, double plan)
        {
            bool ret = true;

            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                PlanProduceDAL produceDAL = new PlanProduceDAL();
                PlanPurchaseDAL purchaseDAL = new PlanPurchaseDAL();
                PlanReceiveDAL receiveDAL = new PlanReceiveDAL();
                PlanReceiveItemDAL receiveItemDAL = new PlanReceiveItemDAL();
                PlanRemainDAL remainDAL = new PlanRemainDAL();
                PlanSaleDAL saleDAL = new PlanSaleDAL();
                PlanUseDAL useDAL = new PlanUseDAL();

                DALObj.OnDB = false;
                DALObj.GetDataByLOID(plan, obj.zTrans);
                if (DALObj.STATUS == Constz.Requisition.Status.Approved.Code)
                {
                    DALObj.STATUS = Constz.Requisition.Status.Void.Code;
                    DALObj.ACTIVE = Constz.ActiveStatus.InActive;
                    ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    produceDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                    purchaseDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                    receiveDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                    receiveItemDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                    remainDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                    saleDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                    useDAL.UpdateStatusByPlan(plan, DALObj.STATUS, userID, obj.zTrans);
                }

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
예제 #9
0
        public bool UpdateData(string userID, CustomerTypeSearchData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.LOID = data.LOID;
                    DALObj.NAME = data.NAME.Trim();
                    DALObj.DESCRIPTION = data.DESCRIPTION.Trim();
                    DALObj.ACTIVE = data.ACTIVE.Trim();
                    DALObj.CODE = data.CODE.Trim();
                    DALObj.DISCOUNT = data.DISCOUNT;
                    DALObj.LOWERPRICE = data.LOWERPRICE;

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    if (ret)
                    {
                        obj.zTrans.Commit();
                        obj.CloseConnection();
                    }
                    else
                    {
                        _error= DALObj.ErrorMessage;
                    }
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    throw new ApplicationException(ex.Message);
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #10
0
        public bool UpdateData(string userID, CreditCardData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.CODE = data.CODE.Trim();
                    DALObj.NAME = data.NAME.Trim();
                    DALObj.CHARGE = data.CHARGE;
                    DALObj.ACTIVE = Constz.ActiveStatus.Active;

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    _LOID = DALObj.LOID;

                    if (ret)
                    {
                        obj.zTrans.Commit();
                        obj.CloseConnection();
                    }
                    else
                    {
                        _error = DALObj.ErrorMessage;
                    }
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    throw new ApplicationException(ex.Message);
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #11
0
        public bool UpdateData(string userID,StockinProductData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.LOID = data.LOID;
                    DALObj.PRODUCT = data.PRODUCT;
                    DALObj.UNIT = data.UNIT;
                    DALObj.LOID = data.PDPRODUCT;
                    DALObj.LOTNO = data.LOTNO.Trim();
                    DALObj.PRODUCTNAME = data.PRODUCTNAME.Trim();

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    if (ret)
                    {
                        obj.zTrans.Commit();
                        obj.CloseConnection();
                    }
                    else
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else ret = false;
            return ret;
        }
예제 #12
0
        public bool UpdateData(string userID, PurchaseOrderData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.CODE = data.CODE;
                    DALObj.SENDPODATE = data.SENDPODATE;
                    DALObj.SENDPO = data.SENDPO;
                    DALObj.SENDOTHER = data.SENDOTHER;
                    DALObj.REFSUPPCODE = data.REFSUPPCODE;

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    _LOID = DALObj.LOID;
                    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;
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #13
0
        public bool DeleteData(ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj objDB = new OracleDBObj();

            objDB.CreateConnection();
            objDB.CreateTransaction();

            try
            {
                foreach (double LOID in arrLOID)
                {

                    string sqlPackage = "DELETE FROM PACKAGE WHERE MAINPRODUCT = " + LOID.ToString();
                    ret = (OracleDB.ExecNonQueryCmd(sqlPackage, objDB.zTrans) > 0);
                    if (!ret) _error = OracleDB.Err_NoDelete;
                    //else _OnDB = false;

                    string sqlProduct = "DELETE FROM PRODUCT WHERE LOID = " + LOID.ToString();
                    ret = (OracleDB.ExecNonQueryCmd(sqlProduct, objDB.zTrans) > 0);
                    if (!ret) _error = OracleDB.Err_NoDelete;
                   // else _OnDB = false;
                }
                objDB.zTrans.Commit();
                ret = true;
            }
            catch (OracleException ex)
            {
                ret = false;
                _error = OracleDB.GetOracleExceptionText(ex);
            }
            catch (Exception ex)
            {
                objDB.zTrans.Rollback();
                _error = ex.Message;
                ret = false;
            }

            objDB.CloseConnection();
            return ret;
        }
예제 #14
0
        public bool InsertData(string userID, ProductMonthData data)
        {
            bool ret = true;

            DALObj.PRODUCT = DALObj.doGetProduct(data.CODE);
            DALObj.M1 = data.Month[0];
            DALObj.M2 = data.Month[1];
            DALObj.M3 = data.Month[2];
            DALObj.M4 = data.Month[3];
            DALObj.M5 = data.Month[4];
            DALObj.M6 = data.Month[5];
            DALObj.M7 = data.Month[6];
            DALObj.M8 = data.Month[7];
            DALObj.M9 = data.Month[8];
            DALObj.M10 = data.Month[9];
            DALObj.M11 = data.Month[10];
            DALObj.M12 = data.Month[11];
         
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                ret = DALObj.InsertCurrentData(userID, obj.zTrans);
                if (!ret)
                {
                    throw new ApplicationException(DALObj.ErrorMessage);
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                throw new ApplicationException(ex.Message);
            }
            return ret;
        }
예제 #15
0
        public bool CommitData(ArrayList arrData, double Approver, string userID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateTransaction();
            try
            {
                for (int i = 0; i < arrData.Count; ++i)
                {
                    double loid = Convert.ToDouble(arrData[i]);
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(loid, obj.zTrans);
                    if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                    {
                        if (DALItemObj.GetDataList("WHERE STOCKIN = " + loid.ToString(), obj.zTrans).Rows.Count <= 0) throw new ApplicationException("ÃÒ¡ÒÃàÅ¢·Õè " + DALObj.CODE + " äÁèä´éÃкØÃÒ¡ÒÃÊÔ¹¤éÒ");
                        DALObj.APPROVEDATE = DateTime.Today;
                        DALObj.APPROVER = Approver;
                        DALObj.STATUS = Constz.Requisition.Status.Approved.Code;
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(DALObj.ErrorMessage);
                        ret = DALItemObj.UpdateStatusByStockIn(loid, DALObj.STATUS, userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                        //ret = DALObj.CutStock(loid, userID, obj.zTrans);
                        ret = DALObj.CutStock(loid, userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(DALObj.ErrorMessage);
                    }
                }
                if (obj.zTrans != null) obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                ret = false;
                _error = ex.Message;
                if (obj.zTrans != null) obj.zTrans.Rollback();
                obj.CloseConnection();
            }
            return ret;
        }
예제 #16
0
        public bool UploadData(DateTime dateFrom)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateSeverConnection();
            obj.CreateTransaction();
            try
            {
                OracleDB.ExecNonQueryCmd("CALL SP_IMPORT_EXPORT(" + OracleDB.QRDate(dateFrom) + ")", obj.zTrans);

                obj.zTrans.Commit();
                obj.zConn.Close();
            }
            catch (Exception ex)
            {
                ret = false;
                _error = ex.Message;
                obj.zTrans.Rollback();
                obj.zConn.Close();
            }
            return ret;
        }
예제 #17
0
파일: TitleFlow.cs 프로젝트: SoftSuite/ABB
        public bool UpdateData(string userID, TitleData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.NAME = data.NAME.Trim();
                    DALObj.ACTIVE = data.ACTIVE.Trim();
                    DALObj.CODE = data.CODE.Trim();

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, 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;
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #18
0
        public bool UpdateStockInStatus(double loid, string status, string userID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(loid, obj.zTrans);
                DALObj.STATUS = status;
                ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                ret = DALItemObj.UpdateStatusByStockIn(DALObj.LOID, DALObj.STATUS, userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                ret = DALObj.CutStock(loid, userID, 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;
        }
예제 #19
0
 public bool DeleteData(ArrayList arrData)
 {
     bool ret = true;
     OracleDBObj obj = new OracleDBObj();
     obj.CreateConnection();
     obj.CreateTransaction();
     try
     {
         StockInItemDAL itemDAL = new StockInItemDAL();
         for (int i = 0; i < arrData.Count; i++)
         {
             DALObj.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans);
             itemDAL.DeleteDataByStockIn(Convert.ToDouble(arrData[i]), 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;
 }
예제 #20
0
        public bool UpdateData(string userID, StockInFGData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    UpdateData(userID, data, obj.zTrans);

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #21
0
        public bool CommitQCData(string userID, StockInFGData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    data.QCCODE = OracleDB.GetRunningCode("STOCKIN_QC", data.DOCTYPE.ToString());
                    data.QCDATE = DateTime.Now.Date;
                    UpdateData(userID, data, obj.zTrans);

                    ret = DALObj.CutStock(_LOID, userID, 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;
                }
            }
            else
                ret = false;
            return ret;
        }
예제 #22
0
파일: SaleFlow.cs 프로젝트: SoftSuite/ABB
        public bool GetCustomerDiscount(double customer, double totalPrice)
        {
            bool ret = true;
            _DISCOUNT = 0;
            
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                CustomerDAL cDAL = new CustomerDAL();
                cDAL.GetDataByLOID(customer, obj.zTrans);
                if (cDAL.OnDB)
                {
                    if (cDAL.EFDATE.Date <= DateTime.Today && DateTime.Today <= cDAL.EPDATE.Date)
                        _DISCOUNT = DALObj.GetMemberDiscount(cDAL.MEMBERTYPE, totalPrice, obj.zTrans);
                }

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
예제 #23
0
        public bool UpdateStockCheckStatus(string batchno, string status, string userID ,ArrayList arr)
        {
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            bool ret = true;

            try
            {
                string sql = "UPDATE STOCKCHECK SET STATUS = '" + status + "', ";
                sql += "UPDATEBY = '" + userID + "', ";
                sql += "UPDATEON = " + OracleDB.QRDateTime() + " ";
                sql += "WHERE BATCHNO='" + batchno + "'";

                ret = (OracleDB.ExecNonQueryCmd(sql, obj.zTrans) > 0);
                if (!ret)
                {
                    throw new ApplicationException(OracleDB.Err_NoExistUpdate);
                }

                StockCheckImproveDAL itemDAL = new StockCheckImproveDAL();

                for (Int16 i = 0; i < arr.Count; i++)
                {
                    itemDAL.OnDB = false;
                    StockCheckImproveData item = (StockCheckImproveData)arr[i];
                    double ans = item.SYSQTY + item.IMPROVEQTY;
                    itemDAL.STOCKCHECK = item.STOCKCHECK;
                    itemDAL.PRODUCTSTOCK = item.PRODUCTSTOCK;
                    itemDAL.SYSQTY = item.SYSQTY;
                    itemDAL.IMPROVEQTY = ans;
                    itemDAL.REASON = item.REASON;

                    ret = itemDAL.InsertCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);

                    sql = "UPDATE PRODUCTSTOCK SET QTY = '" + ans.ToString() + "', ";
                    sql += "UPDATEBY = '" + userID + "', ";
                    sql += "UPDATEON = " + OracleDB.QRDateTime() + " ";
                    sql += "WHERE LOID='" + item.PRODUCTSTOCK.ToString() + "'";

                    ret = (OracleDB.ExecNonQueryCmd(sql, obj.zTrans) > 0);
                    if (!ret)
                    {
                        throw new ApplicationException(OracleDB.Err_NoExistUpdate);
                    }
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }

            return ret;
        }
예제 #24
0
파일: BasketFlow.cs 프로젝트: SoftSuite/ABB
        private bool UpdatePackage(string UserID, DataTable tempTable, double ProductBarcodeLOID)
        {
            bool ret = true;
            OracleDBObj objDB = new OracleDBObj();

            objDB.CreateConnection();
            objDB.CreateTransaction();
            
            string sqlDelete = "DELETE FROM PACKAGE WHERE MAINPRODUCT = " + ProductBarcodeLOID;
            OracleDB.ExecNonQueryCmd(sqlDelete, objDB.zTrans);

            for (int i = 0; i < tempTable.Rows.Count; i++)
            {
                PackageDAL pkDAL = new PackageDAL();
                pkDAL.MAINPRODUCT = ProductBarcodeLOID;
                pkDAL.SUBPRODUCT = Convert.ToDouble(tempTable.Rows[i]["LOID"]);
                pkDAL.QTY = Convert.ToDouble(tempTable.Rows[i]["QUANTITY"]);
                pkDAL.PRICE = Convert.ToDouble(tempTable.Rows[i]["PRICE"]);
                pkDAL.UNIT = Convert.ToDouble(tempTable.Rows[i]["PUNIT"]);

                ret = pkDAL.InsertCurrentData(UserID, objDB.zTrans);
                if (ret == false)
                {
                    _error = pkDAL.ErrorMessage;
                    break;
                }
            }

            if (ret == false)
            {
                objDB.zTrans.Rollback();
                objDB.CloseConnection();
                return ret;
            }
            else
            {
                objDB.zTrans.Commit();
                objDB.CloseConnection();
                return ret;
            }
        }
예제 #25
0
        public bool UpdateStockinReturnStatus(ArrayList arrData, string userID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                for (int i = 0; i < arrData.Count; i++)
                {
                    if (GetItem(Convert.ToDouble(arrData[i])).Rows.Count == 0)
                    {
                        throw new ApplicationException("äÁèÊÒÁÒö͹ØÁѵÔÃÒ¡ÒÃä´é à¹×èͧ¨Ò¡ºÒ§ÃÒ¡ÒÃäÁèä´éÃкØÊÔ¹¤éÒ");
                    }
                    StockinReturnData data = GetData(Convert.ToDouble(arrData[i]));

                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans);
                    if (DALObj.STATUS == Constz.StockinReturn.Status.Waiting.Code)
                    {
                        DALObj.STATUS = Constz.StockinReturn.Status.Approved.Code;
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                        StockInDAL sDAL = new StockInDAL();
                        ret = sDAL.CutStock(DALObj.LOID, userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(sDAL.ErrorMessage);
                    }
                    StockInItemDAL itemDAL = new StockInItemDAL();
                    ret = itemDAL.UpdateStatusByStockIn(Convert.ToDouble(arrData[i]), Constz.StockinReturn.Status.Approved.Code, userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
예제 #26
0
        public bool UpdateQty(double loid, double poloid, double pdloid, double qty, string userID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                UpdateQty(loid, poloid, pdloid, qty, userID, obj.zTrans);

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
예제 #27
0
        public bool UpdateStockInFNStatus(ArrayList arrData, string status, string userID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                for (int i = 0; i < arrData.Count; i++)
                {
                    if (status == Constz.Requisition.Status.Finish.Code)
                    {
                        if (GetStockInItem(Convert.ToDouble(arrData[i])).Rows.Count == 0)
                        {
                            throw new ApplicationException("äÁèÊÒÁÒö͹ØÁѵÔÃÒ¡ÒÃä´é à¹×èͧ¨Ò¡ºÒ§ÃÒ¡ÒÃäÁèä´éÃкØÊÔ¹¤éÒ");
                        }
                    }
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans);
                    DALObj.STATUS = Constz.Requisition.Status.Finish.Code;
                    ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    ret = DALObj.CutStock(Convert.ToDouble(arrData[i]), userID, 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;
        }
예제 #28
0
        public bool DeleteStockCheckItem(double loid)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALItemObj.GetDataByLOID(loid, obj.zTrans);
                ret = DALItemObj.DeleteCurrentData(obj.zTrans);
                if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
예제 #29
0
        public bool InsertNewBatchNo(string userID, StockCheckData data)
        {
            bool ret = true;
            StockCheckDAL itemDAL = new StockCheckDAL();
            OracleDBObj obj = new OracleDBObj();
            obj.CreateTransaction();
            try
            {
                itemDAL.BATCHNO = GenNewBatchNo(data.WAREHOUSE, obj.zTrans);
                itemDAL.CHECKDATE = DateTime.Now;
                itemDAL.WAREHOUSE = data.WAREHOUSE;
                itemDAL.STATUS = Constz.Requisition.Status.Waiting.Code;

                ret = itemDAL.InsertCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                _LOID = itemDAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                ret = false;
                obj.zTrans.Rollback();
                obj.CloseConnection();
            }
            return ret;
        }
예제 #30
0
        public bool insertStockCheckItem(string userID, StockCheckItemData data)
        {
            bool ret = true;
            if (VerifyData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALItemObj.OnDB = false;
                    DALItemObj.COUNTQTY = data.COUNTQTY;
                    DALItemObj.LOTNO = data.LOTNO;
                    DALItemObj.PRODUCT = data.PRODUCT;
                    DALItemObj.STOCKCHECK = data.STOCKCHECK;
                    DALItemObj.LOCATION = data.LOCATION;

                    ret = DALItemObj.InsertCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

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