예제 #1
0
 /// <summary>
 /// createNewOrder: Set some standard defaults
 /// </summary>
 public void createNewOrder()
 {
     _orderId  = String.Empty;
     _orderRec = Server.Instance.createArray();
     _orderRec.Replace(BookConst.ORDERS_ORDER_STATUS, "NEW");
     _orderRec.Replace(BookConst.ORDERS_ORIGIN_CODE, "PHONE");
     _orderRec.Replace(BookConst.ORDERS_SHIP_ID, "FREE");
     showOrder();
     _changed = false;
 }
예제 #2
0
        protected void paintDefinition()
        {
            // open the file from the definition
            if (Server.Instance.openFile(_defn.mainFile) == false)
            {
                throw new Exception("Cannot open file " + _defn.mainFile);
            }

            Text = _defn.heading;
            if (_defn.displayOnly)
            {
                cmdSave.Visible = false;
            }
            if (_defn.screenHeight > 0)
            {
                Height = _defn.screenHeight;
            }
            if (_defn.screenWidth > 0)
            {
                Width = _defn.screenWidth;
            }

            // build the display list
            ucScreen1.Screen = _defn;
            _fieldList       = Server.Instance.createArray();
            for (int i = 1; i <= _defn.fieldList.Count; i++)
            {
                _fieldList.Replace(i, _defn.fieldList[i - 1].name);
            }
        }
예제 #3
0
        /// <summary>
        /// addLine: add a new line to the order.
        /// </summary>
        /// <remarks>
        /// This updates the order array but must call the recalc before it can be displayed.
        /// </remarks>
        /// <param name="bookId"></param>
        /// <param name="qty"></param>
        protected void addLine(String bookId, int qty)
        {
            int noLines = 0;

            if (String.IsNullOrEmpty(_orderRec.Extract(BookConst.ORDERS_BOOK_ID).StringValue) == false)
            {
                noLines = _orderRec.Dcount(BookConst.ORDERS_BOOK_ID);
            }
            _orderRec.Replace(BookConst.ORDERS_BOOK_ID, noLines + 1, bookId);
            _orderRec.Replace(BookConst.ORDERS_QTY, noLines + 1, qty.ToString());

            recalcOrderLines();
            showOrderLines();
            _changed = true;
        }
예제 #4
0
        /// <summary>
        /// dosave: this does the build and save directly from the client.
        /// </summary>
        /// <remarks>
        /// This should only be used for single file or simple updates.
        /// </remarks>
        protected void doSave()
        {
            // read and update the current record
            UniDynArray clientRec = null;

            if (Server.Instance.readRecord("U2_CLIENTS", _clientData.ClientId, ref clientRec) == false)
            {
                clientRec = Server.Instance.createArray();
            }
            clientRec.Replace(BookConst.CLIENTS_FORENAME, txtForename.Text);
            clientRec.Replace(BookConst.CLIENTS_SURNAME, txtSurname.Text);
            String iDate = String.Empty;

            if (Server.Instance.iconv(txtJoinDate.Text, "D", ref iDate))
            {
                clientRec.Replace(BookConst.CLIENTS_JOIN_DATE, iDate);
            }
            clientRec.Replace(BookConst.CLIENTS_ADDRESS, txtAddress.Text.Replace(Server.CRLF, Server.VM_STR));

            if (Server.Instance.writeRecord("U2_CLIENTS", _clientId, clientRec))
            {
                MessageBox.Show("Client details updated");
            }
        }
예제 #5
0
파일: Server.cs 프로젝트: baffled/bookstore
        /// <summary>
        /// setBookData; set the book data back to the server to be saved
        /// </summary>
        /// <param name="bookId"></param>
        /// <param name="data"></param>
        /// <param name="lockFlag"></param>
        /// <returns></returns>
        public Boolean setBookData(string bookId, BookData data, bool lockFlag)
        {
            UniDynArray da      = Server.Instance.createArray();
            String      errText = string.Empty;

            da.Replace(BookConst.BOOKDATA_AUTHOR_ID, data.AuthorId);
            da.Replace(BookConst.BOOKDATA_AUTHOR_NAME, data.AuthorName);
            da.Replace(BookConst.BOOKDATA_DEPT, data.Department);
            da.Replace(BookConst.BOOKDATA_GENRE, data.Genre);
            da.Replace(BookConst.BOOKDATA_ISBN, data.ISBN);
            da.Replace(BookConst.BOOKDATA_LONG_DESCRIPTION, data.LongDescription);
            da.Replace(BookConst.BOOKDATA_MEDIA, data.Media);
            da.Replace(BookConst.BOOKDATA_MIN_ORDER, data.MinOrderQty.ToString());
            da.Replace(BookConst.BOOKDATA_PUBLISHER_ID, data.PublisherId);
            da.Replace(BookConst.BOOKDATA_PUBLISHER_NAME, data.PublisherName);
            da.Replace(BookConst.BOOKDATA_PURCH_PRICE, (data.PurchasePrice * 100).ToString());
            da.Replace(BookConst.BOOKDATA_SALE_PRICE, (data.SalesPrice * 100).ToString());
            da.Replace(BookConst.BOOKDATA_STOCK_LEVEL, data.StockLevel.ToString());
            da.Replace(BookConst.BOOKDATA_SUPPLIER_ID, data.SupplierId);
            da.Replace(BookConst.BOOKDATA_SUPPLIER_NAME, data.SupplierName);
            da.Replace(BookConst.BOOKDATA_TAX_CODE, data.TaxCode);
            da.Replace(BookConst.BOOKDATA_TITLE, data.ShortTitle);

            try {
                lock (_syncCall) {
                    UniSubroutine s = _sess.CreateUniSubroutine("u2_setBookData", 4);
                    s.SetArg(0, bookId);
                    s.SetArg(1, da);
                    s.SetArg(2, "1");
                    s.SetArg(3, String.Empty);

                    s.Call();

                    errText = s.GetArg(3);
                }
                if (String.IsNullOrEmpty(errText) == false)
                {
                    ShowError(errText);
                    return(false);
                }
            } catch (Exception ex) {
                ShowError(ex.Message);
                return(false);
            }
            return(true);
        }