Exemple #1
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;
        }
Exemple #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;
        }
Exemple #3
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;
        }
Exemple #4
0
 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;
 }
        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;
        }
Exemple #6
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;
        }
Exemple #7
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;
        }
Exemple #8
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;
        }
Exemple #9
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;
        }
Exemple #10
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;
        }
        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;
        }
Exemple #12
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;
        }
Exemple #13
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;
        }
Exemple #14
0
        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;
        }
Exemple #15
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;
        }
Exemple #16
0
        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;
        }
Exemple #17
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;
        }
Exemple #18
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;
        }
Exemple #19
0
        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;
            }
        }
Exemple #20
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;
        }
Exemple #21
0
        public bool CommitData(string userID, StockinReturnData data)
        {
            bool ret = true;
            bool cutstock = true;
            bool custockinreturnlost = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    cutstock = (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code);
                    custockinreturnlost = cutstock;
                    UpdateData(userID, data, obj.zTrans);
                    if (cutstock)
                    {
                        StockInDAL sDAL = new StockInDAL();
                        ret = sDAL.CutStock(DALObj.LOID, userID, obj.zTrans);
                        if (!ret) _error = sDAL.ErrorMessage;
                    }

                    if (custockinreturnlost)
                    {
                        StockInDAL sDAL = new StockInDAL();
                        ret = sDAL.CutStockInReturnLost(DALObj.LOID, userID, obj.zTrans);
                        if (!ret) _error = sDAL.ErrorMessage;
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
Exemple #22
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;
        }
Exemple #23
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;
        }
Exemple #24
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;
        }
Exemple #25
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;
 }
Exemple #26
0
        //public bool CopyPDRequest(string userID, double loidSource)
        //{
        //    PDReserveData data = GetData(loidSource);
        //    DataTable itemList = GetPDItem(data.LOID);
        //    ArrayList arr = new ArrayList();
        //    foreach (DataRow dRow in itemList.Rows)
        //    {
        //        PDReserveItemData idata = new PDReserveItemData();
        //        idata.MASTER = Convert.ToDouble(dRow["MASTER"]);
        //        idata.ACTIVE = Constz.ActiveStatus.Active;
        //        arr.Add(idata);
        //    }
        //    data.ITEM = arr;
        //    DALObj.OnDB = false;
        //    data.LOID = 0;
        //    data.CODE = "";
        //    data.STATUS = Constz.Requisition.Status.Waiting.Code;
        //    //data.ACTIVE = Constz.ActiveStatus.Active;
        //    //data.ORDERTYPE = Constz.OrderType.PO.Code;
        //    return UpdateData(userID, data);
        //}

        public bool CommitData(string userID, ReturnRequestData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    UpdateData(userID, data);

                    ret = DALObj.CutStockRequisition(_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;
        }
Exemple #27
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;
        }
Exemple #28
0
         public bool UpdateData(string userID, QCAnalysisData data)
         {

             // ####### UPDATE REQUISITION
             bool ret = true;
             if (ValidateData(data))
             {
                 OracleDBObj obj = new OracleDBObj();
                 obj.CreateConnection();
                 obj.CreateTransaction();

                 if (data.STLOID != 0)
                 {
                     // update old requisition
                     DALObj.GetDataByLOID(data.STLOID, obj.zTrans);
                 }
                 else
                 {
                     DALObj.STLOID = data.STLOID;
                 }

                 try
                 {
                     DALObj.OnDB = false;
                     DALObj.GetDataByLOID(data.STLOID, obj.zTrans);

                     //DALObj.CODE = data.CODE;
                     //DALObj.REQDATE = data.REQDATE;
                     //DALObj.REMARK = data.REMARK;


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

                     _STLOID = DALObj.STLOID;
                     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;
         }
Exemple #29
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;
        }
Exemple #30
0
         public bool SubmitQCStockIn(ArrayList arrData, string userID)
         {
             bool ret = true;
             OracleDBObj obj = new OracleDBObj();
             obj.CreateConnection();
             obj.CreateTransaction();
             try
             {
                 for (int i =0; i<arrData.Count; ++i)
                 {
                     string[] str = arrData[i].ToString().Split('#');
                     if (str[1] == "STOCKIN")
                     {
                         StDAL.OnDB = false;
                         StDAL.GetDataByLOID(Convert.ToDouble(str[0]), obj.zTrans);
                         StockInItemDAL _itemDAL = new StockInItemDAL();
                         if (_itemDAL.GetDataList("WHERE STOCKIN = " + StDAL.LOID.ToString() + " AND QCRESULT NOT IN ('" + Constz.QCResult.Fail.Code + "', '" + Constz.QCResult.Pass.Code + "') ", obj.zTrans).Rows.Count == 0)
                             throw new ApplicationException("ÃкؼšÒõÃǨÊͺÃÒ¡ÒÃàÅ¢·Õè " + StDAL.CODE + " ãËé¤Ãº·Ø¡ÃÒ¡ÒÃ");
                         if (StDAL.STATUS == Constz.Requisition.Status.QC.Code)
                         {
                             StDAL.STATUS = Constz.Requisition.Status.Approved.Code;
                             ret = StDAL.UpdateCurrentData(userID, obj.zTrans);
                             if (!ret) throw new ApplicationException(StDAL.ErrorMessage);
                         }
                     }
                     else
                     {
                         PoDAl.OnDB = false;
                         PoDAl.GetDataByLOID(Convert.ToDouble(str[0]), obj.zTrans);
                         PDProductDAL _itemDAL = new PDProductDAL();
                         if (_itemDAL.GetDataList("WHERE PDPRODUCT = " + PoDAl.LOID.ToString() + " AND QCRESULT NOT IN ('" + Constz.QCResult.Fail.Code + "', '" + Constz.QCResult.Pass.Code + "') ", obj.zTrans).Rows.Count == 0)
                             throw new ApplicationException("ÃкؼšÒõÃǨÊͺÃÒ¡ÒÃàÅ¢·Õè " + PoDAl.CODE + " ãËé¤Ãº·Ø¡ÃÒ¡ÒÃ");
                         if (PoDAl.STATUS == Constz.Requisition.Status.QC.Code)
                         {
                             PoDAl.STATUS = Constz.Requisition.Status.Approved.Code;
                             ret = PoDAl.UpdateCurrentData(userID, obj.zTrans);
                             if (!ret) throw new ApplicationException(PoDAl.ErrorMessage);

                             ret = PoDAl.CutStock(Convert.ToDouble(str[0]), userID, obj.zTrans);
                             if (!ret) throw new ApplicationException(PoDAl.ErrorMessage);
                         }
                     }
                 }
                 obj.zTrans.Commit();
                 obj.CloseConnection();
             }
             catch (Exception ex)
             {
                 obj.zTrans.Rollback();
                 obj.CloseConnection();
                 ret = false;
                 _error = ex.Message;
             }
             return ret;
         }