예제 #1
0
        private bool NewRequisition(string UserID, ToDoListMinimumStockRequestData data)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL _DAL = new RequisitionDAL();
                _DAL.OnDB = false;
                _DAL.OFFICER = data.REQUESTBY;
                _DAL.REQDATE = DateTime.Now.Date;
                _DAL.ACTIVE = data.ACTIVE;
                _DAL.STATUS = data.STATUS;
                _DAL.WAREHOUSE = data.WAREHOUSE;
                _DAL.REQUISITIONTYPE = data.REQUISITIONTYPE;
                _DAL.RESERVEDATE = DateTime.Now.Date;

                ret = _DAL.InsertCurrentData(UserID, obj.zTrans);
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                RequisitionItemDAL _DALItem = new RequisitionItemDAL();
                for (int i = 0; i < data.ITEM.Count; ++i)
                {
                    _DALItem.OnDB = false;
                    ToDoListMinimumStockRequestItemData itemData = (ToDoListMinimumStockRequestItemData)data.ITEM[i];
                    _DALItem.ACTIVE = data.ACTIVE;
                    _DALItem.PRODUCT = itemData.PRODUCT;
                    _DALItem.QTY = itemData.QTY;
                    _DALItem.REQUISITION = _DAL.LOID;
                    _DALItem.UNIT = itemData.UNIT;
                    _DALItem.DUEDATE = DateTime.Now.Date;
                    ret = _DALItem.InsertCurrentData(UserID, obj.zTrans);
                    if (!ret)
                    {
                        throw new ApplicationException(_DALItem.ErrorMessage);
                    }
                }

                _LOID = _DAL.LOID;

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

            return ret;

        }
예제 #2
0
        private void UpdateData(string userID, ProductOrderData data, System.Data.OracleClient.OracleTransaction zTrans)
        {
            bool ret = true;
            DALObj.GetDataByLOID(data.LOID, zTrans);

            DALObj.ACTIVE = data.ACTIVE;
            DALObj.CODE = data.CODE;
            DALObj.REMARK = data.REMARK;
            DALObj.REQDATE = data.REQDATE;
            DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE;
            DALObj.STATUS = data.STATUS;
            DALObj.WAREHOUSE = data.WAREHOUSE;

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

            _LOID = DALObj.LOID;
            if (!ret)
            {
                throw new ApplicationException(DALObj.ErrorMessage);
            }

            RequisitionItemDAL itemDAL = new RequisitionItemDAL();
            itemDAL.DeleteDataByRequisition(data.LOID, zTrans);
            for (Int16 i = 0; i < data.ITEM.Count; ++i)
            {
                RequisitionItemData item = (RequisitionItemData)data.ITEM[i];
                itemDAL.ACTIVE = item.ACTIVE;
                itemDAL.DISCOUNT = item.DISCOUNT;
                itemDAL.DUEDATE = item.DUEDATE;
                itemDAL.NETPRICE = item.NETPRICE;
                itemDAL.PRODUCT = item.PRODUCT;
                itemDAL.QTY = item.QTY;
                itemDAL.PRICE = item.PRICE;
                itemDAL.REQUISITION = DALObj.LOID;
                itemDAL.UNIT = item.UNIT;
                //itemDAL.DUEDATE = data.DUEDATE;

                itemDAL.OnDB = false;
                ret = itemDAL.InsertCurrentData(userID, zTrans);
                if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
            }
        }
예제 #3
0
        private void UpdateData(string userID, RequisitionData data, OracleTransaction trans)
        {
            bool ret = true;
            DALObj.REQUISITIONTYPE = Constz.Requisition.RequisitionType.REQ04;
            DALObj.ACTIVE = data.ACTIVE;
            DALObj.CUSTOMER = data.CUSTOMER;
            DALObj.GRANDTOT = data.GRANDTOT;
            DALObj.STATUS = data.STATUS;
            DALObj.TOTAL = data.TOTAL;
            DALObj.TOTDIS = data.TOTDIS;
            DALObj.TOTVAT = data.TOTVAT;
            DALObj.VAT = data.VAT;
            DALObj.WAREHOUSE = data.WAREHOUSE;
            DALObj.RESERVEDATE = data.RESERVEDATE;
            DALObj.REMARK = data.REMARK;
            DALObj.REASON = data.REASON;

            if (DALObj.OnDB)
                ret = DALObj.UpdateCurrentData(userID, trans);
            else
            {
                DALObj.REQDATE = data.RESERVEDATE;
                ret = DALObj.InsertCurrentData(userID, trans);
            }

            if (!ret)
            {
                throw new ApplicationException(DALObj.ErrorMessage);
            }

            RequisitionItemDAL itemDAL = new RequisitionItemDAL();
            itemDAL.DeleteDataByRequisition(data.LOID, trans);
            for (Int16 i = 0; i < data.REQUISITIONITEM.Count; ++i)
            {
                RequisitionItemData item = (RequisitionItemData)data.REQUISITIONITEM[i];
                itemDAL.ACTIVE = item.ACTIVE;
                itemDAL.DISCOUNT = item.DISCOUNT;
                itemDAL.DUEDATE = item.DUEDATE;
                itemDAL.NETPRICE = item.NETPRICE;
                itemDAL.PRODUCT = item.PRODUCT;
                itemDAL.QTY = item.QTY;
                itemDAL.PRICE = item.PRICE;
                itemDAL.REQUISITION = DALObj.LOID;
                itemDAL.UNIT = item.UNIT;
                itemDAL.ISVAT = item.ISVAT;

                itemDAL.OnDB = false;
                ret = itemDAL.InsertCurrentData(userID, trans);
                if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
            }
        }
예제 #4
0
        public bool UpdateData(string userID, PointOfSaleData data, bool setInvoice)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    _dal = new RequisitionDAL();
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.REQUISITIONTYPE = Constz.Requisition.RequisitionType.REQ13;
                    DALObj.ACTIVE = data.ACTIVE;
                    DALObj.CASH = data.CASH;
                    DALObj.COUPON = data.COUPON;
                    DALObj.CREDITCARDID = data.CREDITCARDID;
                    DALObj.CREDITCARDPAY = data.CREDITCARDPAY;
                    DALObj.CREDITTYPE = data.CREDITTYPE;
                    DALObj.CUSTOMER = data.CUSTOMER;
                    DALObj.GRANDTOT = data.GRANDTOT;
                    DALObj.REFLOID = data.REFLOID;
                    DALObj.REFNO = data.REFNO;
                    DALObj.REFTABLE = data.REFTABLE;
                    DALObj.STATUS = data.STATUS;
                    DALObj.TOTAL = data.TOTAL;
                    DALObj.TOTDIS = data.TOTDIS;
                    DALObj.TOTVAT = data.TOTVAT;
                    DALObj.VAT = data.VAT;
                    DALObj.WAREHOUSE = data.WAREHOUSE;
                    DALObj.REQDATE = data.REQDATE;
                    if (setInvoice && DALObj.INVCODE != "") DALObj.INVCODE = OracleDB.GetRunningCode("REQUISITION_INVCODE", DALObj.REQUISITIONTYPE.ToString(), obj.zTrans);

                    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);
                    }

                    RequisitionItemDAL itemDAL = new RequisitionItemDAL();
                    itemDAL.DeleteDataByRequisition(data.LOID, obj.zTrans);
                    for (Int16 i = 0; i < data.REQUISITIONITEM.Count; ++i)
                    {
                        RequisitionItemData item = (RequisitionItemData)data.REQUISITIONITEM[i];
                        itemDAL.ACTIVE = item.ACTIVE;
                        itemDAL.DISCOUNT = item.DISCOUNT;
                        itemDAL.DUEDATE = item.DUEDATE;
                        itemDAL.NETPRICE = item.NETPRICE;
                        itemDAL.PRODUCT = item.PRODUCT;
                        itemDAL.QTY = item.QTY;
                        itemDAL.PRICE = item.PRICE;
                        itemDAL.REQUISITION = DALObj.LOID;
                        itemDAL.UNIT = item.UNIT;
                        itemDAL.ISVAT = item.ISVAT;

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

                    ret = DALObj.CutStockRequisition(DALObj.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;
        }
예제 #5
0
        private void UpdateData(string userID, ProductReserveData data, System.Data.OracleClient.OracleTransaction zTrans)
        {
            bool ret = true;
            DALObj.GetDataByLOID(data.LOID, zTrans);

            DALObj.ACTIVE = data.ACTIVE;
            DALObj.CADDRESS = data.CADDRESS;
            DALObj.CEMAIL = data.CEMAIL;
            DALObj.CFAX = data.CFAX;
            DALObj.CLASTNAME = data.CLASTNAME;
            DALObj.CNAME = data.CNAME;
           // DALObj.CODE = data.CODE;
            DALObj.CTEL = data.CTEL;
            DALObj.CTITLE = data.CTITLE;
            DALObj.CUSTOMER = data.CUSTOMER;
            DALObj.DUEDATE = data.DUEDATE;
            DALObj.GRANDTOT = data.GRANDTOT;
            DALObj.REMARK = data.REMARK;
            DALObj.REQDATE = data.REQDATE;
            //DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE;
            DALObj.REFTYPELOID = data.REFTYPELOID;
            DALObj.REFTYPETABLE = data.REFTYPETABLE;
            DALObj.STATUS = data.STATUS;
            DALObj.TOTAL = data.TOTAL;
            DALObj.TOTDIS = data.TOTDIS;
            DALObj.TOTVAT = data.TOTVAT;
            DALObj.VAT = data.VAT;
            DALObj.WAREHOUSE = data.WAREHOUSE;
            DALObj.DELIVERYTYPE = data.CDELIVERY;
            DALObj.OTHER = data.OTHER;
            if (DALObj.INVCODE == "")
                DALObj.INVCODE = DALObj.GetInvCode(1, zTrans);
            DALObj.PAYMENTCONDITION = data.PAYMENTCONDITION;
            DALObj.CREDITDATE = data.CREDITDATE;
            DALObj.RESERVEDATE = data.RESERVEDATE;
            DALObj.OTHER = data.OTHER;
            DALObj.PAYMENT = data.PAYMENT;
            DALObj.CREDITCARDID = data.CREDITCARDID;
            DALObj.CREDITTYPE = data.CREDITTYPE;
            DALObj.BANK = data.BANK;
            DALObj.BANKBRANCH = data.BANKBRANCH;
            DALObj.CHEQUE = data.CHEQUE;
            DALObj.CHEQUEDATE = data.CHEQUEDATE;
            DALObj.REASON = data.REASON;
            DALObj.REFNO = data.REFNO;

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

            _LOID = DALObj.LOID;
            if (!ret)
            {
                throw new ApplicationException(DALObj.ErrorMessage);
            }

            RequisitionItemDAL itemDAL = new RequisitionItemDAL();
            itemDAL.DeleteDataByRequisition(data.LOID, zTrans);
            for (Int16 i = 0; i < data.ITEM.Count; ++i)
            {
                RequisitionItemData item = (RequisitionItemData)data.ITEM[i];
                itemDAL.ACTIVE = item.ACTIVE;
                itemDAL.DISCOUNT = item.DISCOUNT;
                itemDAL.DUEDATE = item.DUEDATE;
                itemDAL.NETPRICE = item.NETPRICE;
                itemDAL.PRODUCT = item.PRODUCT;
                itemDAL.QTY = item.QTY;
                itemDAL.PRICE = item.PRICE;
                itemDAL.REQUISITION = DALObj.LOID;
                itemDAL.UNIT = item.UNIT;
                itemDAL.DUEDATE = data.DUEDATE;

                itemDAL.OnDB = false;
                ret = itemDAL.InsertCurrentData(userID, zTrans);
                if (!ret) throw new ApplicationException(DALObj.ErrorMessage);
            }
        }
예제 #6
0
        private void UpdateData(string userID, ProductReserveData data, System.Data.OracleClient.OracleTransaction trans)
        {
            bool ret = true;

            if (ValidateData(data))
            {
                if (SearchObj.GetDataByRefLOID(data.LOID, data.REFLOID, trans).Rows.Count > 0)
                    throw new ApplicationException("äÁèÊÒÁÒö·ÓÃÒ¡ÒÃä´é à¹×èͧ¨Ò¡ãºàÊÃ稷ÕèàÅ×Í¡ ÍÂÙèÃÐËÇèÒ§´Óà¹Ô¹¡ÒÃŴ˹ÕéËÃ×ÍŴ˹ÕéàÊÃç¨ÊÔé¹áÅéÇ");
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(data.LOID, trans);

                DALObj.CODE = data.CODE;
                DALObj.ACTIVE = data.ACTIVE;
                DALObj.CADDRESS = data.CADDRESS;
                DALObj.CEMAIL = data.CEMAIL;
                DALObj.CFAX = data.CFAX;
                DALObj.CLASTNAME = data.CLASTNAME;
                DALObj.CNAME = data.CNAME;
                DALObj.CTEL = data.CTEL;
                DALObj.CTITLE = data.CTITLE;
                DALObj.CUSTOMER = data.CUSTOMER;
                DALObj.DUEDATE = data.DUEDATE;
                DALObj.GRANDTOT = data.GRANDTOT;
                DALObj.REASON = data.REASON;
                DALObj.REFLOID = data.REFLOID;
                DALObj.REFTABLE = data.REFTABLE;
                DALObj.REMARK = data.REMARK;
                DALObj.RESERVEDATE = data.RESERVEDATE;
                DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE;
                DALObj.STATUS = data.STATUS;
                DALObj.TOTAL = data.TOTAL;
                DALObj.TOTDIS = data.TOTDIS;
                DALObj.TOTVAT = data.TOTVAT;
                DALObj.VAT = data.VAT;
                DALObj.WAREHOUSE = data.WAREHOUSE;
                DALObj.REQDATE = data.REQDATE;
                DALObj.INVCODE = data.INVCODE;

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

                _LOID = DALObj.LOID;
                if (!ret)
                {
                    throw new ApplicationException(DALObj.ErrorMessage);
                }

                RequisitionItemDAL itemDAL = new RequisitionItemDAL();
                itemDAL.DeleteDataByRequisition(data.LOID, trans);
                for (Int16 i = 0; i < data.ITEM.Count; ++i)
                {
                    RequisitionItemData item = (RequisitionItemData)data.ITEM[i];
                    itemDAL.ACTIVE = item.ACTIVE;
                    itemDAL.DISCOUNT = item.DISCOUNT;
                    itemDAL.DUEDATE = item.DUEDATE;
                    itemDAL.NETPRICE = item.NETPRICE;
                    itemDAL.PRODUCT = item.PRODUCT;
                    itemDAL.QTY = item.QTY;
                    itemDAL.PRICE = item.PRICE;
                    itemDAL.REQUISITION = DALObj.LOID;
                    itemDAL.UNIT = item.UNIT;
                    itemDAL.DUEDATE = data.DUEDATE;
                    itemDAL.REFTABLE = item.REFTABLE;
                    itemDAL.REFLOID = item.REFLOID;

                    itemDAL.OnDB = false;
                    ret = itemDAL.InsertCurrentData(userID, trans);
                    if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                }
            }
            else
                throw new ApplicationException(_error);
        }
예제 #7
0
        private void UpdateData(string userID, ProductReserveData data, System.Data.OracleClient.OracleTransaction zTrans)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(data.LOID, zTrans);

                DALObj.ACTIVE = data.ACTIVE;
                DALObj.CADDRESS = data.CADDRESS;
                DALObj.CEMAIL = data.CEMAIL;
                DALObj.CFAX = data.CFAX;
                DALObj.CLASTNAME = data.CLASTNAME;
                DALObj.CNAME = data.CNAME;
                DALObj.CODE = data.CODE;
                DALObj.CTEL = data.CTEL;
                DALObj.CTITLE = data.CTITLE;
                DALObj.CUSTOMER = data.CUSTOMER;
                DALObj.DUEDATE = data.DUEDATE;
                DALObj.GRANDTOT = data.GRANDTOT;
                DALObj.REMARK = data.REMARK;
                DALObj.RESERVEDATE = data.RESERVEDATE;
                DALObj.REQUISITIONTYPE = data.REQUISITIONTYPE;
                DALObj.STATUS = data.STATUS;
                DALObj.TOTAL = data.TOTAL;
                DALObj.TOTDIS = data.TOTDIS;
                DALObj.TOTVAT = data.TOTVAT;
                DALObj.VAT = data.VAT;
                DALObj.WAREHOUSE = data.WAREHOUSE;
                DALObj.REFTYPELOID = data.REQUISITIONTYPE;
                DALObj.REFTYPETABLE = "REQUISITIONTYPE";

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

                _LOID = DALObj.LOID;
                if (!ret)
                {
                    throw new ApplicationException(DALObj.ErrorMessage);
                }

                RequisitionItemDAL itemDAL = new RequisitionItemDAL();
                itemDAL.DeleteDataByRequisition(data.LOID, zTrans);
                for (Int16 i = 0; i < data.ITEM.Count; ++i)
                {
                    RequisitionItemData item = (RequisitionItemData)data.ITEM[i];
                    itemDAL.ACTIVE = item.ACTIVE;
                    itemDAL.DISCOUNT = item.DISCOUNT;
                    itemDAL.DUEDATE = item.DUEDATE;
                    itemDAL.NETPRICE = item.NETPRICE;
                    itemDAL.PRODUCT = item.PRODUCT;
                    itemDAL.QTY = item.QTY;
                    itemDAL.PRICE = item.PRICE;
                    itemDAL.REQUISITION = DALObj.LOID;
                    itemDAL.UNIT = item.UNIT;
                    itemDAL.DUEDATE = data.DUEDATE;
                    itemDAL.ISVAT = item.ISVAT;

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